Skip to content

Commit

Permalink
nitcc: add AST transformation tests
Browse files Browse the repository at this point in the history
Signed-off-by: Jean Privat <[email protected]>
  • Loading branch information
privat committed Aug 28, 2024
1 parent 2042530 commit beea28f
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 0 deletions.
20 changes: 20 additions & 0 deletions contrib/nitcc/tests/sav/trans2.input.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Start
s_0
s_0
s_0
s_0
s_0
s_1
b_0
'x'@(1:1-1:2)
b_0
'x'@(1:2-1:3)
c_0
'y'@(1:3-1:4)
c_0
'y'@(1:4-1:5)
b_0
'x'@(1:5-1:6)
c_0
'y'@(1:6-1:7)
Eof@(1:7-1:7)=''
4 changes: 4 additions & 0 deletions contrib/nitcc/tests/sav/trans_token.input.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Start
p
a@(1:1-1:2)='a'
Eof@(1:2-1:2)=''
1 change: 1 addition & 0 deletions contrib/nitcc/tests/trans2.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
xxyyxy
8 changes: 8 additions & 0 deletions contrib/nitcc/tests/trans2.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Grammar trans;

Parser

s = s b | b;
a = ;
b {-> a} = 'x' | c {->};
c {-> a} = 'y';
1 change: 1 addition & 0 deletions contrib/nitcc/tests/trans_token.input
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
a
6 changes: 6 additions & 0 deletions contrib/nitcc/tests/trans_token.sablecc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Lexer
a = 'a';

Parser
p = q;
q {-> a} = a {->};

0 comments on commit beea28f

Please sign in to comment.