23 Lexer lexer(
"plain text $var $VaR ${x}\n");
28 EXPECT_EQ(
"[plain text ][$var][ ][$VaR][ ][$x]",
33 Lexer lexer(
"$ $$ab c$: $\ncde\n");
43 Lexer lexer(
"foo baR baz_123 foo-bar");
58 Lexer lexer(
"foo.dots $bar.dots ${bar.dots}\n");
72 Lexer lexer(
"foo$\nbad $");
76 EXPECT_EQ(
"input:2: bad $-escape (literal $ must be written as $$)\n" 92 Lexer lexer(
" \tfoobar");
TEST(Lexer, ReadVarValue)
bool ReadVarValue(EvalString *value, std::string *err)
Read the value side of a var = value line (complete with $escapes).
Token ReadToken()
Read a Token from the Token enum.
std::string DescribeLastError()
If the last token read was an ERROR token, provide more info or the empty string. ...
std::string Serialize() const
Construct a human-readable representation of the parsed state, for use in tests.
bool ReadIdent(std::string *out)
Read a simple identifier (a rule or variable name).
A tokenized string that contains variable references.
void Error(const char *msg,...)
Log an error message.