Add a SEMICOLON token
Signed-off-by: Username404 <w.iron.zombie@gmail.com>
This commit is contained in:
parent
1d3046892f
commit
14b71906b7
|
@ -49,11 +49,11 @@ vector<tok> lex(const string& in)
|
|||
} else goto insertToken;
|
||||
}
|
||||
case DEFINE: case RPAR: case COMMA:
|
||||
case RBRACE: case RBRACKET:
|
||||
case RBRACE: case RBRACKET: case SEMICOLON:
|
||||
case PLUS: case HYPHEN: case LCOMP: case RCOMP:
|
||||
case DOT: case DOLLAR_SIGN: case SQUOTE:
|
||||
insertToken: resVal.emplace_back(static_cast<tok::type>(current), lineNumber);
|
||||
[[likely]] case ' ': case '\t': case '\r': case ';': break;
|
||||
[[likely]] case ' ': case '\t': case '\r': break;
|
||||
[[likely]] case '\n': ++lineNumber; break;
|
||||
default: {
|
||||
const tok::type type = getIdentifierCharType(current);
|
||||
|
|
|
@ -11,7 +11,7 @@ struct tok {
|
|||
typedef Yerbacon::Exception LexerException;
|
||||
enum type: const unsigned short {
|
||||
UNEXPECTED = std::numeric_limits<unsigned char>::max() + 1, IDENTIFIER, NUMBER, ALPHACHAR,
|
||||
DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$', DOT = '.', COMMA = ',',
|
||||
DEFINE = '=', TAG = '#', DOLLAR_SIGN = '$', DOT = '.', COMMA = ',', SEMICOLON = ';',
|
||||
LPAR = '(', LBRACE = '{', LBRACKET = '[', RPAR = ')',
|
||||
RBRACE = '}', RBRACKET = ']',
|
||||
PLUS = '+', HYPHEN = '-', DIVIDE = '/',
|
||||
|
|
|
@ -92,7 +92,7 @@ namespace Parser {
|
|||
const unsigned increment = 2 + isFinalDefine;
|
||||
const auto beginning = lexed.begin() + i + increment;
|
||||
const auto end = find_if(beginning, lexed.end(), [¤t](const tok& it){ // TODO Find another way of choosing the tokens to parse
|
||||
return it.line != current.line;
|
||||
return it.toktype == SEMICOLON || it.line != current.line;
|
||||
});
|
||||
parseTree << Define(isFinalDefine, current.toktext, parse(beginning, end));
|
||||
i += 1 + isFinalDefine + distance(beginning, end);
|
||||
|
|
Loading…
Reference in New Issue