diff --git a/compiler/__main__.py b/compiler/__main__.py index 3cae61c..fca3eb2 100644 --- a/compiler/__main__.py +++ b/compiler/__main__.py @@ -38,7 +38,7 @@ def main(): print("Source:\n", data) tokens = Lexer(data) - tokens = [token for token in tokens if token.kind not in [Tokens.Blank, Tokens.Newline]] + tokens = [token for token in tokens if token.kind not in [Tokens.Blank, Tokens.Newline, Tokens.Comment]] if rootLogger.level <= LogLevel.Debug: pprint(tokens) diff --git a/compiler/lexer.py b/compiler/lexer.py index 603b429..77187dd 100644 --- a/compiler/lexer.py +++ b/compiler/lexer.py @@ -45,6 +45,7 @@ class Tokens(enum.Enum): Colon = re.compile(r":") Semicolon = re.compile(r";") Comma = re.compile(r",") + Comment = re.compile(r"//.*") Newline = re.compile(r"\n", flags=re.MULTILINE) EOF = re.compile(r"\Z")