Skip to content

Commit

Permalink
Move eval/apply commands back by the other commands
Browse files Browse the repository at this point in the history
They somehow got separated.
  • Loading branch information
tekknolagi committed Dec 10, 2023
1 parent eaad22e commit 05ade2d
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions scrapscript.py
Original file line number Diff line number Diff line change
Expand Up @@ -3041,31 +3041,6 @@ def test_serialize_function(self) -> None:
)


def eval_command(args: argparse.Namespace) -> None:
if args.debug:
logging.basicConfig(level=logging.DEBUG)

program = args.program_file.read()
tokens = tokenize(program)
logger.debug("Tokens: %s", tokens)
ast = parse(tokens)
logger.debug("AST: %s", ast)
result = eval_exp({}, ast)
print(result)


def apply_command(args: argparse.Namespace) -> None:
if args.debug:
logging.basicConfig(level=logging.DEBUG)

tokens = tokenize(args.program)
logger.debug("Tokens: %s", tokens)
ast = parse(tokens)
logger.debug("AST: %s", ast)
result = eval_exp({}, ast)
print(result)


def fetch(url: Object) -> Object:
if not isinstance(url, String):
raise TypeError(f"fetch expected String, but got {type(url).__name__}")
Expand Down Expand Up @@ -3183,6 +3158,31 @@ def runsource(self, source: str, filename: str = "<input>", symbol: str = "singl
return False


def eval_command(args: argparse.Namespace) -> None:
if args.debug:
logging.basicConfig(level=logging.DEBUG)

program = args.program_file.read()
tokens = tokenize(program)
logger.debug("Tokens: %s", tokens)
ast = parse(tokens)
logger.debug("AST: %s", ast)
result = eval_exp({}, ast)
print(result)


def apply_command(args: argparse.Namespace) -> None:
if args.debug:
logging.basicConfig(level=logging.DEBUG)

tokens = tokenize(args.program)
logger.debug("Tokens: %s", tokens)
ast = parse(tokens)
logger.debug("AST: %s", ast)
result = eval_exp({}, ast)
print(result)


def repl_command(args: argparse.Namespace) -> None:
if args.debug:
logging.basicConfig(level=logging.DEBUG)
Expand Down

0 comments on commit 05ade2d

Please sign in to comment.