Velocity - Velocity Specification - BNF

About Overview Getting Started Download Install Design Contributors ChangeLog Coding Standards License TODO Report Issues Community Powered By Velocity Get Involved Mailing Lists CVS Repositories Docs User's Guide (English) User's Guide (Finnish) User's Guide (French) User's Guide (Spanish) Developer's Guide VTL Reference Guide Specification Javadoc Tools Velocity Tools Anakia : XML->doc tool Texen : text generation DVSL : XML xformation Veltag : JSP taglib Migration to Velocity Editors and IDEs Comparisons YMTD VM/WM Differences JSP vs. Velocity XMLC vs. Velocity Site Translations English Japanese |
Velocity Specification - BNF
> Please note that this is currently out of date and will be updated soon.
>     This is a tentative BNF for Velocity, right now this is
>     pretty much the WM syntax. This might change, as arithmetic
>     might not make it into the syntax, and the future
>     velocity syntax will more then likely remove block
>     markers and instead use an "#end" token to signify
>     the end of a directive.

>     <statement>

>         ::=   <text>
>             | <block>
>             | <if-statement>
>             | <else-if-statement>
>             | <foreach-statement>
>             | <include-statement>
>             | <set-statement>
>             | <parse-statement>
>             | <param-statment>
>             | <stop-statement>
>             | <reference>

>     <block>

>         ::= "#begin" { <expresion> } "#end"

>     <if-statement>

>         ::= "#if" "(" <expresion> ")" <statement> [ <else-statement> ]

>     <else-if-statement>

>         ::= "#elseif" "(" <expresion> ")" <statement> [ <else-statement> ]

>     <foreach-statement>

>         ::= "#foreach" <reference> "in" <reference> <statement>

>     <include-statement>

>         ::= "#include" <string-literal>

>     <set-statement>

>         ::= "#set" <reference> "=" <expression>

>     <parse-statement>

>         ::= "#parse" <string-literal>

>     <param-statment>

>         ::= "#param" <reference> "=" <string-literal>

>     <stop-statement>

>         ::= "#stop"

>     <reference>

>         ::= "$" <identifier> { "." <method> | <identifier> }

>     <method>

>         ::= <identifier> "(" [ <parameter> { "," <parameter> } ] ")"

>     <parameter>

>         ::= <reference> | <string-literal>

>     <alpha-char>

>         ::= "a..z, A..Z"

>     <identifier-char>

>         ::= "a..z, A..Z ,0..9 ,- ,_"

>     <identifier>

>         ::= <alpha-char> { <identifier-char> }

>     <expression>

>         ::=   <true>
>             | <false>
>             | <primary-expression> "=" <assignment>
>             | <conditional-or-expression>

>     <assignment>

>         ::= <primary-expression> "=" <assignment>

>     <conditional-or-expression>

>         ::= <conditional-and-expression> { "||" <conditional-and-expression> }

>     <conditional-and-expression>

>         ::= <equality-expression> { "&&" <equality-expression> }

>     <equality-expression>

>         ::= <relational-expression>
>             {     "==" <relational-expression>
>                 | "!=" <relational-expression>
>             }

>     <relational-expression>

>         ::= <additive-expression>
>             {
>                   "<"  <additive-expression>
>                 | ">"  <additive-expression>
>                 | "<=" <additive-expression>
>                 | ">=" <additive-expression>
>             }

>     <additive-expression>

>         ::= <multiplicative-expression>
>             {
>                   "+" <multiplicative-expression>
>                 | "-" <multiplicative-expression>
>             }

>     <multiplicative-expression>

>         ::= <unary-expression>
>             {
>                   "*" <unary-expression>
>                 | "/" <unary-expression>
>                 | "%" <unary-expression>
>             }

>     <unary-expression>

>         ::= "!" <unary-expression> | <primary-expression>

>     <primary-expression>

>         ::=   <string-literal>
>             | <number-literal>
>             | <reference>
>             | "(" <expression> ")"
Copyright © 1999-2004, The Apache Software Foundation