2 ## FILENAME: arduino.nanorc
4 ## DESCRIPTION: The arduino.nanorc syntax files allows syntax highlighting
5 ## for Arduino sketch files in the GNU nano text editor.
7 ## Maintainer: Nicholas Wilde
11 ## HOMEPAGE: http://code.google.com/p/arduino-nano-editor-syntax/
13 ## COMMENTS: -Most of the code was taken from the c.nanorc code found with
15 ## -Direction was taken from the arduino vim syntax code by johannes
16 ## <https://bitbucket.org/johannes/arduino-vim-syntax/>
17 ## -Tested on Ubuntu Server 11.04 Natty Narwhal and GNU nano 2.2.6
19 ## DIRECTIONS: For Ubuntu Server 11.04 Natty Narwhal:
20 ## -Move this file <arduino.nanorc> to the nano directory
22 ## -Add arduino.nanorc reference to the nanorc settings file
26 ## /usr/share/nano/arduino.nanorc
29 syntax "INO" "\.?ino$"
32 color brightred "\<[A-Z_][0-9A-Z_]+\>"
35 color green "\<((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\>"
38 icolor green "\<(HIGH|LOW|INPUT|OUTPUT)\>"
41 icolor red "\<(DEC|BIN|HEX|OCT|BYTE)\>"
44 icolor green "\<(PI|HALF_PI|TWO_PI)\>"
47 icolor green "\<(LSBFIRST|MSBFIRST)\>"
50 icolor green "\<(CHANGE|FALLING|RISING)\>"
53 icolor green "\<(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\>"
55 ## === FUNCTIONS === ##
58 color green "\<(boolean|byte|char|float|int|long|word)\>"
61 color brightyellow "\<(case|class|default|do|double|else|false|for|if|new|null|private|protected|public|short|signed|static|String|switch|this|throw|try|true|unsigned|void|while)\>"
62 color magenta "\<(goto|continue|break|return)\>"
65 color brightyellow "\<(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\>"
68 color brightyellow "\<(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\>"
71 color brightyellow "\<(analogReference|analogRead|analogWrite)\>"
73 ## External Interrupts
74 color brightyellow "\<(attachInterrupt|detachInterrupt)\>"
77 color brightyellow "\<(delay|delayMicroseconds|millis|micros)\>"
80 color brightyellow "\<(pinMode|digitalWrite|digitalRead)\>"
83 color brightyellow "\<(interrupts|noInterrupts)\>"
86 color brightyellow "\<(noTone|pulseIn|shiftIn|shiftOut|tone)\>"
89 color magenta "\<(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\>"
92 color brightyellow "\<(setup|loop)\>"
95 color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
98 color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
101 color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
103 ## String highlighting. You will in general want your comments and
104 ## strings to come last, because syntax highlighting rules will be
105 ## applied in the order they are read in.
106 color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
108 ## This string is VERY resource intensive!
109 color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
112 color brightblue "^\s*//.*"
113 color brightblue start="/\*" end="\*/"
115 ## Trailing whitespace
116 color ,green "[[:space:]]+$"