Skip to content

Commit cbaa442

Browse files
committed
Allow SENTENCE to be marked as sentinel
Useful to insert automatic "default" code.
1 parent 4483c06 commit cbaa442

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/symbols/sentence.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@
1515
class SymbolSENTENCE(Symbol):
1616
""" Defines a BASIC SENTENCE object. e.g. 'BORDER'.
1717
"""
18-
def __init__(self, lineno: int, filename: str, keyword: str, *args):
19-
""" keyword = 'BORDER', or 'PRINT'
18+
def __init__(self, lineno: int, filename: str, keyword: str, *args, is_sentinel=False):
19+
""" Params:
20+
- keyword: BASIC sentence token like 'BORDER', 'PRINT', ...
21+
- sentinel: whether this sentence was automagically added by the compiler
22+
(i.e. a RETURN "" in a string function when the user does not return anything)
2023
"""
2124
super(SymbolSENTENCE, self).__init__(*(x for x in args if x is not None))
2225
self.keyword = keyword
2326
self.lineno = lineno
2427
self.filename = filename
28+
self.is_sentinel = is_sentinel
2529

2630
@property
2731
def args(self):

0 commit comments

Comments
 (0)