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 "\b[A-Z_][0-9A-Z_]+\b"
35 color green "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
38 color green (i) "\b(HIGH|LOW|INPUT|OUTPUT)\b"
41 color red (i) "\b(DEC|BIN|HEX|OCT|BYTE)\b"
44 color green (i) "\b(PI|HALF_PI|TWO_PI)\b"
47 color green (i) "\b(LSBFIRST|MSBFIRST)\b"
50 color green (i) "\b(CHANGE|FALLING|RISING)\b"
53 color green (i) "\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\b"
55 ## === FUNCTIONS === ##
58 color green "\b(boolean|byte|char|float|int|long|word)\b"
61 color brightyellow "\b(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)\b"
62 color magenta "\b(goto|continue|break|return)\b"
65 color brightyellow "\b(abs|acos|asin|atan|atan2|ceil|constrain|cos|degrees|exp|floor|log|map|max|min|radians|random|randomSeed|round|sin|sq|sqrt|tan)\b"
68 color brightyellow "\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\b"
71 color brightyellow "\b(analogReference|analogRead|analogWrite)\b"
73 ## External Interrupts
74 color brightyellow "\b(attachInterrupt|detachInterrupt)\b"
77 color brightyellow "\b(delay|delayMicroseconds|millis|micros)\b"
80 color brightyellow "\b(pinMode|digitalWrite|digitalRead)\b"
83 color brightyellow "\b(interrupts|noInterrupts)\b"
86 color brightyellow "\b(noTone|pulseIn|shiftIn|shiftOut|tone)\b"
89 color magenta "\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\b"
92 color brightyellow "\b(setup|loop)\b"
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 brightblacks 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 (s) ""(\\.|[^"])*\\[[:space:]]*$.*?^(\\.|[^"])*""
112 color brightblue "//.*"
113 color brightblue (s) "/\*.*?\*/"
115 ## Trailing whitespace
116 color ,green "[[:space:]]+$"