mirror of
https://github.com/github/codeql.git
synced 2026-05-20 06:07:07 +02:00
WIP
This commit is contained in:
@@ -426,11 +426,16 @@ module GLR<grammar/0 g> {
|
||||
result = "There are " + sr + " shift/reduce conflicts and " + rr + " reduce/reduce conflicts."
|
||||
)
|
||||
}
|
||||
|
||||
// This should be empty
|
||||
predicate debugStates(State state1, Symbol s) {
|
||||
count(state1.getTransition(s))>1
|
||||
}
|
||||
}
|
||||
|
||||
// Just some debugging information needed to quickeval predicates in modules
|
||||
string test_input(int i) { result = "I+I".charAt(i) }
|
||||
string test_input(int i) { result = "I+I-I".charAt(i) }
|
||||
|
||||
string test_grammar() { result = ["G -> E", "E -> E + E", "E -> I"] }
|
||||
string test_grammar() { result = ["G -> E", "E -> E + I", "E -> E - I", "E -> I"] }
|
||||
|
||||
module DebugContext = GLR<test_grammar/0>::GLRparser<test_input/1>;
|
||||
|
||||
17
cpp/ql/src/experimental/parsing/test4.ql
Normal file
17
cpp/ql/src/experimental/parsing/test4.ql
Normal file
@@ -0,0 +1,17 @@
|
||||
import glr
|
||||
|
||||
string grammar4() {
|
||||
result = ["G -> E", "E -> E + I", "E -> E - I", "E -> I"]
|
||||
}
|
||||
|
||||
string input4(int i) { result = "I+I-I".charAt(i) }
|
||||
|
||||
module Test4 = GLR<grammar4/0>::GLRparser<input4/1>;
|
||||
|
||||
query string conflicts() { result = GLR<grammar4/0>::conflicts() }
|
||||
|
||||
query int syntax_error() { result = Test4::syntax_error_position() }
|
||||
|
||||
from Test4::ParseNode parent, int i, Test4::ParseNode child
|
||||
where Test4::tree(parent,i,child)
|
||||
select parent, i, child
|
||||
Reference in New Issue
Block a user