Enhydra 5.1 API

com.lutris.appserver.server.jolt.parser
Class JoltParser

java.lang.Object
  |
  +--com.lutris.appserver.server.jolt.parser.JoltParser
All Implemented Interfaces:
JoltParserConstants, JoltParserTreeConstants

public class JoltParser
extends java.lang.Object
implements JoltParserTreeConstants, JoltParserConstants

This parser uses JJTree and JavaCC to generate the Java class. There are multiple lexical states: DEFAULT html sections and jolt tag parsed contents IN_UNPARSED jolt tag unparsed contents ... IN_JOLT_TAG inside jolt tags (parsed contents) IN_U_JOLT_TAG inside jolt tags (unparsed contents) IN_JOLT_FIELD between the jolt field and end jolt field tags (@ ... @) IN_JOLT_FIELD_DEFAULT between the jolt field default and end jolt field tags : ... @) IN_ARG_NAME the left hand side of the equal sign ... = IN_U_ARG_NAME the left hand side of the equal sign ... = IN_ARG_VALUE the right hand side of the equal sign = ... IN_U_ARG_VALUE the right hand side of the equal sign = ... The reason for all of the _U states is that we don't want the token manager finding tokens and changing states inside of unparsed jolt contents. Because of this we end up with some almost identical Nodes for the parsed and unparsed contents states. When used as a standalone application the first and only argument is the file to be parsed. If no argument is passed System.in is parsed by default. Otherwise you can instantiate the JoltParser, call Start(), and then use a Visitor on the node tree as is done in main(). Known limitations: Jolt fields are recognized as tokens inside of comments within html sections. Jolt end tags are recognized as the end of a javadef section even if they are inside of a java comment.

Version:
$Revision: 1.1 $
Author:
Shawn McMurdo

Field Summary
 Token jj_nt
           
protected static com.lutris.appserver.server.jolt.parser.JJTJoltParserState jjtree
           
 boolean lookingAhead
           
 Token token
           
 JoltParserTokenManager token_source
           
 
Fields inherited from interface com.lutris.appserver.server.jolt.parser.JoltParserTreeConstants
JJTANYCALL, JJTARG, JJTARGLIST, JJTBOOLEANCONDITIONAL, JJTDEFINEDCONDITIONAL, JJTHTMLDEF, JJTHTMLSECTION, JJTINCLUDE, JJTJAVACATCH, JJTJAVADEF, JJTJAVAFINALLY, JJTJAVAIMPORT, JJTJOLTCONTENTS, JJTJOLTFIELD, JJTJOLTHTML, JJTJOLTPARSEDCONTENTS, JJTMETHODCONDITIONAL, jjtNodeName, JJTSOURCE, JJTSTART, JJTVOID
 
Fields inherited from interface com.lutris.appserver.server.jolt.parser.JoltParserConstants
ANYCALL, ARGDOT, ARGEQ, ARGVALUE, BOOLEANCONDITIONAL, CALL, CH, DEFAULT, DEFAULTSTART, DEFINEDCONDITIONAL, DIGIT, DOT, DQ, DQUOTE, ENCODINGEND, ENCODINGSTART, EOF, EQ, FIELD, HTML, HTMLCALL, HTMLCHAR, HTMLDEF, IDENTIFIER, IFCALL, IFDEF, IFEQ, IFLOOP, IFNCALL, IFNDEF, IFNEQ, IFNLOOP, IN_ARG_NAME, IN_ARG_VALUE, IN_JOLT_FIELD, IN_JOLT_FIELD_DEFAULT, IN_JOLT_TAG, IN_U_ARG_NAME, IN_U_ARG_VALUE, IN_U_JOLT_TAG, IN_UNPARSED, INCLUDE, JAVACALL, JAVACATCH, JAVADEF, JAVAFINALLY, JAVAIMPORT, JOLTEND, JOLTFIELDEND, JOLTFIELDSTART, JOLTSTART, LETTER, METHODCONDITIONAL, QUOTE, SOURCE, SQ, SQUOTE, TAGEND, tokenImage, U_ARGDOT, U_ARGEQ, U_ARGVALUE, U_TAGEND, U_VALUE, VALUE, WS
 
Constructor Summary
JoltParser(java.io.InputStream stream)
           
JoltParser(JoltParserTokenManager tm)
           
JoltParser(java.io.Reader stream)
           
 
Method Summary
 void AnyCall()
           
 void Arg()
           
 void ArgList()
           
 void BooleanConditional()
           
 void Conditional()
           
 void DefinedConditional()
           
static java.lang.String dequote(java.lang.String argvalue)
          Strips surrounding single and double quotes from argvalues.
 void disable_tracing()
           
 java.lang.String DoubleQuotedValue()
           
 void enable_tracing()
           
 java.lang.String FullName()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 void Htmldef()
           
 void HtmlSection()
           
 java.lang.String Identifier()
           
 void Include()
           
 void JavaCatch()
           
 void Javadef()
           
 void JavaFinally()
           
 void JavaImport()
           
 void JoltContents()
           
 void JoltField()
           
 java.lang.String JoltFieldDefault()
           
 java.lang.String JoltFieldDefaultValue()
           
 java.lang.String JoltFieldEncoding()
           
 void JoltHtml()
           
 void JoltParsedContents()
           
 void JoltSection()
           
static void main(java.lang.String[] args)
          The main entry point into the standalone parser.
 void MethodConditional()
           
 java.lang.String Name()
           
 void ReInit(java.io.InputStream stream)
           
 void ReInit(JoltParserTokenManager tm)
           
 void ReInit(java.io.Reader stream)
           
 java.lang.String SingleQuotedValue()
           
 void Source()
           
 ASTStart Start()
           
 void U_Arg()
           
 void U_ArgList()
           
 void U_BooleanConditional()
           
 void U_Conditional()
           
 void U_MethodConditional()
           
 java.lang.String UnQuotedValue()
           
static void usage()
          Prints a usage message.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jjtree

protected static com.lutris.appserver.server.jolt.parser.JJTJoltParserState jjtree

token_source

public JoltParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

JoltParser

public JoltParser(java.io.InputStream stream)

JoltParser

public JoltParser(java.io.Reader stream)

JoltParser

public JoltParser(JoltParserTokenManager tm)
Method Detail

main

public static void main(java.lang.String[] args)
The main entry point into the standalone parser.

Parameters:
args - The commandline arguments.

usage

public static void usage()
Prints a usage message.


dequote

public static java.lang.String dequote(java.lang.String argvalue)
Strips surrounding single and double quotes from argvalues.

Parameters:
argvalue - The string to dequote.
Returns:
The dequoted argvalue String.

Start

public final ASTStart Start()
                     throws ParseException
ParseException

Identifier

public final java.lang.String Identifier()
                                  throws ParseException
ParseException

Name

public final java.lang.String Name()
                            throws ParseException
ParseException

FullName

public final java.lang.String FullName()
                                throws ParseException
ParseException

JoltSection

public final void JoltSection()
                       throws ParseException
ParseException

JoltFieldEncoding

public final java.lang.String JoltFieldEncoding()
                                         throws ParseException
ParseException

SingleQuotedValue

public final java.lang.String SingleQuotedValue()
                                         throws ParseException
ParseException

DoubleQuotedValue

public final java.lang.String DoubleQuotedValue()
                                         throws ParseException
ParseException

UnQuotedValue

public final java.lang.String UnQuotedValue()
                                     throws ParseException
ParseException

JoltFieldDefaultValue

public final java.lang.String JoltFieldDefaultValue()
                                             throws ParseException
ParseException

JoltFieldDefault

public final java.lang.String JoltFieldDefault()
                                        throws ParseException
ParseException

JoltField

public final void JoltField()
                     throws ParseException
ParseException

HtmlSection

public final void HtmlSection()
                       throws ParseException
ParseException

JoltContents

public final void JoltContents()
                        throws ParseException
ParseException

JoltParsedContents

public final void JoltParsedContents()
                              throws ParseException
ParseException

Arg

public final void Arg()
               throws ParseException
ParseException

U_Arg

public final void U_Arg()
                 throws ParseException
ParseException

ArgList

public final void ArgList()
                   throws ParseException
ParseException

U_ArgList

public final void U_ArgList()
                     throws ParseException
ParseException

Conditional

public final void Conditional()
                       throws ParseException
ParseException

U_Conditional

public final void U_Conditional()
                         throws ParseException
ParseException

BooleanConditional

public final void BooleanConditional()
                              throws ParseException
ParseException

U_BooleanConditional

public final void U_BooleanConditional()
                                throws ParseException
ParseException

DefinedConditional

public final void DefinedConditional()
                              throws ParseException
ParseException

MethodConditional

public final void MethodConditional()
                             throws ParseException
ParseException

U_MethodConditional

public final void U_MethodConditional()
                               throws ParseException
ParseException

Javadef

public final void Javadef()
                   throws ParseException
ParseException

Htmldef

public final void Htmldef()
                   throws ParseException
ParseException

AnyCall

public final void AnyCall()
                   throws ParseException
ParseException

JoltHtml

public final void JoltHtml()
                    throws ParseException
ParseException

JavaImport

public final void JavaImport()
                      throws ParseException
ParseException

Include

public final void Include()
                   throws ParseException
ParseException

Source

public final void Source()
                  throws ParseException
ParseException

JavaCatch

public final void JavaCatch()
                     throws ParseException
ParseException

JavaFinally

public final void JavaFinally()
                       throws ParseException
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(JoltParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public final ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()

Enhydra 5.1 API