Skip to content
This repository has been archived by the owner on May 21, 2024. It is now read-only.

Commit

Permalink
Merge pull request boriel-basic#610 from boriel/feature/make_warning_…
Browse files Browse the repository at this point in the history
…muteable

Feature/make warning muteable
  • Loading branch information
boriel committed Mar 13, 2022
2 parents 0181242 + 8c9b7c7 commit 5799d6f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/api/symboltable/scope.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/zxbc/zxbc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 3 additions & 6 deletions src/zxbc/zxbparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 5799d6f

Please sign in to comment.