Skip to content

Instantly share code, notes, and snippets.

@ainslec
Created April 15, 2014 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ainslec/10691414 to your computer and use it in GitHub Desktop.
Save ainslec/10691414 to your computer and use it in GitHub Desktop.
Sample GWT compatible JavaCC parser definition file
options {
static = false;
IGNORE_CASE = false;
JAVA_UNICODE_ESCAPE = true;
JDK_VERSION = "1.5";
// Not yet detected as a valid option by the Eclipse plugin, but works nonetheless. This is essential for GWT compatible generated code.
JAVA_TEMPLATE_TYPE = "modern";
}
PARSER_BEGIN(Parser)
package org.consoli.javaccgwt.example1.parse;
public class Parser {
}
PARSER_END(Parser)
SPECIAL_TOKEN :
{
< WHITESPACE: " " | "\t" | "\n" | "\r" >
}
TOKEN :
{
< ONE: "one" >
| < TWO: "two" >
| < THREE: "three" >
}
void parse() : {}
{
( < ONE > | < TWO > | < THREE >)+
< EOF >
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment