summaryrefslogtreecommitdiff
path: root/projects/hackc/parser.py
diff options
context:
space:
mode:
Diffstat (limited to 'projects/hackc/parser.py')
-rw-r--r--projects/hackc/parser.py28
1 files changed, 2 insertions, 26 deletions
diff --git a/projects/hackc/parser.py b/projects/hackc/parser.py
index 188bddc..406c139 100644
--- a/projects/hackc/parser.py
+++ b/projects/hackc/parser.py
@@ -2,32 +2,6 @@ from .tokens import Token
from .classes import Class
from .utils import *
-KEYWORDS = [
- "class",
- "constructor",
- "function",
- "method",
- "field",
- "static",
- "var",
- "int",
- "char",
- "boolean",
- "void",
- "true",
- "false",
- "null",
- "this",
- "let",
- "do",
- "if",
- "else",
- "while",
- "return",
-]
-
-SYMBOLS = "{}()[].,;+-*/&|<>=~"
-
class Parser:
def __init__(self, fp, extensions=[]):
@@ -82,6 +56,8 @@ class Parser:
break
rem = line[pos:] # remainder of line
+ if not rem:
+ continue
token = Token.from_line(rem, line_no, pos, extensions=self._extensions)
if token is not None:
self.tokens.append(token)