aboutsummaryrefslogtreecommitdiff
path: root/KicadNetLexer.g4
diff options
context:
space:
mode:
authorTrygve Laugstøl <trygvis@inamo.no>2016-07-26 00:22:55 +0200
committerTrygve Laugstøl <trygvis@inamo.no>2016-07-26 00:22:55 +0200
commit128e53d220d97225803d61d86f8e43439563181d (patch)
treee0d5da8d666c54d1d17e64ee6f52af424129f90d /KicadNetLexer.g4
downloadkicad-utils-128e53d220d97225803d61d86f8e43439563181d.tar.gz
kicad-utils-128e53d220d97225803d61d86f8e43439563181d.tar.bz2
kicad-utils-128e53d220d97225803d61d86f8e43439563181d.tar.xz
kicad-utils-128e53d220d97225803d61d86f8e43439563181d.zip
WIP: kicad_gen is a util to generate schematic.h files from KiCAD netlist files.
Current code contains a lexer and parser for KiCAD's netlist files and code to build a tree of the netlist which can be used for generation. Contains CMake code for integrating the generation into CMake too.
Diffstat (limited to 'KicadNetLexer.g4')
-rw-r--r--KicadNetLexer.g436
1 files changed, 36 insertions, 0 deletions
diff --git a/KicadNetLexer.g4 b/KicadNetLexer.g4
new file mode 100644
index 0000000..55bda85
--- /dev/null
+++ b/KicadNetLexer.g4
@@ -0,0 +1,36 @@
+lexer grammar KicadNetLexer;
+
+LPAREN: '(';
+RPAREN: ')';
+
+QUOTE: '"';
+
+CODE: 'code';
+COMP: 'comp';
+FIELD: 'field';
+NAME: 'name';
+NET: 'net';
+NODE: 'node';
+NUM: 'num';
+PIN: 'pin';
+REF: 'ref';
+TYPE: 'type';
+VALUE: 'value';
+
+
+//STRING: '"' (~[\\"] | '\\' [\\"])* '"';
+STRING: '"' ~["]* '"';
+
+INTEGER: [0-9]+;
+
+ID
+ : [/+~\_\-\.\*/a-zA-Z0-9]+
+ ;
+
+BlockComment
+ : '/*' .*? '*/' -> skip
+ ;
+
+WS
+ : [ \t\r\n]+ -> skip
+ ;