| 
       Placeholder  | 
    Top Previous Next | 
| 
 Scripts > Token definitions > Placeholder 
 Placeholder tokens get their meaning from the input text. Parts of text - mostly words -, which are recognized by a general regular expression, can be assigned to a placeholder token. If the same part of texts exists at a following position in the text again, the placeholder token now can recognize it. 
 You can assign an arbitrary number of literal expressions to a placeholder token. If several literals are assigned, they build a sequence of alternatives. Only one of them can match a text at a certain position. 
 Dynamic tokens are only tested, if they are expected as a possible alternative. 
 Independently of the project settings placeholder tokens always are case sensitive and the word boundary option is set. 
 
 A placeholder token is defined by the expression: 
 {DYNAMIC} 
 The expression {DYNAMIC} is a keyword and will not be interpreted as a macro by the TextTransformer. 
 The assignment of a literal expression is done in a semantic action by the command: AddToken. 
 Example: 
 Variables, which are declared in a programming code with a certain type, can be assigned to a placeholder for that type. In the code that follows, the type of the variable is known. 
 ID ::= \w+ INTEGER ::= {DYNAMIC} 
 "int" ( ID {{ AddToken( xState.str(), "INTEGER" ); // assigns the found identifier to INTEGER }} "," )* 
 ";" 
 
 INTEGER 
 If ID recognizes the names : i1, i2 and i3, at a following position i1 or i2 or i3 can be recognized as an INTEGER. INTEGER now has the meaning of a token, which would be defined as: i1|i2|i3 
 Remark: The extension of a placeholder token by an additional literal has no effect on the recognitions of a preceding SKIP symbol. 
 
  | 
| 
       This page belongs to the TextTransformer Documentation  | 
    Home Content German |