Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
handle parser errors properly in new translator
for parser errors, the get token function differentiates between parser errors and number constant errors by considering if getting an operand and the data type of the error token (set to none for parser errors, or double for number constant errors) the parser setOperandState() function was removed and the operand state now passed in as an argument to the token() function the loop in the get expression function was rearranged to remove duplicated code before and at the end of the loop added several parser error tests to expression test #1
- Loading branch information
1 parent
a194cdb
commit 348ec22
Showing
6 changed files
with
84 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -48,3 +48,12 @@ a print | |
a a | ||
a + else | ||
a + + | ||
# parser error tests | ||
.. | ||
A .. | ||
A + .. | ||
A + B .. | ||
% | ||
A % | ||
A$ + % | ||
A + B % |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters