Versa 2.0 Grammar

[0] query ::= arc-expression
            | resource-expression
            | constant-expression
            | function-call
            | variable-reference
            | wrapped-query
            | sliced-query
            | list-constant

[1] string ::= DOUBLE_QUOTES string_chars DOUBLE_QUOTES
             | DOUBLE_QUOTES DOUBLE_QUOTES

[2] string_chars ::= CHARACTER_PLUS
                   | escape_chars
                   | string_chars CHARACTER_PLUS
                   | string_chars escape_chars

[3] escape_chars ::= STRING_ESCAPE
                   | unicode_escape

[4] unicode_escape ::= UNICODE_ESCAPE

[5] uriref ::= LT absoluteURI GT
             | LT GT

[6] absoluteURI ::= CHARACTER_PLUS
                  | unicode_escape
                  | CHARACTER_PLUS absoluteURI
                  | unicode_escape absoluteURI

[7] lang-string ::= string AT LANGUAGE

[8] datatype-string ::= string DOUBLE_CARROT uriref-qname

[9] wrapped-query ::= LEFT_PAREN query RIGHT_PAREN

[10] sliced-query ::= resource-expression slice-operator
                    | function-call slice-operator
                    | variable-reference slice-operator
                    | wrapped-query slice-operator
                    | sliced-query slice-operator

[11] arc-expression ::= forward-arc-expression
                      | backward-arc-expression

[12] resource-expression ::= node-expression
                           | literal-expression

[13] node-expression ::= uriref-pattern
                       | qname-pattern
                       | qname-constant-pattern

[14] literal-expression ::= literal-pattern
                          | typed-literal-pattern
                          | language-literal-pattern

[15] constant-expression ::= string-constant
                           | boolean-constant
                           | number-constant

[16] forward-arc-expression ::= forward-start-expression forward-operator arc-predicate-expression FORWARD_ARROW arc-end-expression

[17] forward-operator ::= PIPE_DASH
                        | DASH

[18] backward-arc-expression ::= arc-end-expression BACKWARD_ARROW arc-predicate-expression backward-operator backward-start-expression

[19] backward-operator ::= DASH_PIPE
                         | DASH

[20] function-reference ::= AMPERSAND function-name

[21] argument-expression ::= query
                           | dot-expression
                           | function-reference
                           | anonymous-function
                           | wild-card

[22] dot-expression ::= DOT

[23] function-call ::= function-name LEFT_PAREN argument-list RIGHT_PAREN

[24] argument-list ::=
                     | fixed-argument-list
                     | keyword-argument-list
                     | fixed-argument-list COMMA keyword-argument-list

[25] fixed-argument-list ::= argument-expression
                           | fixed-argument-list COMMA argument-expression

[26] keyword-argument-list ::= keyword-argument
                             | keyword-argument COMMA keyword-argument-list

[27] keyword-argument ::= argument-name EQUALS argument-expression

[28] anonymous-function ::= ANONYMOUS_FUNCTION_START function-argument-definition-list COLON argument-expression RIGHT_PAREN

[29] function-argument-definition-list ::=
                                         | function-fixed-argument-definition-list
                                         | keyword-argument-definition-list
                                         | function-fixed-argument-definition-list COMMA keyword-argument-definition-list

[30] keyword-argument-definition-list ::= keyword-argument
                                        | keyword-argument COMMA keyword-argument-definition-list

[31] variable-name ::= qname

[32] function-name ::= qname

[33] function-fixed-argument-definition-list ::= argument-name
                                               | function-fixed-argument-definition-list COMMA argument-name

[34] argument-name ::= qname

[35] qname ::= NCNAME
             | QNAME

[36] arc-start-expression ::= function-call
                            | anonymous-function
                            | resource-expression
                            | variable-reference
                            | wild-card
                            | wrapped-query
                            | list-constant

[37] forward-start-expression ::= arc-start-expression
                                | forward-arc-expression

[38] backward-start-expression ::= arc-start-expression
                                 | backward-arc-expression

[39] arc-predicate-expression ::= function-call
                                | anonymous-function
                                | node-expression
                                | wild-card
                                | variable-reference
                                | wrapped-query
                                | list-constant

[40] arc-end-expression ::= function-call
                          | anonymous-function
                          | resource-expression
                          | wild-card
                          | variable-reference
                          | wrapped-query
                          | list-constant
                          | constant-expression

[41] slice-operator ::= LEFT_SQUARE SIMPLE_NUMBER RIGHT_SQUARE
                      | LEFT_SQUARE SIMPLE_NUMBER COLON RIGHT_SQUARE
                      | LEFT_SQUARE COLON SIMPLE_NUMBER RIGHT_SQUARE
                      | LEFT_SQUARE SIMPLE_NUMBER COLON SIMPLE_NUMBER RIGHT_SQUARE

[42] variable-reference ::= DOLLAR variable-name

[43] wild-card ::= WILD_CARD

[44] string-constant ::= string

[45] uriref-pattern ::= uriref

[46] qname-constant-pattern ::= qname

[47] qname-pattern ::= WILD_CARD_COLON NCNAME
                     | NCNAME COLON_WILD_CARD

[48] literal-pattern ::= lang-string
                       | datatype-string

[49] list-constant ::= LEFT_SQUARE RIGHT_SQUARE
                     | LEFT_SQUARE query-list RIGHT_SQUARE

[50] query-list ::= argument-expression
                  | query-list COMMA argument-expression

[51] typed-literal-pattern ::= string DOUBLE_CARROT typed-literal-pattern-string-type
                             | WILD_CARD DOUBLE_CARROT typed-literal-pattern-wild-type

[52] typed-literal-pattern-string-type ::= qname-pattern
                                         | BANG qname-pattern
                                         | WILD_CARD
                                         | BANG WILD_CARD

[53] typed-literal-pattern-wild-type ::= uriref
                                       | BANG uriref
                                       | qname
                                       | BANG qname

[54] language-literal-pattern ::= string AT WILD_CARD
                                | string AT BANG WILD_CARD
                                | WILD_CARD AT LANGUAGE
                                | WILD_CARD AT BANG LANGUAGE

[55] number-constant ::= SIMPLE_NUMBER
                       | COMPLEX_NUMBER

[56] boolean-constant ::= TRUE
                        | FALSE

[57] uriref-qname ::= uriref
                    | qname

[58] LT ::= '<'

[59] DOUBLE_QUOTES ::= '\x22'

[60] DOUBLE_QUOTES ::= '\x22\x22\x22'

[61] EQUALS ::= '='

[62] LEFT_PAREN ::= '\('

[63] RIGHT_PAREN ::= '\)'

[64] ANONYMOUS_FUNCTION_START ::= '\(\!'

[65] LEFT_SQUARE ::= '\['

[66] RIGHT_SQUARE ::= '\]'

[67] DOLLAR ::= '\$'

[68] DOT ::= '\.'

[69] COLON ::= '\:'

[70] FORWARD_ARROW ::= '->'

[71] BACKWARD_ARROW ::= '\<-'

[72] DASH ::= '-'

[73] PIPE_DASH ::= '\|{ws}*\-'

[74] DASH_PIPE ::= '\-{ws}*\|'

[75] COMMA ::= ','

[76] BANG ::= '!'

[77] TRUE ::= 'true'

[78] FALSE ::= 'false'

[79] WILD_CARD ::= '\*'

[80] COLON_WILD_CARD ::= '\:\*'

[81] AMPERSAND ::= '&'

[82] WILD_CARD_COLON ::= '\*\:'

[83] DOUBLE_CARROT ::= '\^\^'

[84] QNAME ::= '{NCName}?:{NCName}'

[85] NCNAME ::= '{NCName}'

[86] SIMPLE_NUMBER ::= '[+-]?{Digit}+'

[87] COMPLEX_NUMBER ::= '[+-]?{Digit}+(\.{Digit}*)?([eE][+-]?{Digit}+)'

[88] COMPLEX_NUMBER ::= '[+-]?{Digit}+\.{Digit}*'

[89] DOUBLE_QUOTES ::= '\x27'

[90] AT ::= '\@'

Versa/Specification/Grammar (last edited 2008-11-24 18:46:31 by localhost)