Java Doc for Parser.java in  » Template-Engine » Velocity » org » apache » velocity » runtime » parser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Template Engine » Velocity » org.apache.velocity.runtime.parser 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.velocity.runtime.parser.Parser

Parser
public class Parser implements ParserTreeConstants,ParserConstants(Code)
This class is responsible for parsing a Velocity template. This class was generated by JavaCC using the JJTree extension to produce an Abstract Syntax Tree (AST) of the template. Please look at the Parser.jjt file which is what controls the generation of this class.
author:
   Jason van Zyl
author:
   Geir Magnusson Jr.
author:
   Henning P. Schmiedehausen
version:
   $Id: Parser.java 463419 2006-10-12 20:39:49Z henning $

Inner Class :final static class JJCalls

Field Summary
 StringcurrentTemplateName
     Name of current template we are parsing.
protected  JJTParserStatejjtree
    
public  booleanlookingAhead
    
public  ParserTokenManagertoken_source
    
public  Tokentokenjj_nt
    
 VelocityCharStreamvelcharstream
    

Constructor Summary
public  Parser(RuntimeServices rs)
     This constructor was added to allow the re-use of parsers. The normal constructor takes a single argument which an InputStream.
public  Parser(CharStream stream)
    
public  Parser(ParserTokenManager tm)
    

Method Summary
final public  voidAdditiveExpression()
    
final public  voidAssignment()
    
final public  voidComment()
    
final public  voidConditionalAndExpression()
    
final public  voidConditionalOrExpression()
    
final public  SimpleNodeDirective()
    
final public  intDirectiveArg()
    
final public  voidElseIfStatement()
    
final public  voidElseStatement()
    
final public  voidEqualityExpression()
    
final public  voidEscape()
     Used to catch and process escape sequences in grammatical constructs as escapes outside of VTL are just characters.
final public  voidEscapedDirective()
     used to separate the notion of a valid directive that has been escaped, versus something that looks like a directive and is just schmoo.
final public  voidExpression()
    
final public  voidFalse()
    
final public  voidFloatingPointLiteral()
    
final public  voidIdentifier()
     This method corresponds to variable references in Velocity templates.
final public  voidIfStatement()
    
final public  voidIntegerLiteral()
    
final public  voidIntegerRange()
    
final public  voidMap()
    
final public  voidMethod()
    
final public  voidMultiplicativeExpression()
    
final public  voidObjectArray()
    
final public  voidParameter()
    
final public  voidPrimaryExpression()
    
public  voidReInit(CharStream stream)
    
public  voidReInit(ParserTokenManager tm)
    
final public  voidReference()
    
final public  voidRelationalExpression()
    
final public  voidSetDirective()
    
final public  voidStatement()
     These are the types of statements that are acceptable in Velocity templates.
final public  voidStopStatement()
     This method corresponds to the #stop directive which just simulates and EOF so that parsing stops.
final public  voidStringLiteral()
    
final public  voidText()
     This method is responsible for allowing all non-grammar text to pass through unscathed.
final public  voidTrue()
    
final public  voidUnaryExpression()
    
final public  voidWord()
    
final public  voiddisable_tracing()
    
final public  voidenable_tracing()
    
public  ParseExceptiongenerateParseException()
    
public  DirectivegetDirective(String directive)
    
final public  TokengetNextToken()
    
final public  TokengetToken(int index)
    
public  booleanisDirective(String directive)
     This method finds out of the directive exists in the directives Hashtable.
public  SimpleNodeparse(Reader reader, String templateName)
     This was also added to allow parsers to be re-usable.
final public  SimpleNodeprocess()
     This method is what starts the whole parsing process.
public  voidsetDirectives(Hashtable directives)
    

Field Detail
currentTemplateName
String currentTemplateName(Code)
Name of current template we are parsing. Passed to us in parse()



jjtree
protected JJTParserState jjtree(Code)



lookingAhead
public boolean lookingAhead(Code)



token_source
public ParserTokenManager token_source(Code)



tokenjj_nt
public Token tokenjj_nt(Code)



velcharstream
VelocityCharStream velcharstream(Code)




Constructor Detail
Parser
public Parser(RuntimeServices rs)(Code)
This constructor was added to allow the re-use of parsers. The normal constructor takes a single argument which an InputStream. This simply creates a re-usable parser object, we satisfy the requirement of an InputStream by using a newline character as an input stream.



Parser
public Parser(CharStream stream)(Code)



Parser
public Parser(ParserTokenManager tm)(Code)




Method Detail
AdditiveExpression
final public void AdditiveExpression() throws ParseException(Code)



Assignment
final public void Assignment() throws ParseException(Code)



Comment
final public void Comment() throws ParseException(Code)



ConditionalAndExpression
final public void ConditionalAndExpression() throws ParseException(Code)



ConditionalOrExpression
final public void ConditionalOrExpression() throws ParseException(Code)



Directive
final public SimpleNode Directive() throws ParseException(Code)
Supports the Pluggable Directives #foo( arg+ )



DirectiveArg
final public int DirectiveArg() throws ParseException(Code)
Supports the arguments for the Pluggable Directives



ElseIfStatement
final public void ElseIfStatement() throws ParseException(Code)



ElseStatement
final public void ElseStatement() throws ParseException(Code)



EqualityExpression
final public void EqualityExpression() throws ParseException(Code)



Escape
final public void Escape() throws ParseException(Code)
Used to catch and process escape sequences in grammatical constructs as escapes outside of VTL are just characters. Right now we have both this and the EscapeDirective() construction because in the EscapeDirective() case, we want to suck in the # and here we don't. We just want the escapes to render correctly



EscapedDirective
final public void EscapedDirective() throws ParseException(Code)
used to separate the notion of a valid directive that has been escaped, versus something that looks like a directive and is just schmoo. This is important to do as a separate production that creates a node, because we want this, in either case, to stop the further parsing of the Directive() tree.



Expression
final public void Expression() throws ParseException(Code)



False
final public void False() throws ParseException(Code)



FloatingPointLiteral
final public void FloatingPointLiteral() throws ParseException(Code)



Identifier
final public void Identifier() throws ParseException(Code)
This method corresponds to variable references in Velocity templates. The following are examples of variable references that may be found in a template: $foo $bar



IfStatement
final public void IfStatement() throws ParseException(Code)



IntegerLiteral
final public void IntegerLiteral() throws ParseException(Code)



IntegerRange
final public void IntegerRange() throws ParseException(Code)
supports the [n..m] vector generator for use in the #foreach() to generate measured ranges w/o needing explicit support from the app/servlet



Map
final public void Map() throws ParseException(Code)
for creating a map in a #set #set($foo = {$foo : $bar, $blargh : $thingy})



Method
final public void Method() throws ParseException(Code)
This method has yet to be fully implemented but will allow arbitrarily nested method calls



MultiplicativeExpression
final public void MultiplicativeExpression() throws ParseException(Code)



ObjectArray
final public void ObjectArray() throws ParseException(Code)



Parameter
final public void Parameter() throws ParseException(Code)
This method has yet to be fully implemented but will allow arbitrarily nested method calls



PrimaryExpression
final public void PrimaryExpression() throws ParseException(Code)



ReInit
public void ReInit(CharStream stream)(Code)



ReInit
public void ReInit(ParserTokenManager tm)(Code)



Reference
final public void Reference() throws ParseException(Code)



RelationalExpression
final public void RelationalExpression() throws ParseException(Code)



SetDirective
final public void SetDirective() throws ParseException(Code)
Currently support both types of set : #set( expr ) #set expr



Statement
final public void Statement() throws ParseException(Code)
These are the types of statements that are acceptable in Velocity templates.



StopStatement
final public void StopStatement() throws ParseException(Code)
This method corresponds to the #stop directive which just simulates and EOF so that parsing stops. The #stop directive is useful for end-user debugging purposes.



StringLiteral
final public void StringLiteral() throws ParseException(Code)



Text
final public void Text() throws ParseException(Code)
This method is responsible for allowing all non-grammar text to pass through unscathed.



True
final public void True() throws ParseException(Code)



UnaryExpression
final public void UnaryExpression() throws ParseException(Code)



Word
final public void Word() throws ParseException(Code)



disable_tracing
final public void disable_tracing()(Code)



enable_tracing
final public void enable_tracing()(Code)



generateParseException
public ParseException generateParseException()(Code)



getDirective
public Directive getDirective(String directive)(Code)
This method gets a Directive from the directives Hashtable



getNextToken
final public Token getNextToken()(Code)



getToken
final public Token getToken(int index)(Code)



isDirective
public boolean isDirective(String directive)(Code)
This method finds out of the directive exists in the directives Hashtable.



parse
public SimpleNode parse(Reader reader, String templateName) throws ParseException(Code)
This was also added to allow parsers to be re-usable. Normal JavaCC use entails passing an input stream to the constructor and the parsing process is carried out once. We want to be able to re-use parsers: we do this by adding this method and re-initializing the lexer with the new stream that we want parsed.



process
final public SimpleNode process() throws ParseException(Code)
This method is what starts the whole parsing process. After the parsing is complete and the template has been turned into an AST, this method returns the root of AST which can subsequently be traversed by a visitor which implements the ParserVisitor interface which is generated automatically by JavaCC



setDirectives
public void setDirectives(Hashtable directives)(Code)
This method sets the directives Hashtable



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.