dsql.parser
Class Parser

java.lang.Object
  extended bydsql.DMExecuted
      extended bydsql.parser.Parser
All Implemented Interfaces:
ParserConstants, ParserTreeConstants

public class Parser
extends DMExecuted
implements ParserTreeConstants, ParserConstants


Field Summary
 Token jj_nt
           
protected  dsql.parser.JJTParserState jjtree
           
 boolean lookingAhead
           
 Token token
           
 ParserTokenManager token_source
           
 
Fields inherited from interface dsql.parser.ParserTreeConstants
JJTANDOP, JJTARRAYINDEX, JJTASSIGNMENT, JJTCONCAT, JJTCOUNT, JJTDELETE, JJTDIFF, JJTDOC, JJTDOT, JJTDYNAMICSTRING, JJTEQUALS, JJTEXISTS, JJTEXIT, JJTFLOATDIVOP, JJTFLOATLIT, JJTFOREACH, JJTGTOP, JJTIF, JJTINOP, JJTINSERT, JJTINTER, JJTINTLIT, JJTLEFT, JJTLENGTH, JJTLIST, JJTLTOP, JJTMETA, JJTMETHODCALL, JJTMINUSOP, JJTMULTOP, JJTNEW, jjtNodeName, JJTNOTEQUALS, JJTNOTOP, JJTOROP, JJTPLUSOP, JJTPRINT, JJTQUOTE, JJTRANGE, JJTRETURN, JJTRIGHT, JJTSENDEMAIL, JJTSETMINUS, JJTSTATICSTRING, JJTSUB, JJTSUBCALL, JJTSUBSTRING, JJTSYSDATE, JJTUNION, JJTUPDATE, JJTVARIABLE, JJTVOID, JJTWHILE, JJTXMLELEMENT, JJTXMLENTITY, JJTXMLTEXT
 
Fields inherited from interface dsql.parser.ParserConstants
ALL, ALLRESULTS, AND, APPEND, AXMLTAG, CLOSEBRACKET, CLOSESQUAREBRACKET, COLUMNLIT, COMMA, COUNT, CSV, CURRENT, DEFAULT, DEL, DELETE, DIFF, DIVSIGN, DOTATEXP, DOTDOT, DOTEXP, DQUOTEEND, DQUOTESTART, ELSE, EOF, EQUAL, EQUALS, ESCDQSTRING, EXISTS, EXIT, FILE, FLOATLIT, FOREACH, GT, GTE, IF, IN, INDEXINT, INDEXVAR, INSERT, INTER, INTERSECT, INTLIT, INTO, INVALIDTAG, LEFT, LEN, LENGTH, LINECMNT, LT, LTE, META, MINUS, MINUSSIGN, MULTSIGN, NEW, NOHEADER, NOT, NOTEQUALS, OPENBRACKET, OPENSQUAREBRACKET, OR, PLUSSIGN, PRINT, PRINTLN, RETURN, RIGHT, SCRIPTCOMMENT, SCRIPTDQSPECIAL, SCRIPTDQSTRING, SCRIPTDQSTRINGSTATE, SCRIPTLINECOMMENT, SCRIPTSTRING, SCRIPTSTRINGSTATE, SEMICOLON, SENDEMAIL, STRCONCAT, STRCONCAT_DEP, SUB, SUBSTRING, SYSDATE, TABLE, TO, tokenImage, UNION, UPD, UPDATE, VALUES, VARIABLE, WHILE, XML, XMLATTR, XMLCOMMENT, XMLDQEND, XMLDQSPECIAL, XMLDQSTART, XMLDQSTRING, XMLEMPTYTAGCLOSE, XMLENTITY, XMLETAGOPEN, XMLPI, XMLSPECIALCHAR, XMLSQLQUOTE, XMLSTAGOPEN, XMLSTRINGSTATE, XMLTAG, XMLTAGATTR, XMLTAGCLOSE, XMLTAGNAME, XMLTEXT
 
Constructor Summary
Parser(java.io.InputStream stream)
           
Parser(ParserTokenManager tm)
           
Parser(java.io.Reader stream)
           
 
Method Summary
 void AndOp()
           
 void AnyXMLContent()
           
 void AnyXMLElement()
           
 void ArrayIndex()
           
 void ArrayIndexInt()
           
 void ArrayIndexVar()
           
 void Assignment()
           
 void BinaryOpList()
          It would be a bit complex to have priorities built-in the parser, so instead we take a simpler approach: first build a flat list, and then build the operators one by one by order of priority
 void BooleanOp()
          NotOp is separate because it is unary!
 void Bracket2Expressions()
           
 void Bracket3Expressions()
           
 void BracketExpression()
           
 void BracketNExpressions()
           
protected  ASTBinaryOperator buildBinaryOp(java.util.Vector v)
          takes a flat vector of arguments and operators, and produce a tree-like structure with operators precedence
 void ComparisonOp()
           
 void Concat()
           
 void Count()
           
 void Delete()
           
 void DiffOp()
           
 void disable_tracing()
           
 ASTDoc Document(java.lang.String fileName)
          XML Document
 ASTDoc DocumentWithParent(ASTDoc parentDoc, java.lang.String fileName)
           
 void DotAt()
           
 void DotColumn()
           
 void DotExpression()
           
 void DynamicString()
          For example, "haha$x"
 ASTDynamicString DynamicStringContents()
           
 void ElementAnyContent(java.lang.String parentName)
           
 void enable_tracing()
           
 void Equals()
           
 void Exists()
           
 void Exit()
           
 void Expression()
           
 void FloatDivOp()
           
 ASTNumberLit FloatLiteral()
           
 void ForEach()
           
 ParseException generateParseException()
           
 Token getNextToken()
           
 Token getToken(int index)
           
 void GteOp()
           
 void GtOp()
           
 void If()
           
 void InOp()
           
 void Insert()
           
 void Inter()
           
 ASTNumberLit IntLiteral()
           
 void jjtreeCloseNodeScope(Node n)
           
 void jjtreeOpenNodeScope(Node n)
          For each node, sets the current line
 void Left()
           
 void Length()
           
 void ListInit()
           
 void LteOp()
           
 void LtOp()
           
 void MathOp()
           
 void Meta()
           
 void MethodCall()
           
 void MinusOp()
           
 void MultOp()
           
 void NewObject()
           
 void NotEquals()
           
 void NotOp()
           
 void NumberLiteral()
           
 java.lang.String ObjectOrSubName()
           
 void OrOp()
           
 void PlusOp()
           
protected  void postArguments()
          change arguments X Y to Y(X)
 void PostExpression()
           
 void PostSelectExpression()
           
 void Print()
           
 void Range()
           
 ASTXMLElement recastXMLElement(ASTXMLElement ele)
          This is used by the parser to generate specicific classes for XML elements
 void ReInit(java.io.InputStream stream)
           
 void ReInit(ParserTokenManager tm)
           
 void ReInit(java.io.Reader stream)
           
 void Return()
           
 void Right()
           
 void SendEmail()
           
 void SetMinus()
           
 void SetOp()
           
 void SimpleExpression()
           
 void SQLQuoteString()
           
 void Statement()
           
 void StatementOrExpression()
           
 void StaticString()
           
 void String()
           
 ASTStaticString StringInDynamicString()
          A static string inside a dynamic string, i.e. "..."
 void SubCall()
           
 void SubDef()
           
 void Substring()
           
 void Sysdate()
           
 void TextOrphan(java.lang.StringBuffer buf)
          These tokens were not preceded by an expression or a variable evaluate then as text
 void Union()
           
 void Update()
           
 void Variable()
           
 void VariableInString()
           
 void While()
           
 void XMLAttribute(ASTXMLElement node)
           
 ASTDynamicString XMLAttributeDynamic()
          XML attribute string
 void XMLEntity()
           
 ASTDoc XMLHeader(boolean _allowDSQL, boolean _allowVarSubstitution)
          this is used only when parsing xml for with file
 ASTXMLElement XMLNextElement(boolean _allowDSQL, boolean _allowVarSubstitution)
          this is used only when parsing xml for with file
 boolean XMLText(boolean quote)
          Produce one XMLText for a sequence of text tokens
 
Methods inherited from class dsql.DMExecuted
getCaller, setCaller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jjtree

protected dsql.parser.JJTParserState jjtree

token_source

public ParserTokenManager token_source

token

public Token token

jj_nt

public Token jj_nt

lookingAhead

public boolean lookingAhead
Constructor Detail

Parser

public Parser(java.io.InputStream stream)

Parser

public Parser(java.io.Reader stream)

Parser

public Parser(ParserTokenManager tm)
Method Detail

jjtreeOpenNodeScope

public void jjtreeOpenNodeScope(Node n)
For each node, sets the current line


jjtreeCloseNodeScope

public void jjtreeCloseNodeScope(Node n)

postArguments

protected void postArguments()
change arguments X Y to Y(X)


buildBinaryOp

protected ASTBinaryOperator buildBinaryOp(java.util.Vector v)
                                   throws ParseException
takes a flat vector of arguments and operators, and produce a tree-like structure with operators precedence

Throws:
ParseException

recastXMLElement

public ASTXMLElement recastXMLElement(ASTXMLElement ele)
This is used by the parser to generate specicific classes for XML elements


Document

public final ASTDoc Document(java.lang.String fileName)
                      throws ParseException
XML Document

Throws:
ParseException

DocumentWithParent

public final ASTDoc DocumentWithParent(ASTDoc parentDoc,
                                       java.lang.String fileName)
                                throws ParseException
Throws:
ParseException

XMLHeader

public final ASTDoc XMLHeader(boolean _allowDSQL,
                              boolean _allowVarSubstitution)
                       throws ParseException
this is used only when parsing xml for with file

Throws:
ParseException

XMLNextElement

public final ASTXMLElement XMLNextElement(boolean _allowDSQL,
                                          boolean _allowVarSubstitution)
                                   throws ParseException
this is used only when parsing xml for with file

Throws:
ParseException

AnyXMLContent

public final void AnyXMLContent()
                         throws ParseException
Throws:
ParseException

AnyXMLElement

public final void AnyXMLElement()
                         throws ParseException
Throws:
ParseException

ElementAnyContent

public final void ElementAnyContent(java.lang.String parentName)
                             throws ParseException
Throws:
ParseException

SQLQuoteString

public final void SQLQuoteString()
                          throws ParseException
Throws:
ParseException

XMLText

public final boolean XMLText(boolean quote)
                      throws ParseException
Produce one XMLText for a sequence of text tokens

Throws:
ParseException

TextOrphan

public final void TextOrphan(java.lang.StringBuffer buf)
                      throws ParseException
These tokens were not preceded by an expression or a variable evaluate then as text

Throws:
ParseException

XMLEntity

public final void XMLEntity()
                     throws ParseException
Throws:
ParseException

XMLAttribute

public final void XMLAttribute(ASTXMLElement node)
                        throws ParseException
Parameters:
node - the node currently being constructed
Throws:
ParseException

XMLAttributeDynamic

public final ASTDynamicString XMLAttributeDynamic()
                                           throws ParseException
XML attribute string

Throws:
ParseException

StatementOrExpression

public final void StatementOrExpression()
                                 throws ParseException
Throws:
ParseException

Statement

public final void Statement()
                     throws ParseException
Throws:
ParseException

Expression

public final void Expression()
                      throws ParseException
Throws:
ParseException

SimpleExpression

public final void SimpleExpression()
                            throws ParseException
Throws:
ParseException

BinaryOpList

public final void BinaryOpList()
                        throws ParseException
It would be a bit complex to have priorities built-in the parser, so instead we take a simpler approach: first build a flat list, and then build the operators one by one by order of priority

Throws:
ParseException

BracketExpression

public final void BracketExpression()
                             throws ParseException
Throws:
ParseException

Bracket2Expressions

public final void Bracket2Expressions()
                               throws ParseException
Throws:
ParseException

Bracket3Expressions

public final void Bracket3Expressions()
                               throws ParseException
Throws:
ParseException

BracketNExpressions

public final void BracketNExpressions()
                               throws ParseException
Throws:
ParseException

ListInit

public final void ListInit()
                    throws ParseException
Throws:
ParseException

NewObject

public final void NewObject()
                     throws ParseException
Throws:
ParseException

ObjectOrSubName

public final java.lang.String ObjectOrSubName()
                                       throws ParseException
Throws:
ParseException

SubDef

public final void SubDef()
                  throws ParseException
Throws:
ParseException

SubCall

public final void SubCall()
                   throws ParseException
Throws:
ParseException

Insert

public final void Insert()
                  throws ParseException
Throws:
ParseException

Update

public final void Update()
                  throws ParseException
Throws:
ParseException

Delete

public final void Delete()
                  throws ParseException
Throws:
ParseException

Return

public final void Return()
                  throws ParseException
Throws:
ParseException

BooleanOp

public final void BooleanOp()
                     throws ParseException
NotOp is separate because it is unary!

Throws:
ParseException

InOp

public final void InOp()
                throws ParseException
Throws:
ParseException

AndOp

public final void AndOp()
                 throws ParseException
Throws:
ParseException

OrOp

public final void OrOp()
                throws ParseException
Throws:
ParseException

ComparisonOp

public final void ComparisonOp()
                        throws ParseException
Throws:
ParseException

MathOp

public final void MathOp()
                  throws ParseException
Throws:
ParseException

MinusOp

public final void MinusOp()
                   throws ParseException
Throws:
ParseException

MultOp

public final void MultOp()
                  throws ParseException
Throws:
ParseException

FloatDivOp

public final void FloatDivOp()
                      throws ParseException
Throws:
ParseException

Range

public final void Range()
                 throws ParseException
Throws:
ParseException

SetOp

public final void SetOp()
                 throws ParseException
Throws:
ParseException

DiffOp

public final void DiffOp()
                  throws ParseException
Throws:
ParseException

Union

public final void Union()
                 throws ParseException
Throws:
ParseException

Inter

public final void Inter()
                 throws ParseException
Throws:
ParseException

SetMinus

public final void SetMinus()
                    throws ParseException
Throws:
ParseException

Equals

public final void Equals()
                  throws ParseException
Throws:
ParseException

LtOp

public final void LtOp()
                throws ParseException
Throws:
ParseException

LteOp

public final void LteOp()
                 throws ParseException
Throws:
ParseException

GtOp

public final void GtOp()
                throws ParseException
Throws:
ParseException

GteOp

public final void GteOp()
                 throws ParseException
Throws:
ParseException

NotEquals

public final void NotEquals()
                     throws ParseException
Throws:
ParseException

PlusOp

public final void PlusOp()
                  throws ParseException
Throws:
ParseException

Concat

public final void Concat()
                  throws ParseException
Throws:
ParseException

PostExpression

public final void PostExpression()
                          throws ParseException
Throws:
ParseException

PostSelectExpression

public final void PostSelectExpression()
                                throws ParseException
Throws:
ParseException

NotOp

public final void NotOp()
                 throws ParseException
Throws:
ParseException

ArrayIndex

public final void ArrayIndex()
                      throws ParseException
Throws:
ParseException

ArrayIndexInt

public final void ArrayIndexInt()
                         throws ParseException
Throws:
ParseException

ArrayIndexVar

public final void ArrayIndexVar()
                         throws ParseException
Throws:
ParseException

MethodCall

public final void MethodCall()
                      throws ParseException
Throws:
ParseException

DotExpression

public final void DotExpression()
                         throws ParseException
Throws:
ParseException

DotAt

public final void DotAt()
                 throws ParseException
Throws:
ParseException

DotColumn

public final void DotColumn()
                     throws ParseException
Throws:
ParseException

If

public final void If()
              throws ParseException
Throws:
ParseException

NumberLiteral

public final void NumberLiteral()
                         throws ParseException
Throws:
ParseException

IntLiteral

public final ASTNumberLit IntLiteral()
                              throws ParseException
Throws:
ParseException

FloatLiteral

public final ASTNumberLit FloatLiteral()
                                throws ParseException
Throws:
ParseException

ForEach

public final void ForEach()
                   throws ParseException
Throws:
ParseException

While

public final void While()
                 throws ParseException
Throws:
ParseException

Assignment

public final void Assignment()
                      throws ParseException
Throws:
ParseException

Variable

public final void Variable()
                    throws ParseException
Throws:
ParseException

Print

public final void Print()
                 throws ParseException
Throws:
ParseException

Exit

public final void Exit()
                throws ParseException
Throws:
ParseException

SendEmail

public final void SendEmail()
                     throws ParseException
Throws:
ParseException

Meta

public final void Meta()
                throws ParseException
Throws:
ParseException

Count

public final void Count()
                 throws ParseException
Throws:
ParseException

Exists

public final void Exists()
                  throws ParseException
Throws:
ParseException

Length

public final void Length()
                  throws ParseException
Throws:
ParseException

Sysdate

public final void Sysdate()
                   throws ParseException
Throws:
ParseException

Left

public final void Left()
                throws ParseException
Throws:
ParseException

Right

public final void Right()
                 throws ParseException
Throws:
ParseException

Substring

public final void Substring()
                     throws ParseException
Throws:
ParseException

String

public final void String()
                  throws ParseException
Throws:
ParseException

StaticString

public final void StaticString()
                        throws ParseException
Throws:
ParseException

StringInDynamicString

public final ASTStaticString StringInDynamicString()
                                            throws ParseException
A static string inside a dynamic string, i.e. "..." in DSQL or XML attribute

Throws:
ParseException

DynamicString

public final void DynamicString()
                         throws ParseException
For example, "haha$x"

Throws:
ParseException

DynamicStringContents

public final ASTDynamicString DynamicStringContents()
                                             throws ParseException
Throws:
ParseException

VariableInString

public final void VariableInString()
                            throws ParseException
Throws:
ParseException

ReInit

public void ReInit(java.io.InputStream stream)

ReInit

public void ReInit(java.io.Reader stream)

ReInit

public void ReInit(ParserTokenManager tm)

getNextToken

public final Token getNextToken()

getToken

public final Token getToken(int index)

generateParseException

public ParseException generateParseException()

enable_tracing

public final void enable_tracing()

disable_tracing

public final void disable_tracing()