Author: dr Date: Wed Jan 30 16:51:02 2008 New Revision: 7265 Log: - Added links in EBNF document.
Modified: trunk/Template/docs/EBNF.txt Modified: trunk/Template/docs/EBNF.txt ============================================================================== --- trunk/Template/docs/EBNF.txt [iso-8859-1] (original) +++ trunk/Template/docs/EBNF.txt [iso-8859-1] Wed Jan 30 16:51:02 2008 @@ -8,227 +8,234 @@ The template language starts with the non-terminal token: "Program". -:: - - Program ::= Code EOF - - Code ::= ( Text | Block )* - - Text ::= TextBlock - | LiteralBlock - | DelimiterBlock - - - Block ::= CommentBlock - | DeclarationBlock - | ModifyingBlock - | OutputBlock - | LiteralBlock - | CycleBlock - | LoopBlock - | CodeFlowBlock +.. parsed-literal:: + + Program ::= Code_ EOF + + _`Code` ::= ( Text_ | Block_ )* + + _`Text` ::= TextBlock_ + | LiteralBlock_ + | DelimiterBlock_ + + + _`Block` ::= CommentBlock_ + | DeclarationBlock_ + | ModifyingBlock_ + | OutputBlock_ + | LiteralBlock_ + | CycleBlock_ + | LoopBlock_ + | CodeFlowBlock_ Text blocks ----------- -:: - - TextBlock ::= ( ~'{' | '\'! '{' )* - - LiteralBlock ::= '{' 'literal' '}' Graphic* '{' '/literal' '}' - - DelimiterBlock :== '{ldelim}' | '{rdelim}' + +.. parsed-literal:: + + _`TextBlock` ::= ( ~'{' | '\'! '{' )* + + _`LiteralBlock` ::= '{' 'literal' '}' Graphic_ * '{' '/literal' '}' + + _`DelimiterBlock` :== '{ldelim}' | '{rdelim}' Blocks ------ -:: - - CommentBlock ::= '{*' Graphic* '*}' - - DeclarationBlock ::= '{' 'var' SubDefineBlock '}' - | '{' 'cycle' SubDefineBlock '}' - | '{' 'use' SubDefineBlock '}' - - SubDefineBlock ::= PrimaryVariable ( '=' Expression )? ( ',' SubDefineBlock )? - - ModifyingBlock ::= '{' SubAssignBlock (',' SubAssignBlock)* '}' - - SubAssignBlock ::= AssignmentExpr | IncrementExpr | DecrementExpr - - AssignmentExpr ::= PrimaryVariable ( '=' | CombinedAssignment) Expression - - IncrementExpr ::= ( ( '++' PrimaryVariable ) | ( PrimaryVariable '++' ) ) - - DecrementExpr ::= ( ( '--' PrimaryVariable ) | ( PrimaryVariable '--' ) ) - - OutputBlock ::= '{' Expression '}' - - CycleBlock ::= '{' 'increment' PrimaryVariable ( ',' PrimaryVariable )* '}' - | '{' 'decrement' PrimaryVariable ( ',' PrimaryVariable )* '}' - | '{' 'reset' PrimaryVariable ( ',' PrimaryVariable )* '}' + +.. parsed-literal:: + + _`CommentBlock` ::= '{\*' Graphic_ * '\*}' + + _`DeclarationBlock` ::= '{' 'var' SubDefineBlock_ '}' + | '{' 'cycle' SubDefineBlock_ '}' + | '{' 'use' SubDefineBlock_ '}' + + _`SubDefineBlock` ::= PrimaryVariable_ ( '=' Expression_ )? ( ',' SubDefineBlock_ )? + + _`ModifyingBlock` ::= '{' SubAssignBlock_ (',' SubAssignBlock_)* '}' + + _`SubAssignBlock` ::= AssignmentExpr_ | IncrementExpr_ | DecrementExpr_ + + _`AssignmentExpr` ::= PrimaryVariable_ ( '=' | CombinedAssignment_) Expression_ + + _`IncrementExpr` ::= ( ( '++' PrimaryVariable_ ) | ( PrimaryVariable '++' ) ) + + _`DecrementExpr` ::= ( ( '--' PrimaryVariable_ ) | ( PrimaryVariable '--' ) ) + + _`OutputBlock` ::= '{' Expression_ '}' + + _`CycleBlock` ::= '{' 'increment' PrimaryVariable_ ( ',' PrimaryVariable_ )* '}' + | '{' 'decrement' PrimaryVariable_ ( ',' PrimaryVariable_ )* '}' + | '{' 'reset' PrimaryVariable_ ( ',' PrimaryVariable_ )* '}' Loop control ------------ -:: - - LoopBlock ::= ForeachStatement + +.. parsed-Literal:: + + _`LoopBlock` ::= ForeachStatement | WhileStatement - ForeachStatement ::= '{' 'foreach' Expression 'as' PrimaryVariable ('=>' PrimaryVariable)? (Cycle)* (OffsetAndLimit)? '}' Code '{' '/foreach' '}' - - WhileStatement ::= '{' 'while' Expression '}' Code '{' '/while' '}' - - Cycle ::= ('increment' | 'decrement') PrimaryVariable (',' PrimaryVariable)* - - OffsetAndLimit ::= ('offset' Expression)? ('limit' Expression)? + _`ForeachStatement` ::= '{' 'foreach' Expression_ 'as' PrimaryVariable_ ('=>' PrimaryVariable_)? (Cycle_)* (OffsetAndLimit_)? '}' Code_ '{' '/foreach' '}' + + _`WhileStatement` ::= '{' 'while' Expression_ '}' Code_ '{' '/while' '}' + + _`Cycle` ::= ('increment' | 'decrement') PrimaryVariable_ (',' PrimaryVariable_)* + + _`OffsetAndLimit` ::= ('offset' Expression_)? ('limit' Expression_)? Code flow control ----------------- -:: - - CodeFlowBlock ::= IfStatement - | SwitchStatement - | IncludeStatement - | DelimiterStatement + +.. parsed-Literal:: + + _`CodeFlowBlock` ::= IfStatement_ + | SwitchStatement_ + | IncludeStatement_ + | DelimiterStatement_ | '{break}' | '{skip}' | '{continue}' - | ReturnStatement - - - IfStatement ::= '{' 'if' Expression '}' Code (ElseIf)* (Else)? '{' '/if' '}' - ElseIf ::= '{' 'elseif' Expression '}' Code - Else ::= '{' 'else' '}' Code - - SwitchStatement ::= '{' 'switch' Expression '}' (Case)* (DefaultCase)? '{' '/switch' '}' - - Case ::= '{' 'case' Literal ( ',' Literal)* '}' Code '{' '/case' '}' - - DefaultCase ::= '{' 'default' '}' Code '{' '/default' '}' + | ReturnStatement_ + + + _`IfStatement` ::= '{' 'if' Expression_ '}' Code_ (ElseIf_)* (Else_)? '{' '/if' '}' + _`ElseIf` ::= '{' 'elseif' Expression_ '}' Code_ + _`Else` ::= '{' 'else' '}' Code_ + + _`SwitchStatement` ::= '{' 'switch' Expression_ '}' (Case_)* (DefaultCase_)? '{' '/switch' '}' + + _`Case` ::= '{' 'case' Literal_ ( ',' Literal_)* '}' Code_ '{' '/case' '}' + + _`DefaultCase` ::= '{' 'default' '}' Code_ '{' '/default' '}' - IncludeStatement ::= '{' 'include' Expression ('send' ExprAsPrimVarList)? ('receive' PrimVarAsPrimVarList)? '}' - - DelimiterStatement ::= '{' 'delimiter' (modulo Expression ('is' Expression)? )? '}' Code '{' '/delimiter' '}' - - ReturnStatement ::= '{' 'return' ExprAsPrimVarList '}' - - ExprAsPrimVarList ::= ( Expression 'as' PrimaryVariable | PrimaryVariable ) (',' ExprAsPrimVarList)? - - PrimVarAsPrimVarList::= PrimaryVariable ('as' PrimaryVariable)? (',' PrimVarAsPrimVarList)? + _`IncludeStatement` ::= '{' 'include' Expression_ ('send' ExprAsPrimVarList_)? ('receive' PrimVarAsPrimVarList_)? '}' + + _`DelimiterStatement` ::= '{' 'delimiter' (modulo Expression_ ('is' Expression_)? )? '}' Code_ '{' '/delimiter' '}' + + _`ReturnStatement` ::= '{' 'return' ExprAsPrimVarList_ '}' + + _`ExprAsPrimVarList` ::= ( Expression_ 'as' PrimaryVariable_ | PrimaryVariable_ ) (',' ExprAsPrimVarList_)? + + _`PrimVarAsPrimVarList`::= PrimaryVariable_ ('as' PrimaryVariable_)? (',' PrimVarAsPrimVarList_)? Expression ---------- -:: - - Expression ::= PreUnaryExpression (BinaryOperator Expression)? - - PreUnaryExpression ::= '++' PrimaryVariable - | '--' PrimaryVariable - | UnaryExpression - | Expression 'instanceof' Identifier - | ArrayDeclaration - - ArrayDeclaration ::= 'array' '(' ( (Expression '=>')? Expression ( ',' Expression )* (',')? )? ')' - | Expression '..' Expression - - - UnaryExpression ::= ( UnaryOperator )* PostFixExpression - - PostFixExpression ::= PrimaryVariable ( '++' | '--' )? - | Literal - | FunctionCall - | '(' Expression ')' - - - PrimaryVariable ::= '$' Identifier ( '[' Expression ']' | '->' Expression )* - - FunctionCall ::= Identifier '(' (ParameterList)? ')' + +.. parsed-Literal:: + + _`Expression` ::= PreUnaryExpression_ (BinaryOperator_ Expression_)? + + _`PreUnaryExpression` ::= '++' PrimaryVariable_ + | '--' PrimaryVariable_ + | UnaryExpression_ + | Expression_ 'instanceof' Identifier_ + | ArrayDeclaration_ + + _`ArrayDeclaration` ::= 'array' '(' ( (Expression_ '=>')? Expression_ ( ',' Expression_ )* (',')? )? ')' + | Expression_ '..' Expression_ + + + _`UnaryExpression` ::= ( UnaryOperator_ )* PostFixExpression_ + + _`PostFixExpression` ::= PrimaryVariable_ ( '++' | '--' )? + | Literal_ + | FunctionCall_ + | '(' Expression_ ')' + + + _`PrimaryVariable` ::= '$' Identifier_ ( '[' Expression_ ']' | '->' Expression_ )* + + _`FunctionCall` ::= Identifier_ '(' (ParameterList_)? ')' - ParameterList ::= Expression ( ',' Expression )* - - Identifier ::= Letter ( Letter | Digit | '_' )* + _`ParameterList` ::= Expression_ ( ',' Expression_ )* + + _`Identifier` ::= Letter_ ( Letter_ | Digit_ | '_' )* Basic literals -------------- -:: - - Literal ::= NumeralLiteral - | StringLiteral - | BooleanLiteral - | NullLiteral - - NumeralLiteral ::= HexLiteral | OctLiteral | FloatLiteral - - HexLiteral ::= '0x' HexDigit+ - - OctLiteral ::= '0' OctDigit+ - - FloatLiteral ::= NonZeroDigit Digit* ( '.' Digit+ )? (('e'|'E') ('+'|'-')? Digit+)? - - StringLiteral ::= '"' Graphic* '"' - | "'" Graphic* "'" - - BooleanLiteral ::= 'true' + +.. parsed-Literal:: + + _`Literal` ::= NumeralLiteral_ + | StringLiteral_ + | BooleanLiteral_ + | NullLiteral_ + + _`NumeralLiteral` ::= HexLiteral_ | OctLiteral_ | FloatLiteral_ + + _`HexLiteral` ::= '0x' HexDigit_ + + + _`OctLiteral` ::= '0' OctDigit_ + + + _`FloatLiteral` ::= NonZeroDigit_ Digit_ * ( '.' Digit_ + )? (('e'|'E') ('+'|'-')? Digit_ + )? + + _`StringLiteral` ::= '"' Graphic_ * '"' + | "'" Graphic_ * "'" + + _`BooleanLiteral` ::= 'true' | 'false' - NullLiteral ::= 'null' + _`NullLiteral` ::= 'null' Lexicon ------- -:: - - Comment ::= '//' Graphic* ( EOL | '}' ) - | '/*' Graphic* '*/' - - Graphic ::= Digit | Letter | Blank | Operators | Assignment | CombinedAssignment | RemainingCharSet - - EOL ::= end-of-line - - EOF ::= end-of-file - - Blank ::= Tab | Space - - NewLine ::= '\n' - - Space ::= ' ' - - Tab ::= '\t' - - Letter ::= 'a' ... 'z' | 'A' ... 'Z' - - Hexdigit ::= '0' .. '9' | 'A' .. 'F' - - Octdigit ::= '0' .. '8' - - NonZeroDigit ::= '1' .. '9' - - Digit ::= '0' | NonZeroDigit - - Assignment ::= '=' - - CombinedAssignment ::= '+=' | '-=' | '*=' | '/=' | '%=' | '.=' - - Operators ::= BinaryOperator | UnaryOperator | '++' | '--' - - BinaryOperator ::= ArithmeticOperator | ComparisonOperator | BooleanOperator | StringOperator - - ArithmeticOperator ::= '+' | '-' | '*' | '/' | '%' - - ComparisonOperator ::= '==' | '===' | '!=' | '!==' | '<' | '<=' | '>' | '>=' - - BooleanOperator ::= '&&' | '||' - - StringOperator ::= '.' - - UnaryOperator ::= '+' | '-' | '!' - - RemainingCharSet ::= '.' | ':' | ';' | ',' | '~' | '(' | ')' | '[' | ']' | '{' | '}' | '_' | '|' | "'" | '"' | '`' | '#' | '$' | '@' + +.. parsed-Literal:: + + _`Comment` ::= '\/\/' Graphic_ * ( EOL_ | '}' ) + | '/\*' Graphic_ * '\*/' + + _`Graphic` ::= Digit_ | Letter_ | Blank_ | Operators_ | Assignment_ | CombinedAssignment_ | RemainingCharSet_ + + _`EOL` ::= end-of-line + + _`EOF` ::= end-of-file + + _`Blank` ::= Tab_ | Space_ + + _`NewLine` ::= '\n' + + _`Space` ::= ' ' + + _`Tab` ::= '\t' + + _`Letter` ::= 'a' ... 'z' | 'A' ... 'Z' + + _`Hexdigit` ::= '0' .. '9' | 'A' .. 'F' + + _`Octdigit` ::= '0' .. '8' + + _`NonZeroDigit` ::= '1' .. '9' + + _`Digit` ::= '0' | NonZeroDigit_ + + _`Assignment` ::= '=' + + _`CombinedAssignment` ::= '+=' | '-=' | '\*=' | '/=' | '%=' | '.=' + + _`Operators` ::= BinaryOperator_ | UnaryOperator_ | '++' | '--' + + _`BinaryOperator` ::= ArithmeticOperator_ | ComparisonOperator_ | BooleanOperator_ | StringOperator_ + + _`ArithmeticOperator` ::= '+' | '-' | '*' | '/' | '%' + + _`ComparisonOperator` ::= '==' | '===' | '!=' | '!==' | '<' | '<=' | '>' | '>=' + + _`BooleanOperator` ::= '&&' | '||' + + _`StringOperator` ::= '.' + + _`UnaryOperator` ::= '+' | '-' | '!' + + _`RemainingCharSet` ::= '.' | ':' | ';' | ',' | '~' | '(' | ')' | '[' | ']' | '{' | '}' | '_' | '|' | "'" | '"' | '`' | '#' | '$' | '@' -- svn-components mailing list [EMAIL PROTECTED] http://lists.ez.no/mailman/listinfo/svn-components