Commit 8aa7d57c authored by Stefan Marr's avatar Stefan Marr

Do not lex words beginning with 'primitive' as the symbol primitive

[backport from RTruffleSOM]
Signed-off-by: default avatarStefan Marr <>
parent a1b8e720
......@@ -141,7 +141,7 @@ class Lexer(object):
elif self._is_operator(self._current_char()):
elif self._buf[self._bufp:].startswith(self._PRIMITIVE):
elif self._next_word_in_buffer_is(self._PRIMITIVE):
self._bufp += len(self._PRIMITIVE)
self._sym = Symbol.Primitive
self._symc = '\0'
......@@ -172,6 +172,12 @@ class Lexer(object):
return self._sym
def _next_word_in_buffer_is(self, text):
if not self._buf[self._bufp:].startswith(text):
return False
char_after_text = self._bufchar(self._bufp + len(text))
return not char_after_text.isalnum()
def peek(self):
save_sym = self._sym
save_symc = self._symc
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment