anvil.script.parser
Class TemplateParser

java.lang.Object
  |
  +--anvil.script.statements.Statement
        |
        +--anvil.script.parser.TemplateParser
All Implemented Interfaces:
DocumentHandler, ErrorListener, ParserInterface

public class TemplateParser
extends Statement
implements DocumentHandler, ParserInterface

class TemplateParser


Field Summary
 
Fields inherited from class anvil.script.statements.Statement
CONTENT_COMPRESS, CONTENT_PACK, CONTENT_PRESERVE, CONTENT_PROCESSING, CONTENT_SILENT, DEFAULT_NAMESPACE, EMPTY, ST_ASSERT, ST_BLOCK, ST_BREAK, ST_CALL, ST_CASE, ST_CATCH, ST_CDATA, ST_CLASS, ST_COMPRESS, ST_CONST, ST_CONTINUE, ST_CUSTOM_TAG, ST_DEFAULT, ST_DO, ST_DOCUMENT, ST_ELSE, ST_ELSEIF, ST_ENDCASE, ST_ENDCLASS, ST_ENDCONST, ST_ENDDEFAULT, ST_ENDEVAL, ST_ENDFOR, ST_ENDFOREACH, ST_ENDFUNCTION, ST_ENDIF, ST_ENDINNER, ST_ENDMODULE, ST_ENDNAMESPACE, ST_ENDOUTER, ST_ENDREPLACE, ST_ENDSWITCH, ST_ENDVAR, ST_ENDWHILE, ST_EVAL, ST_EXIT, ST_FINALLY, ST_FOR, ST_FOREACH, ST_FUNCTION, ST_IF, ST_IMPLICIT_BLOCK, ST_IMPORT, ST_INNER, ST_INTERFACE, ST_INVALID, ST_INVOKE, ST_MODULE, ST_NAMESPACE, ST_NONE, ST_OUTER, ST_PACK, ST_PRESERVE, ST_PRINT, ST_REPLACE, ST_RETURN, ST_SILENT, ST_SWITCH, ST_SYNCHRONIZED, ST_TAG, ST_THROW, ST_TRY, ST_VAR, ST_WHILE, ST_YIELD
 
Constructor Summary
TemplateParser(ModuleEnvelope envelope, java.lang.String namespace, java.net.URL url, LocatingCharSequence sequence)
           
 
Method Summary
 void endDocument()
           
 void error(Location location, java.lang.String message)
           
 void error(Location location, java.lang.Throwable throwable)
           
 int errors()
           
 Statement getCurrentStatement()
           
 java.lang.String getDocument()
           
 ModuleEnvelope getEnvelope()
           
 java.util.Iterator getEvents()
           
 Location getLocation()
           
 Location getLocation(Attribute attr)
           
 SourceFile getSourceFile()
           
 void handleCharacters(java.lang.String characters)
           
 void handleComment(java.lang.String characters)
           
 void handleProcessingInstruction(java.lang.String data)
           
 void handleTag(Tag tag)
           
 boolean hasEnd()
           
 void merge(ErrorListener listener)
           
 java.lang.String name()
           
 void onCharacters(TemplateParser handler, java.lang.String cdata)
           
 boolean onProcessingInstruction(TemplateParser parser, java.lang.String data)
           
 boolean onTag(TemplateParser handler, int type, Tag tag)
           
 ModuleStatement parseTemplate()
           
 Statement peek()
           
 void pop()
           
 void push(Statement stmt)
           
 void setDocumentLocator(Locator locator)
           
 void startDocument()
           
 Location toLocation(int line, int column)
           
 int typeOf()
           
 void unexpectedElement(java.lang.String name)
           
 
Methods inherited from class anvil.script.statements.Statement
addChild, allowBreak, allowContinue, allowLabel, allowYield, callFinalizer, check, compile, compress, eliminate, getBlockStatement, getCatchStatement, getChildStatement, getClassStatement, getContentState, getDefinitionStatement, getFunctionStatement, getInterfaceStatement, getLabelDepth, getLabeled, getModuleStatement, getParentStatement, getScopeStatement, getStaticContent, getSwitch, getTag, getTagId, getTypeRef, hasStaticContent, importExternals, isBlocked, isDeclared, isStaticRegion, lookupAnyDeclaration, pack, parse, parseLabel, setChildStatement, setLocation, setParentStatement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TemplateParser

public TemplateParser(ModuleEnvelope envelope,
                      java.lang.String namespace,
                      java.net.URL url,
                      LocatingCharSequence sequence)
Method Detail

getSourceFile

public SourceFile getSourceFile()
Specified by:
getSourceFile in interface ParserInterface

name

public java.lang.String name()
Overrides:
name in class Statement

typeOf

public int typeOf()
Overrides:
typeOf in class Statement

hasEnd

public boolean hasEnd()
Overrides:
hasEnd in class Statement

getEnvelope

public ModuleEnvelope getEnvelope()
Specified by:
getEnvelope in interface ParserInterface

toLocation

public Location toLocation(int line,
                           int column)
Specified by:
toLocation in interface ParserInterface

getLocation

public Location getLocation()
Overrides:
getLocation in class Statement

getLocation

public Location getLocation(Attribute attr)

getDocument

public java.lang.String getDocument()

setDocumentLocator

public void setDocumentLocator(Locator locator)
Specified by:
setDocumentLocator in interface DocumentHandler

pop

public void pop()

push

public void push(Statement stmt)

peek

public Statement peek()

getCurrentStatement

public Statement getCurrentStatement()
Specified by:
getCurrentStatement in interface ParserInterface

startDocument

public void startDocument()
Specified by:
startDocument in interface DocumentHandler

endDocument

public void endDocument()
Specified by:
endDocument in interface DocumentHandler

handleCharacters

public void handleCharacters(java.lang.String characters)
Specified by:
handleCharacters in interface DocumentHandler

handleComment

public void handleComment(java.lang.String characters)
Specified by:
handleComment in interface DocumentHandler

handleTag

public void handleTag(Tag tag)
Specified by:
handleTag in interface DocumentHandler

handleProcessingInstruction

public void handleProcessingInstruction(java.lang.String data)
Specified by:
handleProcessingInstruction in interface DocumentHandler

onCharacters

public void onCharacters(TemplateParser handler,
                         java.lang.String cdata)
Overrides:
onCharacters in class Statement

onTag

public boolean onTag(TemplateParser handler,
                     int type,
                     Tag tag)
Overrides:
onTag in class Statement

onProcessingInstruction

public boolean onProcessingInstruction(TemplateParser parser,
                                       java.lang.String data)
Overrides:
onProcessingInstruction in class Statement

unexpectedElement

public void unexpectedElement(java.lang.String name)

error

public void error(Location location,
                  java.lang.Throwable throwable)
Specified by:
error in interface ErrorListener

error

public void error(Location location,
                  java.lang.String message)
Specified by:
error in interface ErrorListener

errors

public int errors()
Specified by:
errors in interface ErrorListener

getEvents

public java.util.Iterator getEvents()
Specified by:
getEvents in interface ErrorListener

merge

public void merge(ErrorListener listener)
Specified by:
merge in interface ErrorListener

parseTemplate

public ModuleStatement parseTemplate()
                              throws java.io.IOException,
                                     ForgingException
java.io.IOException
ForgingException