66257bcd0e
The new name is nicer and more distinguishing.
63 lines
1.7 KiB
LLVM
63 lines
1.7 KiB
LLVM
%option prefix="deviceAttachmentPipeSpecl"
|
|
%option nounput
|
|
%option noinput
|
|
%{
|
|
#include <vector>
|
|
#include <string>
|
|
#include <algorithm>
|
|
#include <deviceManager/deviceManager.h>
|
|
#include "deviceAttachmentPipeSpecp.hh"
|
|
%}
|
|
|
|
%%
|
|
"+adev" {
|
|
deviceAttachmentPipeSpecplval.chr = yytext[1];
|
|
return KEYWORD_SPECTYPE_ACTUATOR;
|
|
}
|
|
"+edev" {
|
|
deviceAttachmentPipeSpecplval.chr = yytext[1];
|
|
return KEYWORD_SPECTYPE_EXTROSPECTOR;
|
|
}
|
|
"+idev" {
|
|
deviceAttachmentPipeSpecplval.chr = yytext[1];
|
|
return KEYWORD_SPECTYPE_INTEROSPECTOR;
|
|
}
|
|
"||" { return DOUBLE_PIPE; }
|
|
"|" { return PIPE; }
|
|
"(" { return LPAREN; }
|
|
")" { return RPAREN; }
|
|
"=" { return EQUALS; }
|
|
(\\.|[^=\|\(\) \t\r\n])+ {
|
|
std::string token(yytext);
|
|
std::string unescaped;
|
|
unescaped.reserve(token.size());
|
|
|
|
for (size_t i = 0; i < token.size(); ++i)
|
|
{
|
|
if (token[i] != '\\')
|
|
{
|
|
unescaped.push_back(token[i]);
|
|
continue;
|
|
}
|
|
|
|
/* If a backslash is the final char before EOF, just continue so it gets
|
|
* dropped as a side effect.
|
|
*/
|
|
if (i + 1 >= token.size()) { continue; }
|
|
|
|
// Else push the char following the backslash.
|
|
unescaped.push_back(token[++i]);
|
|
}
|
|
|
|
deviceAttachmentPipeSpecplval.str = strdup(unescaped.c_str());
|
|
return STRING;
|
|
}
|
|
[ \t\r\n]+ { /* ignore all whitespace, including newlines */ }
|
|
. { return yytext[0]; }
|
|
%%
|
|
|
|
int deviceAttachmentPipeSpeclwrap(void)
|
|
{
|
|
return 1; // Indicate end of input
|
|
}
|