net.hydromatic.clapham.parser.bnf
Class BnfParser

java.lang.Object
  extended by net.hydromatic.clapham.parser.bnf.BnfParser
All Implemented Interfaces:
BnfParserConstants

public class BnfParser
extends java.lang.Object
implements BnfParserConstants

Parser for grammars in Backus-Naur Form (BNF) notation.

The supported grammar is Backus-Naur Form, extended with '*' (closure operator), '+' (mandatory repetition), but is not the grammar officially known as 'Extended Backus-Naur Form' (EBNF).

Version:
$Id: BnfParser.jj 3 2009-05-11 08:11:57Z jhyde $
Author:
Julian Hyde

Field Summary
 Token jj_nt
          Next token.
 Token token
          Current token.
 BnfParserTokenManager token_source
          Generated Token Manager.
 
Fields inherited from interface net.hydromatic.clapham.parser.bnf.BnfParserConstants
ASTERISK, BAR, BRACKETED_IDENTIFIER, COLCOLEQ, DEFAULT, DIGIT, EOF, HOOK, IDENTIFIER, IN_MULTI_LINE_COMMENT, IN_SINGLE_LINE_COMMENT, LETTER, LITERAL, LPAREN, MULTI_LINE_COMMENT, PLUS, QUOT, RPAREN, SINGLE_LINE_COMMENT, tokenImage
 
Constructor Summary
BnfParser(BnfParserTokenManager tm)
          Constructor with generated Token Manager.
BnfParser(java.io.InputStream stream)
          Constructor with InputStream.
BnfParser(java.io.InputStream stream, java.lang.String encoding)
          Constructor with InputStream and supplied encoding
BnfParser(java.io.Reader stream)
          Constructor.
 
Method Summary
 void disable_tracing()
          Disable tracing.
 void enable_tracing()
          Enable tracing.
 EbnfNode Expression()
           
 EbnfNode Factor()
           
 EbnfNode Factor2()
           
 EbnfNode Factor3()
           
 ParseException generateParseException()
          Generate ParseException.
 Token getNextToken()
          Get the next Token.
 Token getToken(int index)
          Get the specific Token.
 IdentifierNode Identifier()
           
 LiteralNode Literal()
           
 ProductionNode Production()
           
 void ReInit(BnfParserTokenManager tm)
          Reinitialise.
 void ReInit(java.io.InputStream stream)
          Reinitialise.
 void ReInit(java.io.InputStream stream, java.lang.String encoding)
          Reinitialise.
 void ReInit(java.io.Reader stream)
          Reinitialise.
 java.util.List<ProductionNode> Syntax()
          Syntactical Descriptions *
 EbnfNode Term()
           
static
<E extends EbnfNode>
void
toString(java.lang.StringBuilder buf, java.lang.String start, java.util.List<E> list, java.lang.String end)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

token_source

public BnfParserTokenManager token_source
Generated Token Manager.


token

public Token token
Current token.


jj_nt

public Token jj_nt
Next token.

Constructor Detail

BnfParser

public BnfParser(java.io.InputStream stream)
Constructor with InputStream.


BnfParser

public BnfParser(java.io.InputStream stream,
                 java.lang.String encoding)
Constructor with InputStream and supplied encoding


BnfParser

public BnfParser(java.io.Reader stream)
Constructor.


BnfParser

public BnfParser(BnfParserTokenManager tm)
Constructor with generated Token Manager.

Method Detail

toString

public static <E extends EbnfNode> void toString(java.lang.StringBuilder buf,
                                                 java.lang.String start,
                                                 java.util.List<E> list,
                                                 java.lang.String end)

Syntax

public final java.util.List<ProductionNode> Syntax()
                                            throws ParseException
Syntactical Descriptions *

Throws:
ParseException

Production

public final ProductionNode Production()
                                throws ParseException
Throws:
ParseException

Expression

public final EbnfNode Expression()
                          throws ParseException
Throws:
ParseException

Term

public final EbnfNode Term()
                    throws ParseException
Throws:
ParseException

Factor

public final EbnfNode Factor()
                      throws ParseException
Throws:
ParseException

Factor2

public final EbnfNode Factor2()
                       throws ParseException
Throws:
ParseException

Factor3

public final EbnfNode Factor3()
                       throws ParseException
Throws:
ParseException

Identifier

public final IdentifierNode Identifier()
                                throws ParseException
Throws:
ParseException

Literal

public final LiteralNode Literal()
                          throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)
Reinitialise.


ReInit

public void ReInit(java.io.InputStream stream,
                   java.lang.String encoding)
Reinitialise.


ReInit

public void ReInit(java.io.Reader stream)
Reinitialise.


ReInit

public void ReInit(BnfParserTokenManager tm)
Reinitialise.


getNextToken

public final Token getNextToken()
Get the next Token.


getToken

public final Token getToken(int index)
Get the specific Token.


generateParseException

public ParseException generateParseException()
Generate ParseException.


enable_tracing

public final void enable_tracing()
Enable tracing.


disable_tracing

public final void disable_tracing()
Disable tracing.


SourceForge.net_Logo