[TYPO3-50-general] TypoScript 2.0, EBNF Specification

David Bruehlmeier typo3 at bruehlmeier.com
Tue Nov 27 17:39:02 CET 2007


Hi Robert et al,

I would like to make the following suggestions for the EBNF 
Specification of TypoScript 2.0. The proposed version is at the bottom 
of this post:

NamespaceIdentifier: I suggest this to start with a capital letter.

ArrayOffset: Can currently be just a single digit, I suggest this to be 
any number.

ComponentName: I suggest this to start with a capital letter.

BlockComment: The string "*/" should only allowed for the end of a comment.

ConfinementBlock: I suggest the LineBreak after "{" should be optional.

ObjectPath: An ObjectPath should not be allowed to start with a "."

ObjectType: NamespaceIdentifier should be optional (for the built-in 
namespaces).

MethodName: I suggest this to start with a small letter.

ValueProcessing: The comma separating several MethodArgument must be 
required for all but the last MethodArgument.

EscapedUnicodeCharacter: I will try to come up with a formal description 
for that later... :-)


Additionally, I have the following questions/remarks:

LowerCaseCharacter/UpperCaseCharacter: Should case-sensivity be part of 
the spec or not?

Whitespace: Is whitespace generally disregarded or should it also be 
specified in the spec?

IncludeDeclaration: The variable Resource is not yet defined.

Constant / ParseCondition: What's the status?


Greetings,
Dave

*********************************************************
TypoScript = { TypoScriptLine LineBreak };
TypoScriptLine = ( Comment | ConfinementBlock | Declaration | 
ParseCondition | ObjectDefinition);

ConfinementBlock = ObjectPath "{" [ LineBreak ] { TypoScriptLine } "}" ;

Declaration = ( IncludeDeclaration | NamespaceDeclaration );
Comment = ( SingleLineComment | BlockComment );
ObjectDefinition = ObjectPath ValueOperation;

IncludeDeclaration = "include" ":" "source" "=" DoubleQuote Resource 
DoubleQuote;
NamespaceDeclaration = "namespace" ":" NamespaceIdentifier "=" 
ComponentName;

SingleLineComment = ( "#" | "//" ) { ( UnicodeCharacter - LineBreak ) };

BlockComment = "/*" { BlockCommentText } BlockCommentTail;
BlockCommentText = UnicodeCharacter - "*" | "*" { "*" } ( 
UnicodeCharacter - "*" - "/" );
BlockCommentTail = "*" { "*" } "/" ;

ObjectPath = ObjectIdentifier { "." ObjectIdentifier } ( [ "." 
VariableName ] | [ "." ArrayOffset ] );
VariableName = "$" Identifier;

ValueOperation = ( ValueAssignment | ValueCopy | ValueReference | 
ValueUnset | ValueProcessing );
ValueAssignment = "=" ( Literal | ObjectType | Constant );
ValueCopy = "<" ObjectPath;
ValueReference = "=<" ObjectPath;
ValueUnset = ">";
ValueProcessing = "<<" ArrayOffset "." [ ComponentName "->" ] MethodName 
"(" { MethodArgument "," } MethodArgument ")"

MethodArgument = Literal | VariableName

Literal = DoubleQuotedLiteral | SingleQuotedLiteral;
DoubleQuotedLiteral = DoubleQuote ( { EscapedUnicodeCharacter } | 
VariableName ) DoubleQuote;
SingleQuotedLiteral = SingleQuote ( { EscapedUnicodeCharacter } | 
VariableName ) SingleQuote;

ObjectType = [ NamespaceIdentifier ":" Identifier ] | ComponentName;

Constant = (* ... to be defined *);

ParseCondition = (* ... to be defined *);

NamespaceIdentifier = UpperCaseIdentifier;
ObjectIdentifier = UpperCaseIdentifier;
MethodName = LowerCaseIdentifier;
Identifier = ( UpperCaseCharacter | LowerCaseCharacter ) { 
UpperCaseCharacter | LowerCaseCharacter };
UpperCaseIdentifier = UpperCaseCharacter { CharacterOrDigit };
LowerCaseIdentifier = LowerCaseCharacter { CharacterOrDigit };
ComponentName = UpperCaseCharacter { "_" CharacterOrDigit } { 
CharacterOrDigit };
ArrayOffset = Number;

CharacterOrDigit = Character | Digit;
UnicodeCharacter = ? All Unicode characters ?;
EscapedUnicodeCharacter = ? UnicodeCharacter - LineBreak + Double quote 
must be escaped when enclosed in double quotes, single quote must be 
escaped, when enclosed in single quotes, backslash and dollar sign must 
always be escaped. Escape character is the backslash ?;
Character = UpperCaseCharacter | LowerCaseCharacter;
UpperCaseCharacter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" 
| "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" 
| "V" | "W" | "X" | "Y" | "Z";
LowerCaseCharacter = "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" 
| "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" 
| "v" | "w" | "x" | "y" | "z";
Number = DigitWithoutZero { Digit };
DigitWithoutZero = "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
Digit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
LineBreak = "\n";
DoubleQuote = '"';
SingleQuote = "'";


More information about the TYPO3-project-5_0-general mailing list