5c3bbdf114
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
35 lines
977 B
LLVM
35 lines
977 B
LLVM
%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
|
|
}
|