diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-01-21 21:05:06 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-01-21 21:05:06 +0100 |
| commit | 0c8bb1284de221eae92b08bcc16db7002bf9f3ba (patch) | |
| tree | 9903c1d22f1beebe14e47d71ef399b9facc31ac6 /lib/header | |
| parent | f00ead262076a1cf0429d6fb0de8671f6376af57 (diff) | |
| download | tools.nes-0c8bb1284de221eae92b08bcc16db7002bf9f3ba.tar.gz tools.nes-0c8bb1284de221eae92b08bcc16db7002bf9f3ba.zip | |
Introduce looking ahead when parsing literals
There were certain situations in which syntax ambiguity could arise. For
example, the parser as it stood could treat a valid expression such as
'lda #$80 >> 2' in an unexpected 'lda #$(80 >> 2)'.
This is of course bad, and it came from the fact that literals don't
have enclosing characters, and white spaces are not enough to provide
disambiguation in some cases. Because of this fact, the parser now has a
"look ahead" capability similar to many other parsers, and it's applied
for now only to literals. This looking ahead actually honors
parenthesis, so these can be added if the programmer wants to
explicitely disambiguate an expression.
This involved quite the heavy lifting, and some functions like
'parse_expression_with_identifier' had to be removed with the rewrite.
This had the side effect of having (hopefully) more sane functions all
around, and the parser also has a better capability to differentiate
between regular Values and Calls.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'lib/header')
0 files changed, 0 insertions, 0 deletions
