javacc-7.0.4.grammars.DTDParser.jj Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of javacc Show documentation
Show all versions of javacc Show documentation
JavaCC modified by Tencent blueking.
The newest version!
/**
* name: DTDParser.jj
* modified: Apr 2, 2001
* author: John Gebbie
* email: [email protected]
*/
options {
DEBUG_PARSER = false;
}
PARSER_BEGIN(DTDParser)
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class DTDParser
{
public static void parse(InputStream aInSt) throws ParseException {
// create a parser (this object)
DTDParser parser = new DTDParser(aInSt);
// parse!
parser.dtd();
}
public static void main(String[] args) throws ParseException, FileNotFoundException {
parse(new FileInputStream(args[0]));
}
}
PARSER_END(DTDParser)
TOKEN :
{
|
| | | "." | "-" | "_" | ":" ) >
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| | "_" | ":" ) ( )* >
|
}
SKIP :
{
< ( " " | "\t" | "\n" | "\r" )+ >
// comment decl updated by Gagandeep Bhatia [mailto:[email protected]]
| < "" >
| < "" (~[">"])* ">" >
}
void dtd() :
{
}
{
( elementDecl() | attListDecl() )*
}
void elementDecl() :
{
}
{
" contentSpec() ">"
}
void contentSpec() :
{
}
{
| | LOOKAHEAD(2) mixed() | children()
}
void mixed() :
{
}
{
"(" ( ( "|" )* ")*" | ")" )
}
void children() :
{
}
{
seqchoice() [ modifier() ]
}
void seqchoice() :
{
}
{
"(" cp() ( choice() | seq() ) ")"
}
void choice() :
{
}
{
( "|" cp() )+
}
void seq() :
{
}
{
( "," cp() )*
}
void cp() :
{
}
{
( | seqchoice() ) [ modifier() ]
}
void modifier() :
{
}
{
"*" | "+" | "?"
}
void attListDecl() :
{
}
{
" ( attribDef() )* ">"
}
void attribDef() :
{
}
{
attribType() defaultDecl()
}
void attribType() :
{
}
{
stringType() | tokenizedType() | enumeratedType()
}
void stringType() :
{
}
{
}
void tokenizedType() :
{
}
{
| | | | | |
}
void enumeratedType() :
{
}
{
( notationType() | enumeration() )
}
void notationType() :
{
}
{
"(" ( "|" )* ")"
}
void enumeration() :
{
}
{
"(" ( "|" )* ")"
}
void defaultDecl() :
{
}
{
| | ( [ ] attribValue() )
}
void attribValue() :
{
}
{
}