Skip to content

Commit 85e52ee

Browse files
committed
Uses own Debug flag in zxbpp parser
This will allow using -d for zxbpp and enables debugging, or -ddd in zxbc / zxbasm to enable debugging in zxbpp from them. This way -ddd is required to show macros parsing (very verbose and not related to the compiler) from the compiler, but only -d when using the zxbpp directly.
1 parent fd8d654 commit 85e52ee

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

zxbpp/zxbpp.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ def init():
7777
global ID_TABLE
7878
global CURRENT_FILE
7979

80+
OPTIONS.add_option_if_not_defined('debug_zxbpp', bool, False)
8081
global_.FILENAME = '(stdin)'
8182
OUTPUT = ''
8283
INCLUDED = {}
@@ -750,7 +751,7 @@ def filter_(input_, filename='<internal>', state='INITIAL'):
750751
CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
751752
LEXER.input(input_, filename)
752753
LEXER.lex.begin(state)
753-
parser.parse(lexer=LEXER, debug=OPTIONS.Debug.value > 2)
754+
parser.parse(lexer=LEXER, debug=OPTIONS.debug_zxbpp.value)
754755
CURRENT_FILE.pop()
755756
CURRENT_DIR = prev_dir
756757

@@ -776,7 +777,7 @@ def main(argv):
776777
if len(OUTPUT) and OUTPUT[-1] != '\n':
777778
OUTPUT += '\n'
778779

779-
parser.parse(lexer=LEXER, debug=OPTIONS.Debug.value > 2)
780+
parser.parse(lexer=LEXER, debug=OPTIONS.debug_zxbpp.value)
780781
CURRENT_FILE.pop()
781782
CURRENT_DIR = os.path.dirname(CURRENT_FILE[-1])
782783

@@ -786,7 +787,7 @@ def main(argv):
786787
if len(OUTPUT) and OUTPUT[-1] != '\n':
787788
OUTPUT += '\n'
788789

789-
parser.parse(lexer=LEXER, debug=OPTIONS.Debug.value > 2)
790+
parser.parse(lexer=LEXER, debug=OPTIONS.debug_zxbpp.value)
790791
CURRENT_FILE.pop()
791792
global_.FILENAME = prev_file
792793
return global_.has_errors
@@ -819,6 +820,7 @@ def entry_point(args=None):
819820

820821
options = parser.parse_args(args=args)
821822
OPTIONS.Debug.value = options.debug
823+
OPTIONS.debug_zxbpp.value = OPTIONS.Debug.value > 0
822824

823825
if options.stderr:
824826
OPTIONS.StdErrFileName.value = options.stderr

0 commit comments

Comments
 (0)