Devspec: Add lexer and parser for devSpecs
This grammar looks simple but it consumed 2 days of my time and it's giving me bugs all the same, but mostly working nicely. See the syntax documentation in /docs
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
%option prefix="deviceSpecl"
|
||||
%{
|
||||
#include <vector>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
#include "deviceSpecp.hh"
|
||||
%}
|
||||
|
||||
%%
|
||||
^a {
|
||||
deviceSpecplval.chr = yytext[0];
|
||||
return KEYWORD_SPECTYPE_ACTUATOR;
|
||||
}
|
||||
^e {
|
||||
deviceSpecplval.chr = yytext[0];
|
||||
return KEYWORD_SPECTYPE_EXTROSPECTOR;
|
||||
}
|
||||
^i {
|
||||
deviceSpecplval.chr = yytext[0];
|
||||
return KEYWORD_SPECTYPE_INTEROSPECTOR;
|
||||
}
|
||||
"||" { return DOUBLE_PIPE; }
|
||||
"|" { return PIPE; }
|
||||
"(" { return LPAREN; }
|
||||
")" { return RPAREN; }
|
||||
[^\|\(\) \t\r\n]+ { deviceSpecplval.str = strdup(yytext); return STRING; }
|
||||
\r?\n { /* ignore newlines */ }
|
||||
[ \t]+ { /* ignore whitespace */ }
|
||||
. { return yytext[0]; }
|
||||
%%
|
||||
|
||||
int deviceSpeclwrap(void)
|
||||
{
|
||||
return 1; // Indicate end of input
|
||||
}
|
||||
Reference in New Issue
Block a user