micro/syntax_files/arduino.micro
2016-03-21 12:18:41 -04:00

117 lines
3.6 KiB
Text

## FILENAME: arduino.nanorc
##
## DESCRIPTION: The arduino.nanorc syntax files allows syntax highlighting
## for Arduino sketch files in the GNU nano text editor.
##
## Maintainer: Nicholas Wilde
## Version: 0.1
## DATE: 06/23/2011
##
## HOMEPAGE: http://code.google.com/p/arduino-nano-editor-syntax/
##
## COMMENTS: -Most of the code was taken from the c.nanorc code found with
## GNU nano 2.2.6.
## -Direction was taken from the arduino vim syntax code by johannes
## <https://bitbucket.org/johannes/arduino-vim-syntax/>
## -Tested on Ubuntu Server 11.04 Natty Narwhal and GNU nano 2.2.6
##
## DIRECTIONS: For Ubuntu Server 11.04 Natty Narwhal:
## -Move this file <arduino.nanorc> to the nano directory
## /usr/share/nano/
## -Add arduino.nanorc reference to the nanorc settings file
## /etc/nanorc
## ...
## ## Arduino
## /usr/share/nano/arduino.nanorc
## ...
syntax "INO" "\.?ino$"
##
color brightred "\b[A-Z_][0-9A-Z_]+\b"
##
color green "\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\b"
## Constants
icolor green "\b(HIGH|LOW|INPUT|OUTPUT)\b"
## Serial Print
icolor red "\b(DEC|BIN|HEX|OCT|BYTE)\b"
## PI Constants
icolor green "\b(PI|HALF_PI|TWO_PI)\b"
## ShiftOut
icolor green "\b(LSBFIRST|MSBFIRST)\b"
## Attach Interrupt
icolor green "\b(CHANGE|FALLING|RISING)\b"
## Analog Reference
icolor green "\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\b"
## === FUNCTIONS === ##
## Data Types
color green "\b(boolean|byte|char|float|int|long|word)\b"
## Control Structions
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"
color magenta "\b(goto|continue|break|return)\b"
## Math
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"
## Bits & Bytes
color brightyellow "\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\b"
## Analog I/O
color brightyellow "\b(analogReference|analogRead|analogWrite)\b"
## External Interrupts
color brightyellow "\b(attachInterrupt|detachInterrupt)\b"
## Time
color brightyellow "\b(delay|delayMicroseconds|millis|micros)\b"
## Digital I/O
color brightyellow "\b(pinMode|digitalWrite|digitalRead)\b"
## Interrupts
color brightyellow "\b(interrupts|noInterrupts)\b"
## Advanced I/O
color brightyellow "\b(noTone|pulseIn|shiftIn|shiftOut|tone)\b"
## Serial
color magenta "\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\b"
## Structure
color brightyellow "\b(setup|loop)\b"
##
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
##
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
## GCC builtins
color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__"
## String highlighting. You will in general want your comments and
## strings to come last, because syntax highlighting rules will be
## applied in the order they are read in.
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
## This string is VERY resource intensive!
color brightyellow "(?s)"(\\.|[^"])*\\[[:space:]]*$.*?^(\\.|[^"])*""
## Comments
color brightblue "//.*"
color brightblue "(?s)/\*.*?\*/"
## Trailing whitespace
color ,green "[[:space:]]+$"