You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all, thanks a lot for implementing this tool. I have generated a parser and visitor for the OpenCypher syntax using your generator. Everything has worked well out of the box.
I have two small usability questions about working with the DAG.
Is there a way to get the type of a node using a helper function? Right now I am using a hacky method: ruleNames[parserNode.get_rule_index()], but this is a bit unwieldy. However, implementing a helper function seems complicated with the way the traits are set up.
Second, how can you visit a sub node explicitly using the visitor pattern? Currently, I am using child.accept(self);, but I am not sure if that is right way to visit or if it has unintended side effects.
I also have two minor comments on issues I encountered while using the generated code
There is a style issue regarding the generated code. The generated visitor and listener function calls use CamelCase style. Rust-analyzer complains about the lack of snake case, so I have to manually disable these checks. Are there plans to switch to snake case for the generated function calls?
Also another thing I have noticed is that the parser seems to continue even though it encounters an illegal expression. For example, for this piece of code:
letmut parser = CypherParser::new(token_source);let result = parser.oC_Cypher();match result {Err(e) => {
log::error!("Error parsing query: {:?}", e);}Ok(v) => {
to_ir::visit_result(v);}}
I am unable to catch an error that is thrown in the parser. The program continues despite a parsing error. What is the right way to handle an error here?
The text was updated successfully, but these errors were encountered:
First of all, thanks a lot for implementing this tool. I have generated a parser and visitor for the OpenCypher syntax using your generator. Everything has worked well out of the box.
I have two small usability questions about working with the DAG.
Is there a way to get the type of a node using a helper function? Right now I am using a hacky method:
ruleNames[parserNode.get_rule_index()]
, but this is a bit unwieldy. However, implementing a helper function seems complicated with the way the traits are set up.Second, how can you visit a sub node explicitly using the visitor pattern? Currently, I am using
child.accept(self);
, but I am not sure if that is right way to visit or if it has unintended side effects.I also have two minor comments on issues I encountered while using the generated code
There is a style issue regarding the generated code. The generated visitor and listener function calls use CamelCase style. Rust-analyzer complains about the lack of snake case, so I have to manually disable these checks. Are there plans to switch to snake case for the generated function calls?
Also another thing I have noticed is that the parser seems to continue even though it encounters an illegal expression. For example, for this piece of code:
I am unable to catch an error that is thrown in the parser. The program continues despite a parsing error. What is the right way to handle an error here?
The text was updated successfully, but these errors were encountered: