fix identifier -> keyword conversion

This commit is contained in:
Luna 2019-07-01 15:07:17 -03:00
parent ac23c0d2d7
commit b591ecdf9b

View file

@ -249,6 +249,9 @@ pub const Scanner = struct {
_ = self.advance();
}
// ugly hack.
self.rollback();
// after reading the identifier, we check
// if it is any of our keywords, if it is, then we add
// the specificed keyword type. if not, just .IDENTIFIER
@ -261,9 +264,6 @@ pub const Scanner = struct {
toktype = TokenType.Identifier;
}
// ugly hack.
self.rollback();
return self.makeToken(toktype);
}