├── .gitignore ├── LICENSE.md ├── README.md ├── grammars └── arduino.cson ├── package.json ├── settings └── language-arduino.cson └── snippets └── arduino.cson /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | npm-debug.log 3 | node_modules 4 | package-lock.json 5 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining 4 | a copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be 12 | included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Arduino language support in Atom 2 | 3 | Adds syntax highlighting and snippets to Arduino files in Atom. 4 | 5 | Inherits C++ syntax from [language-c](https://atom.io/packages/language-c) package. 6 | 7 | Contributions are greatly appreciated. Please fork this repository and open a 8 | pull request to add snippets, make grammar tweaks, etc. 9 | -------------------------------------------------------------------------------- /grammars/arduino.cson: -------------------------------------------------------------------------------- 1 | 'fileTypes': [ 2 | 'ino' 3 | 'pde' 4 | ] 5 | 'name': 'Arduino' 6 | 'scopeName': 'source.arduino' 7 | 'patterns': [ 8 | { 9 | 'include': 'source.cpp' 10 | } 11 | 12 | # For compatibility with Atom versions < 0.166 13 | { 14 | 'include': 'source.c++' 15 | } 16 | 17 | { 18 | 'match': '\\b(boolean|byte|word)\\b' 19 | 'name': 'storage.type.arduino' 20 | } 21 | { 22 | 'match': '\\bString\\b' 23 | 'name': 'support.class.arduino' 24 | } 25 | { 26 | 'match': '\\b(HIGH|LOW|INPUT|INPUT_PULLUP|OUTPUT|LED_BUILTIN|CHANGE|RISING|FALLING|PI|HALF_PI|TWO_PI|DEG_TO_RAD|RAD_TO_DEG|EULER|LSBFIRST|MSBFIRST|INTERNAL1V1|INTERNAL2V56|EXTERNAL|INTERNAL|DEFAULT|DEC|BIN|HEX|OCT|BYTE)\\b' 27 | 'name': 'constant.language.arduino' 28 | } 29 | { 30 | 'match': '\bB[01]{1,8}\b' 31 | 'name': 'constant.language.arduino' 32 | } 33 | { 34 | 'match': '\\b(acos|asin|atan2|constrain|degrees|map|max|min|radians|random|randomSeed|sq|bitRead|bitSet|bitCleatbit|lowByte|analogReference|analogReadResolution|analogReadResolution|analogRead|analogWrite|attachInterrupt|detachInterrupt|delay|delayMicroseconds|digitalWrite|digitalRead|interrupts|millis|micros|noInterrupts|noTone|pinMode|pulseIn|shiftOut|tone|begin|end|read|print|println|available|flush|setup|loop|isAlphaNumeric|isAlpha|isAscii|isWhiteSpace|isControl|isDigit|isLowerCase|isGraph|isLowerCase|isPrintable|isPunct|isSpace|isUpperCase|isHexadecimalDigit)\\b' 35 | 'name': 'support.function.arduino' 36 | } 37 | { 38 | 'match': '\\bPROGMEM\\b' 39 | 'name': 'storage.modifier.arduino' 40 | } 41 | ] 42 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "language-arduino", 3 | "version": "0.4.3", 4 | "description": "Atom language support for Arduino", 5 | "repository": "https://github.com/szechyjs/language-arduino", 6 | "license": "MIT", 7 | "engines": { 8 | "atom": ">0.50.0" 9 | }, 10 | "dependencies": {} 11 | } 12 | -------------------------------------------------------------------------------- /settings/language-arduino.cson: -------------------------------------------------------------------------------- 1 | '.source.arduino': 2 | 'editor': 3 | 'commentStart': '// ' 4 | 'increaseIndentPattern': '(?x) 5 | ^ .* \\{ [^}"\']* $ 6 | |^ .* \\( [^\\)"\']* $ 7 | |^ \\s* (public|private|protected): \\s* $ 8 | |^ \\s* @(public|private|protected) \\s* $ 9 | |^ \\s* \\{ \\} $ 10 | ' 11 | 'decreaseIndentPattern': '(?x) 12 | ^ \\s* (\\s* /[*] .* [*]/ \\s*)* \\} 13 | |^ \\s* (\\s* /[*] .* [*]/ \\s*)* \\) 14 | |^ \\s* (public|private|protected): \\s* $ 15 | |^ \\s* @(public|private|protected) \\s* $ 16 | ' 17 | 'foldEndPattern': '(? ${1:0}) {\n $2\n}' 45 | 'Serial Begin': 46 | 'prefix': 'sbegin' 47 | 'body': 'Serial.begin(${1:9600});$2' 48 | 'Serial End': 49 | 'prefix': 'send' 50 | 'body': 'Serial.end();' 51 | 'Serial Find': 52 | 'prefix': 'sfind' 53 | 'body': 'Serial.find(${1:target});$2' 54 | 'Serial Find Until': 55 | 'prefix': 'sfindUntil' 56 | 'body': 'Serial.findUntil(${1:target}, ${2:terminal});$3' 57 | 'Serial Flush': 58 | 'prefix': 'sflush' 59 | 'body': 'Serial.flush();' 60 | 'Serial Parse Float': 61 | 'prefix': 'spfloat' 62 | 'body': 'Serial.parseFloat();' 63 | 'Serial Parse Int': 64 | 'prefix': 'spint' 65 | 'body': 'Serial.parseInt();' 66 | 'Serial Peek': 67 | 'prefix': 'speek' 68 | 'body': 'Serial.peek();' 69 | 'Serial Print': 70 | 'prefix': 'sprint' 71 | 'body': 'Serial.print(${1:val}, ${2:format});$3' 72 | 'Serial Print Line': 73 | 'prefix': 'sprintln' 74 | 'body': 'Serial.println(${1:val}, ${2:format});$3' 75 | 'Serial Read': 76 | 'prefix': 'sread' 77 | 'body': 'Serial.read();' 78 | 'Serial Read Bytes': 79 | 'prefix': 'sreadBytes' 80 | 'body': 'Serial.readBytes(${1:buffer}, ${2:length});$3' 81 | 'Serial Read Bytes Until': 82 | 'prefix': 'sreadBytesUntil' 83 | 'body': 'Serial.readBytesUntil(${1:character}, ${2:buffer}, ${3:length});$4' 84 | 'Serial Set Timeout': 85 | 'prefix': 'stimeout' 86 | 'body': 'Serial.setTimeout(${1:time});$2' 87 | 'Serial Write': 88 | 'prefix': 'swrite' 89 | 'body': 'Serial.write(${1:data});$2' 90 | 'Setup': 91 | 'prefix': 'setup' 92 | 'body': """ 93 | void setup() { 94 | $1 95 | } 96 | """ 97 | 'Shift In': 98 | 'prefix': 'shiftIn' 99 | 'body': 'shiftIn(${1:dataPin}, ${2:clockPin}, ${3:bitOrder});$4' 100 | 'Shift Out': 101 | 'prefix': 'shiftOut' 102 | 'body': 'shiftout(${1:dataPin}, ${2:clockPin}, ${3:bitOrder}, ${4:value});$5' 103 | 'Tone': 104 | 'prefix': 'tone' 105 | 'body': 'tone(${1:pin}, ${2:frequency}, ${3:duration});$4' 106 | 'Millis': 107 | 'prefix': 'millis' 108 | 'body': 'millis()$1' 109 | --------------------------------------------------------------------------------