devSpec: allow backslash escaped whitespace in STRING tokens
This allows us to use spaces when specifying window name selectors. Which is very convenient and cool.
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
%option nounput
|
||||
%{
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <algorithm>
|
||||
#include <deviceManager/deviceManager.h>
|
||||
#include "deviceSpecp.hh"
|
||||
%}
|
||||
@@ -24,7 +26,12 @@
|
||||
"(" { return LPAREN; }
|
||||
")" { return RPAREN; }
|
||||
[ \t]*"="[ \t]* { return EQUALS; } // Allow optional whitespace around equals
|
||||
[^=\|\(\) \t\r\n]+ { deviceSpecplval.str = strdup(yytext); return STRING; } // Exclude = from STRING tokens
|
||||
([^=\|\(\) \t\r\n]|\\[ \t])+ {
|
||||
std::string token(yytext);
|
||||
token.erase(std::remove(token.begin(), token.end(), '\\'), token.end());
|
||||
deviceSpecplval.str = strdup(token.c_str());
|
||||
return STRING;
|
||||
}
|
||||
\r?\n { /* ignore newlines */ }
|
||||
[ \t]+ { /* ignore whitespace */ }
|
||||
. { return yytext[0]; }
|
||||
|
||||
Reference in New Issue
Block a user