Stylus Studio XML Editor

Table of contents

Appendices

3.7 Lexical Structure

Lexical Structure

When tokenizing, the longest possible token is always returned.

For readability, whitespace may be used in expressions even though not explicitly allowed by the grammar: [ExprWhitespace] may be freely added within patterns before or after any [ExprToken] .

The following special tokenization rules must be applied in the order specified to disambiguate the [ExprToken] grammar:

Expression Lexical Structure
3.7    ExprToken   ::=   '(' | ')' | '[' | ']' | '.' | '..' | '@' | ',' | '::'
| [NameTest]
| [NodeType]
| [Operator]
| [FunctionName]
| [AxisName]
| [Literal]
| [Number]
| [VariableReference]
3.7    Literal   ::=   '"' [^"]* '"'
| "'" [^']* "'"
3.7    Number   ::=    [Digits] ('.' [Digits] ?)?
| '.' [Digits]
3.7    Digits   ::=   [0-9]+
3.7    Operator   ::=    [OperatorName]
| [MultiplyOperator]
| '/' | '//' | '|' | '+' | '-' | '=' | '!=' | '<' | '<=' | '>' | '>='
3.7    OperatorName   ::=   'and' | 'or' | 'mod' | 'div'
3.7    MultiplyOperator   ::=   '*'
3.7    FunctionName   ::=    QName - [NodeType]
3.7    VariableReference   ::=   '$' QName
3.7    NameTest   ::=   '*'
| NCName ':' '*'
| QName
3.7    NodeType   ::=   'comment'
| 'text'
| 'processing-instruction'
| 'node'
3.7    ExprWhitespace   ::=   S