Skip to content

Commit 5799d6f

Browse files
authored
Merge pull request #610 from boriel/feature/make_warning_muteable
Feature/make warning muteable
2 parents 0181242 + 8c9b7c7 commit 5799d6f

File tree

3 files changed

+6
-9
lines changed

3 files changed

+6
-9
lines changed

src/api/symboltable/scope.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Scope:
2929
3030
The caseins dict stores the symbol names in lowercase only if
3131
the global OPTION ignore case is enabled (True). This is because
32-
most BASIC dialects are case insensitive. 'caseins' will be used
32+
most BASIC dialects are case-insensitive. 'caseins' will be used
3333
as a fallback if the symbol name does not exists.
3434
3535
On init() the parent mangle can be stored. The mangle is a prefix
@@ -55,7 +55,7 @@ def __getitem__(self, key: str) -> Optional[SymbolVAR]:
5555
def __setitem__(self, key: str, value: SymbolVAR):
5656
assert isinstance(value, Symbol)
5757
self.symbols[key] = value
58-
if value.caseins: # Declared with case insensitive option?
58+
if value.caseins: # Declared with case-insensitive option?
5959
self.caseins[key.lower()] = value
6060

6161
def __delitem__(self, key: str):

src/zxbc/zxbc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def main(args=None, emitter=None):
165165
asm_output = "\n".join(asm_output)
166166

167167
# Now filter them against the preprocessor again
168-
zxbpp.setMode("asm")
168+
zxbpp.setMode(zxbpp.PreprocMode.ASM)
169169
zxbpp.OUTPUT = ""
170170
zxbpp.filter_(asm_output, filename=input_filename)
171171

src/zxbc/zxbparser.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import src.api.symboltable.symboltable
2929
from src.api.debug import __DEBUG__ # analysis:ignore
3030
from src.api.opcodestemps import OpcodesTemps
31-
from src.api.errmsg import error
31+
from src.api.errmsg import error, warning_condition_is_always
3232
from src.api.errmsg import warning
3333
from src.api.global_ import LoopInfo
3434

@@ -1869,11 +1869,8 @@ def p_while_sentence(p):
18691869
gl.LOOPS.pop()
18701870
q = make_block(p[2], p[3])
18711871

1872-
if is_number(p[1]) and p[1].value:
1873-
if q is None:
1874-
warning(p[1].lineno, "Condition is always true and leads to an infinite loop.")
1875-
else:
1876-
warning(p[1].lineno, "Condition is always true and might lead to an infinite loop.")
1872+
if is_number(p[1]):
1873+
warning_condition_is_always(p.lineno(1), bool(p[1].value))
18771874

18781875
p[0] = make_sentence(p.lineno(1), "WHILE", p[1], q)
18791876

0 commit comments

Comments
 (0)