mirror of
https://github.com/YACReader/yacreader
synced 2025-07-18 04:54:29 -04:00
Remove space and atWord tokens
`atWord` wasn't used at all and spaces should be eaten by the lexer And added `unspecified` token
This commit is contained in:
@ -7,17 +7,16 @@ QueryLexer::QueryLexer(const std::string &input)
|
||||
|
||||
Token QueryLexer::next()
|
||||
{
|
||||
while (isSpace(peek())) {
|
||||
get();
|
||||
}
|
||||
|
||||
switch (peek()) {
|
||||
case '\0':
|
||||
return Token(Token::Type::eof);
|
||||
case '(':
|
||||
case ')':
|
||||
return single(Token::Type::opcode);
|
||||
case ' ':
|
||||
case '\t':
|
||||
case '\r':
|
||||
case '\n':
|
||||
return space();
|
||||
case '"':
|
||||
return quotedWord();
|
||||
default:
|
||||
@ -40,15 +39,6 @@ Token QueryLexer::single(Token::Type type)
|
||||
return Token(type, input.substr(index++, 1));
|
||||
}
|
||||
|
||||
Token QueryLexer::space()
|
||||
{
|
||||
auto start = index;
|
||||
get();
|
||||
while (isSpace(peek()))
|
||||
get();
|
||||
return Token(Token::Type::space, input.substr(start, index - start));
|
||||
}
|
||||
|
||||
Token QueryLexer::word()
|
||||
{
|
||||
auto start = index;
|
||||
|
Reference in New Issue
Block a user