diff --git a/src/api/symboltable/scope.py b/src/api/symboltable/scope.py index e2d181cd2..7bd7a4720 100644 --- a/src/api/symboltable/scope.py +++ b/src/api/symboltable/scope.py @@ -29,7 +29,7 @@ class Scope: The caseins dict stores the symbol names in lowercase only if the global OPTION ignore case is enabled (True). This is because - most BASIC dialects are case insensitive. 'caseins' will be used + most BASIC dialects are case-insensitive. 'caseins' will be used as a fallback if the symbol name does not exists. On init() the parent mangle can be stored. The mangle is a prefix @@ -55,7 +55,7 @@ def __getitem__(self, key: str) -> Optional[SymbolVAR]: def __setitem__(self, key: str, value: SymbolVAR): assert isinstance(value, Symbol) self.symbols[key] = value - if value.caseins: # Declared with case insensitive option? + if value.caseins: # Declared with case-insensitive option? self.caseins[key.lower()] = value def __delitem__(self, key: str): diff --git a/src/zxbc/zxbc.py b/src/zxbc/zxbc.py index 18958d78e..4b663a800 100755 --- a/src/zxbc/zxbc.py +++ b/src/zxbc/zxbc.py @@ -165,7 +165,7 @@ def main(args=None, emitter=None): asm_output = "\n".join(asm_output) # Now filter them against the preprocessor again - zxbpp.setMode("asm") + zxbpp.setMode(zxbpp.PreprocMode.ASM) zxbpp.OUTPUT = "" zxbpp.filter_(asm_output, filename=input_filename) diff --git a/src/zxbc/zxbparser.py b/src/zxbc/zxbparser.py index 906b261bc..82a26b6ea 100755 --- a/src/zxbc/zxbparser.py +++ b/src/zxbc/zxbparser.py @@ -28,7 +28,7 @@ import src.api.symboltable.symboltable from src.api.debug import __DEBUG__ # analysis:ignore from src.api.opcodestemps import OpcodesTemps -from src.api.errmsg import error +from src.api.errmsg import error, warning_condition_is_always from src.api.errmsg import warning from src.api.global_ import LoopInfo @@ -1869,11 +1869,8 @@ def p_while_sentence(p): gl.LOOPS.pop() q = make_block(p[2], p[3]) - if is_number(p[1]) and p[1].value: - if q is None: - warning(p[1].lineno, "Condition is always true and leads to an infinite loop.") - else: - warning(p[1].lineno, "Condition is always true and might lead to an infinite loop.") + if is_number(p[1]): + warning_condition_is_always(p.lineno(1), bool(p[1].value)) p[0] = make_sentence(p.lineno(1), "WHILE", p[1], q)