mirror of https://github.com/t1meshift/js.git
parent
494ed06f28
commit
eea056550c
|
@ -3,7 +3,7 @@ So here it is.
|
||||||
"""
|
"""
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
__version__ = "0.0.2"
|
__version__ = "0.0.7"
|
||||||
__snake__ = r"""
|
__snake__ = r"""
|
||||||
_________ _________
|
_________ _________
|
||||||
/ \ / \
|
/ \ / \
|
||||||
|
|
|
@ -10,7 +10,7 @@ import coloredlogs
|
||||||
from jasminesnake import __version__, __snake__, LOG_LEVELS
|
from jasminesnake import __version__, __snake__, LOG_LEVELS
|
||||||
from .js_stream import JSBaseStream, JSStringStream, JSFileStream
|
from .js_stream import JSBaseStream, JSStringStream, JSFileStream
|
||||||
from .lex.ErrorListeners import LogErrorListener
|
from .lex.ErrorListeners import LogErrorListener
|
||||||
import ast
|
from ast import nodes, to_ascii_tree, from_parse_tree
|
||||||
|
|
||||||
|
|
||||||
def create_argument_parser():
|
def create_argument_parser():
|
||||||
|
@ -70,8 +70,12 @@ def main():
|
||||||
stream = JSFileStream(args.infile, LogErrorListener())
|
stream = JSFileStream(args.infile, LogErrorListener())
|
||||||
|
|
||||||
tree = stream.parse()
|
tree = stream.parse()
|
||||||
ast_tree = ast.from_parse_tree(tree)
|
|
||||||
|
|
||||||
|
ast_tree = from_parse_tree(tree)
|
||||||
|
ascii_ast = to_ascii_tree(ast_tree)
|
||||||
|
|
||||||
|
logging.debug("Got an AST!")
|
||||||
|
logging.debug(ascii_ast)
|
||||||
# TODO: run logic
|
# TODO: run logic
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -92,7 +96,11 @@ def main():
|
||||||
tree = stream.parse()
|
tree = stream.parse()
|
||||||
logging.debug("Got tree %s", tree.toStringTree(stream.parser.ruleNames))
|
logging.debug("Got tree %s", tree.toStringTree(stream.parser.ruleNames))
|
||||||
|
|
||||||
ast_tree = ast.from_parse_tree(tree)
|
ast_tree = from_parse_tree(tree)
|
||||||
|
ascii_ast = to_ascii_tree(ast_tree)
|
||||||
|
|
||||||
|
logging.debug("Got an AST!")
|
||||||
|
logging.debug(ascii_ast)
|
||||||
# TODO: run logic
|
# TODO: run logic
|
||||||
except EOFError:
|
except EOFError:
|
||||||
print("Ctrl-D received, shutting down...")
|
print("Ctrl-D received, shutting down...")
|
||||||
|
|
Loading…
Reference in New Issue