C# Класс NVelocity.Runtime.Parser.Parser

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.
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
lookingAhead bool
token Token
token_source ParserTokenManager

Защищенные свойства (Protected)

Свойство Тип Описание
directiveStack Stack

Открытые методы

Метод Описание
AdditiveExpression ( ) : void
Assignment ( ) : void
Comment ( ) : void
ConditionalAndExpression ( ) : void
ConditionalOrExpression ( ) : void
Directive ( ) : NVelocity.Runtime.Parser.Node.SimpleNode

Supports the Pluggable Directives #foo( arg+ )

DirectiveArg ( ) : void

Supports the arguments for the Pluggable Directives We add whitespace in here as a token so the VMs can easily reconstruct a macro body from the token stream See Directive()

ElseIfStatement ( ) : void
ElseStatement ( ) : void
EqualityExpression ( ) : void
Escape ( ) : void

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 #<directive> and here we don't. We just want the escapes to render correctly

EscapedDirective ( ) : void

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 ( ) : void
False ( ) : void
GenerateParseException ( ) : ParseException
GetToken ( int index ) : Token
Identifier ( ) : void

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 ( ) : void
IntegerRange ( ) : void

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

IsDirective ( String directive ) : bool

This method finds out of the directive exists in the directives Hashtable.

Method ( ) : void

This method has yet to be fully implemented but will allow arbitrarily nested method calls

MultiplicativeExpression ( ) : void
NumberLiteral ( ) : void
ObjectArray ( ) : void
Parameter ( ) : void

This method has yet to be fully implemented but will allow arbitrarily nested method calls

Parse ( TextReader reader, String templateName ) : NVelocity.Runtime.Parser.Node.SimpleNode

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.

Parser ( ICharStream stream ) : System
Parser ( IRuntimeServices rs ) : System

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 ( ParserTokenManager tm ) : System
PrimaryExpression ( ) : void
Process ( ) : NVelocity.Runtime.Parser.Node.SimpleNode

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

ReInit ( ICharStream stream ) : void
ReInit ( ParserTokenManager tm ) : void
Reference ( ) : void
RelationalExpression ( ) : void
SetDirective ( ) : void

Currently support both types of set : #set( expr ) #set expr

Statement ( ) : void

These are the types of statements that are acceptable in Velocity templates.

StopStatement ( ) : void

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 ( ) : void
Text ( ) : void

This method is responsible for allowing all non-grammar text to pass through unscathed.

True ( ) : void
UnaryExpression ( ) : void
Word ( ) : void

Приватные методы

Метод Описание
AddErrorToken ( int kind, int position ) : void
ConsumeToken ( int kind ) : Token
ConsumeWhiteSpaces ( ) : void
EscapedDirective ( String strImage ) : String

Produces a processed output for an escaped control or pluggable directive

GetCurrentTokenKind ( ) : int
InitBlock ( ) : void
RescanToken ( ) : void
Save ( int index, int xla ) : void
ScanToken ( int kind ) : bool
ToRefactor1 ( ) : bool
jj_2_1 ( int xla ) : bool
jj_2_10 ( int xla ) : bool
jj_2_11 ( int xla ) : bool
jj_2_12 ( int xla ) : bool
jj_2_2 ( int xla ) : bool
jj_2_3 ( int xla ) : bool
jj_2_4 ( int xla ) : bool
jj_2_5 ( int xla ) : bool
jj_2_6 ( int xla ) : bool
jj_2_7 ( int xla ) : bool
jj_2_8 ( int xla ) : bool
jj_2_9 ( int xla ) : bool
jj_3R_100 ( int ge, bool r_91 ) : bool
jj_3R_101 ( ) : bool
jj_3R_19 ( ) : bool
jj_3R_29 ( ) : bool
jj_3R_31 ( ) : bool
jj_3R_33 ( ) : bool
jj_3R_38 ( ) : bool
jj_3R_39 ( ) : bool
jj_3R_40 ( ) : bool
jj_3R_41 ( ) : bool
jj_3R_42 ( ) : bool
jj_3R_50 ( bool b ) : bool
jj_3R_51 ( ) : bool
jj_3R_52 ( ) : bool
jj_3R_54 ( ) : bool
jj_3R_55 ( ) : bool
jj_3R_56 ( ) : bool
jj_3R_57 ( ) : bool
jj_3R_58 ( ) : bool
jj_3R_59 ( ) : bool
jj_3R_60 ( ) : bool
jj_3R_77 ( ) : bool
jj_3R_81 ( ) : bool
jj_3R_82 ( ) : bool
jj_3R_84 ( ) : bool
jj_3R_86 ( ) : bool
jj_3R_89 ( ) : bool
jj_3R_90 ( ) : bool
jj_3R_91 ( ) : bool
jj_3R_92 ( ) : bool
jj_3R_95 ( ) : bool
jj_3R_96 ( ) : bool
jj_3_10 ( ) : bool
jj_3_11 ( ) : bool
jj_3_12 ( ) : bool
jj_3_2 ( ) : bool
jj_3_3 ( ) : bool
jj_3_4 ( ) : bool
jj_3_7 ( ) : bool
jj_ntk ( ) : int

Описание методов

AdditiveExpression() публичный Метод

public AdditiveExpression ( ) : void
Результат void

Assignment() публичный Метод

public Assignment ( ) : void
Результат void

Comment() публичный Метод

public Comment ( ) : void
Результат void

ConditionalAndExpression() публичный Метод

public ConditionalAndExpression ( ) : void
Результат void

ConditionalOrExpression() публичный Метод

public ConditionalOrExpression ( ) : void
Результат void

Directive() публичный Метод

Supports the Pluggable Directives #foo( arg+ )
public Directive ( ) : NVelocity.Runtime.Parser.Node.SimpleNode
Результат NVelocity.Runtime.Parser.Node.SimpleNode

DirectiveArg() публичный Метод

Supports the arguments for the Pluggable Directives We add whitespace in here as a token so the VMs can easily reconstruct a macro body from the token stream See Directive()
public DirectiveArg ( ) : void
Результат void

ElseIfStatement() публичный Метод

public ElseIfStatement ( ) : void
Результат void

ElseStatement() публичный Метод

public ElseStatement ( ) : void
Результат void

EqualityExpression() публичный Метод

public EqualityExpression ( ) : void
Результат void

Escape() публичный Метод

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 #<directive> and here we don't. We just want the escapes to render correctly
public Escape ( ) : void
Результат void

EscapedDirective() публичный Метод

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.
public EscapedDirective ( ) : void
Результат void

Expression() публичный Метод

public Expression ( ) : void
Результат void

False() публичный Метод

public False ( ) : void
Результат void

GenerateParseException() публичный Метод

public GenerateParseException ( ) : ParseException
Результат ParseException

GetToken() публичный Метод

public GetToken ( int index ) : Token
index int
Результат Token

Identifier() публичный Метод

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 *
public Identifier ( ) : void
Результат void

IfStatement() публичный Метод

public IfStatement ( ) : void
Результат void

IntegerRange() публичный Метод

supports the [n..m] vector generator for use in the #foreach() to generate measured ranges w/o needing explicit support from the app/servlet
public IntegerRange ( ) : void
Результат void

IsDirective() публичный Метод

This method finds out of the directive exists in the directives Hashtable.
public IsDirective ( String directive ) : bool
directive String
Результат bool

Method() публичный Метод

This method has yet to be fully implemented but will allow arbitrarily nested method calls
public Method ( ) : void
Результат void

MultiplicativeExpression() публичный Метод

public MultiplicativeExpression ( ) : void
Результат void

NumberLiteral() публичный Метод

public NumberLiteral ( ) : void
Результат void

ObjectArray() публичный Метод

public ObjectArray ( ) : void
Результат void

Parameter() публичный Метод

This method has yet to be fully implemented but will allow arbitrarily nested method calls
public Parameter ( ) : void
Результат void

Parse() публичный Метод

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.
public Parse ( TextReader reader, String templateName ) : NVelocity.Runtime.Parser.Node.SimpleNode
reader System.IO.TextReader
templateName String
Результат NVelocity.Runtime.Parser.Node.SimpleNode

Parser() публичный Метод

public Parser ( ICharStream stream ) : System
stream ICharStream
Результат System

Parser() публичный Метод

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.
public Parser ( IRuntimeServices rs ) : System
rs IRuntimeServices
Результат System

Parser() публичный Метод

public Parser ( ParserTokenManager tm ) : System
tm ParserTokenManager
Результат System

PrimaryExpression() публичный Метод

public PrimaryExpression ( ) : void
Результат void

Process() публичный Метод

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
public Process ( ) : NVelocity.Runtime.Parser.Node.SimpleNode
Результат NVelocity.Runtime.Parser.Node.SimpleNode

ReInit() публичный Метод

public ReInit ( ICharStream stream ) : void
stream ICharStream
Результат void

ReInit() публичный Метод

public ReInit ( ParserTokenManager tm ) : void
tm ParserTokenManager
Результат void

Reference() публичный Метод

public Reference ( ) : void
Результат void

RelationalExpression() публичный Метод

public RelationalExpression ( ) : void
Результат void

SetDirective() публичный Метод

Currently support both types of set : #set( expr ) #set expr
public SetDirective ( ) : void
Результат void

Statement() публичный Метод

These are the types of statements that are acceptable in Velocity templates.
public Statement ( ) : void
Результат void

StopStatement() публичный Метод

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.
public StopStatement ( ) : void
Результат void

StringLiteral() публичный Метод

public StringLiteral ( ) : void
Результат void

Text() публичный Метод

This method is responsible for allowing all non-grammar text to pass through unscathed.
public Text ( ) : void
Результат void

True() публичный Метод

public True ( ) : void
Результат void

UnaryExpression() публичный Метод

public UnaryExpression ( ) : void
Результат void

Word() публичный Метод

public Word ( ) : void
Результат void

Описание свойств

directiveStack защищенное свойство

protected Stack directiveStack
Результат Stack

lookingAhead публичное свойство

public bool lookingAhead
Результат bool

token публичное свойство

public Token,NVelocity.Runtime.Parser token
Результат Token

token_source публичное свойство

public ParserTokenManager,NVelocity.Runtime.Parser token_source
Результат ParserTokenManager