Files

63 lines
1.7 KiB
LLVM
Raw Permalink Normal View History

%option prefix="deviceAttachmentPipeSpecl"
%option nounput
2025-01-16 09:47:16 -04:00
%option noinput
2025-01-07 14:08:17 -04:00
%{
#include <vector>
#include <string>
#include <algorithm>
2025-01-07 14:08:17 -04:00
#include <deviceManager/deviceManager.h>
#include "deviceAttachmentPipeSpecp.hh"
2025-01-07 14:08:17 -04:00
%}
%%
2025-01-17 11:57:47 -04:00
"+adev" {
deviceAttachmentPipeSpecplval.chr = yytext[1];
2025-01-07 14:08:17 -04:00
return KEYWORD_SPECTYPE_ACTUATOR;
}
2025-01-07 14:19:36 -04:00
"+edev" {
deviceAttachmentPipeSpecplval.chr = yytext[1];
2025-01-07 14:08:17 -04:00
return KEYWORD_SPECTYPE_EXTROSPECTOR;
}
2025-01-07 14:19:36 -04:00
"+idev" {
deviceAttachmentPipeSpecplval.chr = yytext[1];
2025-01-07 14:08:17 -04:00
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 */ }
2025-01-07 14:08:17 -04:00
. { return yytext[0]; }
%%
int deviceAttachmentPipeSpeclwrap(void)
2025-01-07 14:08:17 -04:00
{
return 1; // Indicate end of input
}