Skip to content

Commit

Permalink
Rename --no-debug to --no-debug-ops
Browse files Browse the repository at this point in the history
Resolves #116
  • Loading branch information
iafisher committed Feb 9, 2019
1 parent 32cf57d commit 4c9031c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Use of `SWI` and `RTI` operations now result in parse-time errors instead of run-time warnings.
- HERA files may no longer contain non-ASCII bytes.
- Type errors are detected even in files with parse errors.
- The `--no-debug` flag has been renamed to `--no-debug-ops`.

### Fixed
- The debugger will no longer crash when printing the value of a label on the last line of a program.
Expand Down
4 changes: 2 additions & 2 deletions hera/checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,9 @@ def typecheck(
if not settings.allow_interrupts and isinstance(op, (RTI, SWI)):
messages.err("hera-py does not support {}".format(op.name), loc=op.loc)

if settings.no_debug and isinstance(op, DebuggingOperation):
if settings.no_debug_ops and isinstance(op, DebuggingOperation):
messages.err(
"debugging instructions disallowed with --no-debug flag", loc=op.loc
"debugging instructions disallowed with --no-debug-ops flag", loc=op.loc
)

# Add constants to the symbol table as they are encountered, so that a given
Expand Down
4 changes: 2 additions & 2 deletions hera/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def __init__(
color=True,
data_start=DEFAULT_DATA_START,
debug=False,
no_debug=False,
no_debug_ops=False,
volume=VOLUME_NORMAL,
warn_octal_on=True,
warn_return_on=True
Expand All @@ -32,7 +32,7 @@ def __init__(
self.color = color
self.data_start = data_start
self.debug = debug
self.no_debug = no_debug
self.no_debug_ops = no_debug_ops
self.warn_octal_on = warn_octal_on
self.warn_return_on = warn_return_on
self.volume = volume
Expand Down
6 changes: 3 additions & 3 deletions hera/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def main(argv=None) -> Optional[VirtualMachine]:
# Arbitrary value copied over from HERA-C.
settings.data_start = 0xC167

settings.no_debug = arguments["--no-debug"]
settings.no_debug_ops = arguments["--no-debug-ops"]
settings.warn_return_on = not arguments["--warn-return-off"]
settings.warn_octal_on = not arguments["--warn-octal-off"]

Expand Down Expand Up @@ -175,7 +175,7 @@ def short_to_long(arg):
"--big-stack",
"--help",
"--no-color",
"--no-debug",
"--no-debug-ops",
"--quiet",
"--verbose",
"--version",
Expand All @@ -198,7 +198,7 @@ def short_to_long(arg):
-v, --version Show the version and exit.
--no-color Do not print colored output.
--no-debug Disallow debugging instructions.
--no-debug-ops Disallow debugging instructions.
-q --quiet Set output level to quiet.
--verbose Set output level to verbose.
--warn-octal-off Do not print warnings for zero-prefixed integer literals.
Expand Down
4 changes: 2 additions & 2 deletions test/test_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,14 +190,14 @@ def test_main_with_no_debug_flag(capsys):
with pytest.raises(SystemExit):
program = "print_reg(R1)"
with patch("sys.stdin", StringIO(program)):
main(["--no-debug", "-"])
main(["--no-debug-ops", "-"])

captured = capsys.readouterr()
assert (
captured.err
== """\
Error: debugging instructions disallowed with --no-debug flag, line 1 col 1 of <stdin>
Error: debugging instructions disallowed with --no-debug-ops flag, line 1 col 1 of <stdin>
print_reg(R1)
^
Expand Down

0 comments on commit 4c9031c

Please sign in to comment.