Debian Codegraph @

runtime/syntax/arduino.yaml

raw
1 filetype: ino
2
3 detect:
4 filename: "\\.ino$"
5
6 rules:
7 - identifier: "\\b[A-Z_][0-9A-Z_]+\\b"
8
9 ## Sized (u)int types
10 - type: "\\b((s?size)|((u_?)?int(8|16|32|64|ptr)))_t\\b"
11
12 ## Constants
13 - constant: "(?i)\\b(HIGH|LOW|INPUT|OUTPUT)\\b"
14
15 ## Serial Print
16 - constant: "(?i)\\b(DEC|BIN|HEX|OCT|BYTE)\\b"
17
18 ## PI Constants
19 - constant: "(?i)\\b(PI|HALF_PI|TWO_PI)\\b"
20
21 ## ShiftOut
22 - constant: "(?i)\\b(LSBFIRST|MSBFIRST)\\b"
23
24 ## Attach Interrupt
25 - constant: "(?i)\\b(CHANGE|FALLING|RISING)\\b"
26
27 ## Analog Reference
28 - constant: "(?i)\\b(DEFAULT|EXTERNAL|INTERNAL|INTERNAL1V1|INTERNAL2V56)\\b"
29
30 ## === FUNCTIONS === ##
31
32 ## Data Types
33 - type: "\\b(boolean|byte|char|float|int|long|word)\\b"
34
35 ## Control Structions
36 - statement: "\\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"
37 - statement: "\\b(goto|continue|break|return)\\b"
38
39 ## Math
40 - identifier: "\\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"
41
42 ## Bits & Bytes
43 - identifier: "\\b(bitRead|bitWrite|bitSet|bitClear|bit|highByte|lowByte)\\b"
44
45 ## Analog I/O
46 - identifier: "\\b(analogReference|analogRead|analogWrite)\\b"
47
48 ## External Interrupts
49 - identifier: "\\b(attachInterrupt|detachInterrupt)\\b"
50
51 ## Time
52 - identifier: "\\b(delay|delayMicroseconds|millis|micros)\\b"
53
54 ## Digital I/O
55 - identifier: "\\b(pinMode|digitalWrite|digitalRead)\\b"
56
57 ## Interrupts
58 - identifier: "\\b(interrupts|noInterrupts)\\b"
59
60 ## Advanced I/O
61 - identifier: "\\b(noTone|pulseIn|shiftIn|shiftOut|tone)\\b"
62
63 ## Serial
64 - identifier: "\\b(Serial|Serial1|Serial2|Serial3|begin|end|peek|read|print|println|available|flush)\\b"
65
66 ## Structure
67 - identifier: "\\b(setup|loop)\\b"
68
69 ##
70 - statement: "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
71
72 ## GCC builtins
73 - constant: "(__attribute__[[:space:]]*\\(\\([^)]*\\)\\)|__(aligned|asm|builtin|hidden|inline|packed|restrict|section|typeof|weak)__)"
74
75 - constant.string:
76 start: "\""
77 end: "\""
78 skip: "\\\\."
79 rules:
80 - constant.specialChar: "\\\\."
81
82 - constant.string:
83 start: "'"
84 end: "'"
85 skip: "\\\\."
86 rules:
87 - preproc: "..+"
88 - constant.specialChar: "\\\\."
89
90 - comment:
91 start: "//"
92 end: "$"
93 rules:
94 - todo: "(TODO|XXX|FIXME):?"
95
96 - comment:
97 start: "/\\*"
98 end: "\\*/"
99 rules:
100 - todo: "(TODO|XXX|FIXME):?"
101