Skip to content

Commit

Permalink
cleaned docstring
Browse files Browse the repository at this point in the history
  • Loading branch information
boolangery committed Oct 25, 2024
1 parent 27f6d6b commit 9410d94
Show file tree
Hide file tree
Showing 8 changed files with 539 additions and 492 deletions.
7 changes: 4 additions & 3 deletions luaparser/ast.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import json
from typing import Generator

from antlr4 import InputStream, CommonTokenStream
from antlr4 import InputStream, CommonTokenStream, Token
from antlr4.error.ErrorListener import ErrorListener, ConsoleErrorListener

from luaparser import printers
Expand All @@ -18,15 +18,16 @@ def parse(source: str) -> Chunk:
lexer.removeErrorListeners()
lexer.addErrorListener(ConsoleErrorListener())

token_stream = CommonTokenStream(lexer)
token_stream = CommonTokenStream(lexer, channel=Token.DEFAULT_CHANNEL)
comments_token_stream = CommonTokenStream(lexer, channel=Token.DEFAULT_CHANNEL)
parser = LuaParser(token_stream)
parser.addErrorListener(ConsoleErrorListener())
tree = parser.start_()

if parser.getNumberOfSyntaxErrors() > 0:
raise SyntaxException("syntax errors")
else:
v = BuilderVisitor()
v = BuilderVisitor(token_stream)
val = v.visit(tree)
print(val)
return val
Expand Down
Loading

0 comments on commit 9410d94

Please sign in to comment.