From e7091ba29c28352cfb33906092e212723db399b1 Mon Sep 17 00:00:00 2001 From: Kyle Gunger Date: Fri, 3 Dec 2021 19:03:08 -0500 Subject: [PARSE] Fix hex parsing ~ Apparently CF does work, it was probably just something on my end + Fix parsing of numeric literals with bases other than 10 --- tests/literal-test.tnsl | 12 ++++++------ tests/parameter-test.tnsl | 4 +++- tests/run-tests.sh | 16 ++++++++++------ 3 files changed, 19 insertions(+), 13 deletions(-) (limited to 'tests') diff --git a/tests/literal-test.tnsl b/tests/literal-test.tnsl index 6e55323..75789b5 100644 --- a/tests/literal-test.tnsl +++ b/tests/literal-test.tnsl @@ -28,19 +28,19 @@ # Invalid (some may be weeded out through the verify phase): -#;string s "" +## ;string s "" -#;int 0 i +## ;int 0 i # Invalid ops should also be detected if dealing with literals -#;char c ~= 's' +## ;char c ~= 's' # Debate over weather these are legal -#;int k = .1 +## ;int k = .1 -;int l = 0x01 +;int l = 01 ;int i -;a a; +;a a diff --git a/tests/parameter-test.tnsl b/tests/parameter-test.tnsl index cae89ab..6db35b1 100644 --- a/tests/parameter-test.tnsl +++ b/tests/parameter-test.tnsl @@ -14,5 +14,7 @@ limitations under the License. #/ ;int another = 0 -/; loop (int initial = 0, complex = 2) [initial < max || complex < 40; initial++; complex += 7; another += 2] + +/; loop (int initial = 0, complex = 2) [initial < max || complex < 40; initial++; complex = complex + 7; another = another + 2] + ;/ diff --git a/tests/run-tests.sh b/tests/run-tests.sh index 6cebbe7..0434b89 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -2,11 +2,15 @@ PARSECMD=../build/parse PARSEFILE=" " parse () { - $PARSECMD -in $1-test.tnsl -out $1-test.tnt + echo "ATTEMPTING TO PARSE $1-test.tnsl" + $PARSECMD $2 -in $1-test.tnsl -out $1-test.tnt + if [ $? -eq 0 ]; then + echo "SUCCESS!" + fi } -parse block -parse comment -parse literal -parse parameter -parse statement \ No newline at end of file +parse block "$1" +parse comment "$1" +parse literal "$1" +parse parameter "$1" +parse statement "$1" -- cgit v1.2.3