Zeta Components - high quality PHP components

EBNF

Program

The template language starts with the non-terminal token: "Program".

Program ::= Code EOF ::= ( Text | Block )* ::= TextBlock | LiteralBlock | DelimiterBlock ::= CommentBlock | DeclarationBlock | ModifyingBlock | OutputBlock | LiteralBlock | CycleBlock | LoopBlock | CodeFlowBlock | TranslationBlock

Text blocks

::= ( ~'{' | ''! '{' )* ::= '{' 'literal' '}' Graphic * '{' '/literal' '}' :== '{ldelim}' | '{rdelim}'

Blocks

::= '{*' Graphic * '*}' ::= '{' 'var' SubDefineBlock '}' | '{' 'cycle' SubDefineBlock '}' | '{' 'use' SubDefineBlock '}' ::= PrimaryVariable ( '=' Expression )? ( ',' SubDefineBlock )? ::= '{' SubAssignBlock (',' SubAssignBlock)* '}' ::= AssignmentExpr | IncrementExpr | DecrementExpr ::= PrimaryVariable ( '=' | CombinedAssignment) Expression ::= ( ( '++' PrimaryVariable ) | ( PrimaryVariable '++' ) ) ::= ( ( '--' PrimaryVariable ) | ( PrimaryVariable '--' ) ) ::= '{' Expression '}' ::= '{' 'increment' PrimaryVariable ( ',' PrimaryVariable )* '}' | '{' 'decrement' PrimaryVariable ( ',' PrimaryVariable )* '}' | '{' 'reset' PrimaryVariable ( ',' PrimaryVariable )* '}'

Loop control

::= ForeachStatement | WhileStatement ::= '{' 'foreach' Expression 'as' PrimaryVariable ('=>' PrimaryVariable)? (Cycle)* (OffsetAndLimit)? '}' Code '{' '/foreach' '}' ::= '{' 'while' Expression '}' Code '{' '/while' '}' ::= ('increment' | 'decrement') PrimaryVariable (',' PrimaryVariable)* ::= ('offset' Expression)? ('limit' Expression)?

Code flow control

::= IfStatement | SwitchStatement | IncludeStatement | DelimiterStatement | '{break}' | '{skip}' | '{continue}' | CaptureStatement | ReturnStatement ::= '{' 'if' Expression '}' Code (ElseIf)* (Else)? '{' '/if' '}' ::= '{' 'elseif' Expression '}' Code ::= '{' 'else' '}' Code ::= '{' 'switch' Expression '}' (Case)* (DefaultCase)? '{' '/switch' '}' ::= '{' 'case' Literal ( ',' Literal)* '}' Code '{' '/case' '}' ::= '{' 'default' '}' Code '{' '/default' '}' ::= '{' 'include' Expression ('send' ExprAsPrimVarList)? ('receive' PrimVarAsPrimVarList)? '}' ::= '{' 'delimiter' (modulo Expression ('is' Expression)? )? '}' Code '{' '/delimiter' '}' ::= '{' 'capture' Expression '}' Code '{' '/capture' '}' ::= '{' 'return' PrimaryVariable '}' ::= ( Expression 'as' PrimaryVariable | PrimaryVariable ) (',' ExprAsPrimVarList)? ::= PrimaryVariable ('as' PrimaryVariable)? (',' PrimVarAsPrimVarList)?

Translations

::= TranslationContextStatement | TranslationStatement ::= '{' 'tr_context' StringLiteral '}' ::= '{' 'tr' StringLiteral ('context' StringLiteral)? ('comment' StringLiteral)? TranslationVars? '}' ::= 'vars' TranslationVarList ::= TranslationVar | TranslationVar ',' TranslationVarList ::= TranslationVarKey? Expression ::= ( StringLiteral | NumeralLiteral ) '=>'

Expression

::= PreUnaryExpression (BinaryOperator Expression)? ::= '++' PrimaryVariable | '--' PrimaryVariable | UnaryExpression | Expression 'instanceof' Identifier | ArrayDeclaration ::= 'array' '(' ( (Expression '=>')? Expression ( ',' Expression )* (',')? )? ')' | Expression '..' Expression ::= ( UnaryOperator )* PostFixExpression ::= PrimaryVariable ( '++' | '--' )? | Literal | FunctionCall | '(' Expression ')' ::= '$' Identifier ( '[' Expression ']' | '->' Expression )* ::= Identifier '(' (ParameterList)? ')' ::= Expression ( ',' Expression )* ::= Letter ( Letter | Digit | '_' )*

Basic literals

::= NumeralLiteral | StringLiteral | BooleanLiteral | NullLiteral ::= HexLiteral | OctLiteral | FloatLiteral ::= '0x' HexDigit + ::= '0' OctDigit + ::= NonZeroDigit Digit * ( '.' Digit + )? (('e'|'E') ('+'|'-')? Digit + )? ::= '"' Graphic * '"' | "'" Graphic * "'" ::= 'true' | 'false' ::= 'null'

Lexicon

::= '//' Graphic * ( EOL | '}' ) | '/*' Graphic * '*/' ::= Digit | Letter | Blank | Operators | Assignment | CombinedAssignment | RemainingCharSet ::= end-of-line ::= end-of-file ::= Tab | Space ::= '\n' ::= ' ' ::= '\t' ::= 'a' ... 'z' | 'A' ... 'Z' ::= '0' .. '9' | 'A' .. 'F' ::= '0' .. '8' ::= '1' .. '9' ::= '0' | NonZeroDigit ::= '=' ::= '+=' | '-=' | '*=' | '/=' | '%=' | '.=' ::= BinaryOperator | UnaryOperator | '++' | '--' ::= ArithmeticOperator | ComparisonOperator | BooleanOperator | StringOperator ::= '+' | '-' | '*' | '/' | '%' ::= '==' | '===' | '!=' | '!==' | '<' | '<=' | '>' | '>=' ::= '&&' | '||' ::= '.' ::= '+' | '-' | '!' ::= '.' | ':' | ';' | ',' | '~' | '(' | ')' | '[' | ']' | '{' | '}' | '_' | '|' | "'" | '"' | '`' | '#' | '$' | '@'