Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented support for multiple statement lines
added check for colon token statement separator after processing a command to getCommands(), which deletes the colon token and sets new colon sub-code in the last token added to the rpn output list; added end statement flag to colon code in table; added support for new colon sub-colon to token text() function; added new translator test #16 with various colon tests including errors (old translator segfaults on this test)
- Loading branch information
1 parent
a3a7152
commit 734521d
Showing
6 changed files
with
85 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,22 @@ | ||
################################################### | ||
# Translator Test #15: Colon Tests (2013-04-05) # | ||
################################################### | ||
|
||
A=SQR(17):PRINT A | ||
PRINT A:PRINT B | ||
PRINT A;:PRINT B | ||
INPUT A:PRINT A | ||
A,B,C=5.0:INPUT D | ||
A$,LEFT$(B$,1),MID$(C$,2,3)="A":PRINT A$ | ||
INPUT PROMPT "Number",A:PRINT A | ||
INPUT PROMPT "Number";A:PRINT A | ||
INPUT PROMPT "Number:";A:PRINT A | ||
INPUT A;:PRINT A | ||
PRINT A:REM output A | ||
PRINT A:'output A:test | ||
INPUT A;:R=SQR(A):PRINT"Sqrt(";A;")=";R | ||
|
||
# colon error tests | ||
: | ||
PRINT: | ||
PRINT::PRINT |
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 |
---|---|---|
@@ -0,0 +1,49 @@ | ||
|
||
Input: A=SQR(17):PRINT A | ||
Output: A<ref> 17 CvtDbl SQR( Assign':' A PrintDbl PRINT | ||
|
||
Input: PRINT A:PRINT B | ||
Output: A PrintDbl PRINT':' B PrintDbl PRINT | ||
|
||
Input: PRINT A;:PRINT B | ||
Output: A PrintDbl ;':' B PrintDbl PRINT | ||
|
||
Input: INPUT A:PRINT A | ||
Output: InputParse InputBegin A<ref> InputAssign INPUT':' A PrintDbl PRINT | ||
|
||
Input: A,B,C=5.0:INPUT D | ||
Output: A<ref> B<ref> C<ref> 5.0 AssignList':' InputParse InputBegin D<ref> InputAssign INPUT | ||
|
||
Input: A$,LEFT$(B$,1),MID$(C$,2,3)="A":PRINT A$ | ||
Output: A$<ref> B$<ref> 1 C$<ref> 2 3 "A" AssignKeepMid3 AssignKeepLeft Assign$':' A$ PrintStr PRINT | ||
|
||
Input: INPUT PROMPT "Number",A:PRINT A | ||
Output: "Number" InputParse InputBeginStr'Question' A<ref> InputAssign INPUT-PROMPT':' A PrintDbl PRINT | ||
|
||
Input: INPUT PROMPT "Number";A:PRINT A | ||
Output: "Number" InputParse InputBeginStr A<ref> InputAssign INPUT-PROMPT':' A PrintDbl PRINT | ||
|
||
Input: INPUT PROMPT "Number:";A:PRINT A | ||
Output: "Number:" InputParse InputBeginStr A<ref> InputAssign INPUT-PROMPT':' A PrintDbl PRINT | ||
|
||
Input: INPUT A;:PRINT A | ||
Output: InputParse InputBegin A<ref> InputAssign INPUT'Keep:' A PrintDbl PRINT | ||
|
||
Input: PRINT A:REM output A | ||
Output: A PrintDbl PRINT':' REM| output A| | ||
|
||
Input: PRINT A:'output A:test | ||
Output: A PrintDbl PRINT':' '|output A:test| | ||
|
||
Input: INPUT A;:R=SQR(A):PRINT"Sqrt(";A;")=";R | ||
Output: InputParse InputBegin A<ref> InputAssign INPUT'Keep:' R<ref> A SQR( Assign':' "Sqrt(" PrintStr A PrintDbl ")=" PrintStr R PrintDbl PRINT | ||
|
||
Input: : | ||
^-- expected command | ||
|
||
Input: PRINT: | ||
^-- expected command | ||
|
||
Input: PRINT::PRINT | ||
^-- expected command | ||
|
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