Store parser values according to the rule/pattern type

This commit is contained in:
josh committed 2022-11-13 22:20:30 -05:00
1 parent e4a160f918
commit c6ea4f83c2
8 files changed
+87 -24

No files matched your search

+14
View File
@@ -186,6 +186,12 @@ token abc(string);
token bar;
tokenid int(integer);
/xyz/ (string) <<
>>
/z28/ <<
>>
Start (node) -> R;
R -> abc int;
EOF
@@ -210,6 +216,14 @@ EOF
o = grammar.rules.find {|rule| rule.name == "R"}
expect(o).to_not be_nil
expect(o.ptypename).to be_nil
o = grammar.patterns.find {|pattern| pattern.pattern == "xyz"}
expect(o).to_not be_nil
expect(o.ptypename).to eq "string"
o = grammar.patterns.find {|pattern| pattern.pattern == "z28"}
expect(o).to_not be_nil
expect(o.ptypename).to be_nil
end
end
end