Closed ashkotin closed 10 years ago
Can you include the top of RuleHandler13.java (the part with the annotation declaration)? Is the rule in the grammar file have the period quoted?
::= Declaration Id sort .
-OR-
::= Declaration Id sort '.'
It was
::= Declaration Id sort '.'
and I have changed to
I have responded from my google email web-client and it looks like attachment lost. Here you are:
package prenex_FOLsn; //========================================================================= //RULE HANDLER CLASS BEGINS =============================================== //=========================================================================
import com.creativewidgetworks.goldparser.engine.ParserException; import com.creativewidgetworks.goldparser.engine.Reduction; import com.creativewidgetworks.goldparser.parser.GOLDParser; import com.creativewidgetworks.goldparser.parser.ProcessRule;
// Note: More than one rule can be mapped per class. Simply append
// a comma to each quoted production description except for the last.
@ProcessRule(rule={
"
})
/**
Rule handler for the DECLARATION_DECLARATION_ID_SORT_DOT rule. */ public class RuleHandler13 extends Reduction { private GOLDParser theParser;
public RuleHandler13(GOLDParser parser) {
theParser = parser; // Save so execute() has access.
Reduction reduction = parser.getCurrentReduction();
if (reduction != null) {
// Example block that ensures at least 1 parameter is provided, but not more than 2.
if (reduction.size() > 0 && reduction.size() < 3) {
// Insert your code here
System.out.println("
}
@Override public void execute() throws ParserException { // Insert your code here } }
//========================================================================= //RULE HANDLER CLASS ENDS ================================================= //=========================================================================
And even more interesting: when I have created small grammar (2 rules) just to check ¬ - everything does work!
I am assuming that the GOLD Builder isn't reporting any errors with your grammar making it an issue with either the way the template is being built or the Java engine itself.
Could you send along the part of your grammar file that defines that rule, if not the entire grammar? It appears that the left hand side is missing (note the space before ::=) and I'd like to understand what is happening.
Rule itself is
I haven't been able to duplicate the problem, but it may be related to the UTF-8 issue. I will be posting an updated engine soon with better UTF-8 support. I presume your 59 rules are being processed correctly. However, if you encounter this problem again, I would like a copy of the grammar file so I can see where the problem is being generated.
OK. But I need some time to play with my grammar myself:-)
2012/9/26 Ralph Iden notifications@github.com
I haven't been able to duplicate the problem, but it may be related to the UTF-8 issue. I will be posting an updated engine soon with better UTF-8 support. I presume your 59 rules are being processed correctly. However, if you encounter this problem again, I would like a copy of the grammar file so I can see where the problem is being generated.
— Reply to this email directly or view it on GitHubhttps://github.com/ridencww/goldengine/issues/8#issuecomment-8878745.
Closing this issue because I can't duplicate the problem.
I am having this problem as well. Oddly, I only see it when I set 'wantTree' to false, and only on the '-' operators. Parsing "A + B;" succeeds but "A - B;" fails with:
"No rule handler for rule <add> ::= <add> - <unary>."
If I manually unquote the '-' in the generated annotation it parses fine. A grammar that displays the problem is below. I would appreciate if you could take a look at this. -- Rod
GOLD Parser Builder version 5.2, goldengine version 5.0.3 from maven.
"Name" = 'C-Expression'
"Start Symbol" = <program>
ID = {Letter}+
<program>
::= <expr> ';'
<expr>
::= <add>
<add>
::= <add> '-' <unary>
| <add> '+' <unary>
| <unary>
<unary>
::= '-' <value>
| '+' <value>
| <value>
<value>
::= ID
Thank you for providing a grammar that exposes the problem. I have confirmed the inability to retrieve the rule because of the single quote marks. I will write a failing test, fix the code, and prepare a new release. Allow me a day or two to get this done.
No hurry, thanks for the help!
I have identified the issue, wrote a test exposing it, and fixed the problem. I want to have another look tomorrow to make sure that I'm not imposing constraints on when a token needs to be quoted. I plan on committing the code, building the library, and pushing to the Maven Central Repository tomorrow.
Thanks to roderickgreen, a defect the Java engine was identified and corrected. GOLDEngine 5.0.4 is now ready for consumption. Source on GitHub, jars at the Maven Central repository, and available from the link on the README.md. All should be well now, but check it out and confirm the fix.
I can confirm the issue is fixed in 5.0.4. Thanks again for your help, and for providing this code!
Thank you for providing the grammar that exposed this! I had a go at this two years ago, but couldn't duplicate the issue. I hope you get some good use from the engine and Devin Cook's GOLD Builder. Closing this issue.
I have got message
No rule handler for rule ::= Declaration Id sort .
But I have this handler (RuleHandler13.class) in my folder (\prenex_FOLsn) for handlers.
What should I do?