[Versa] ENBF (take 2)
Michael Olson
Mike.Olson at fourthought.com
Thu Sep 15 13:54:36 MDT 2005
Changes:
* Simplified all of the different expressions (per Uche's suggestion)
so it should be easier to read/follow/understand
As a Note, I thought there would be a need to support different
"expressions" at different locations but now I think otherwise. The
only cavet is that where there used to be
a filter expression, now we need to document that expressions like ".
< 18" are short hand for (!x : $x = '.' < 18)
* Finished patterns, constants and the like
* Add keyword support to calling a function and anonymous function
definitions
One thought I did have is where I use "query-expression" to show a
nested expression, maybe this should be "query" The difference being
that query allows for a context reference.
I'll spend a bit of time today updating the bgen file to see if we are
even close to parsable....
[1] versa-query ::= declaration-list? query
[2] declaration-list ::= declaration ';' declaration-list ?
[3] declaration ::= variable-declaration
| function-declaration
| prefix-declarion
| context-declaration
[4] variable-declaration ::= "@variable" variable-name '=' query
[5] function-declaration ::= "@function" function-name '(' ( qname (
',' qname ) * ) * ')' = query-expression
[6] prefix-declaration ::= "@prefix" prefix '=' uriref
[7] context-declaration ::= "@context" context-name '=' query
[8] query ::= context-reference? query-expression
[9] context-reference ::= '{' context-name '}'
[10] query-expression ::= '(' query-expression ')'
| query-expression slice_operator
| traversal
| filter
| function-call
| anonymous-function
| variable-reference
| operator-expression
| pattern
| DOT
[11] slice-operator ::= '[' (signed-number | (signed-number ':') | (':'
signed-number) | (signed-number ':' signed-number)
[12] traversal ::= forward-traversal | backward-traversal
[13] filter ::= forward-filter | backward-filter
[14] forward-traversal ::= (query-expression "-" query-expression "->"
query-expression)
| ( '[' '-' query-expression "->"
query-expression ']' )
[15] forward-filter ::= (query-expression "|-" query-expression "->"
query-expression)
| ( '[' "|-" query-expression "->"
query-expression ']' )
[16] backward-traversal ::= (query-expression "<-" query-expression "-"
query-expression)
| ( '[' query-expression "<-"
query-expression "-" ']' )
[17] backward-filter ::= (query-expression "<-" query-expression "-|"
query-expression )
| ( '[' query-expression "<-" query-expression
"-|" ']' )
[18] function_call ::= function-name '(' argument-list ')'
[19] argument-list ::= fixed-argument-list? keyword-argument-list?
[20] fixed-argument-list ::= query-expression ( ',' query-expression )*
[21] keyword-argument-list ::= keyword-argument ( ',' keywrod-argument
) *
[22] keyword-argument ::= keyword-argument-name '=' query-expression
[23] keyword-argument-name :: = qname
[24] operator-expression ::= operator-expression? operator
query-expression
[25] anonymous-function ::= '(!' anonymous-argument-definition-list ':'
query-expression ')'
[26] anonymous-argument-defintion-list ::=
anonymous-fixed-argument-definition-list?
anonymous-keyword-argument-definition-list?
[27] anonymous-fixed-argument-definition-list ::=
(anonymous-fixed-argument-definition ( ','
anonymous-fixed-argument-definition ) * ) ?
[28] anonymous-fixed-argument-definition ::= qname
[29] anonymous-keyword-argument-definition-list ::=
(anonymous-keyword-argument-definition ( ','
anonymous-keyword-argument-definition ) * ) ?
[30] anonymous-keyword-argument-definition ::= keyword-argument-name
'=' query-expresion
[31] pattern ::= node-pattern | literal-pattern | wild-card
[32] node-pattern ::= uri-pattern | qname-pattern
[33] uri-pattern ::= uriref
[34] qname-pattern ::= qname
| '*:' localname
| prefix ':*'
[35] literal-pattern ::= string-constant
| literal-constant
| number-constant
| boolean-constant
| typed-literal-pattern
| language-literal-pattern
[36] operator ::= '!'
| '<'
| '>'
| '<='
| '>='
| '='
| '!='
| '<>'
| 'and'
| '&'
| 'or'
| '|'
| 'not '
| 'union'
| 'intersection'
| '+'
| '-'
| '*'
| '\'
| '*'
[37] variable-reference ::= '$' variable-name
[38] variable-name ::= qname
[39] function-name ::= qname
[40] context-name ::= qname
#Strings must be escaped following section 4.6.2.1
[41] string-constant ::= single-line-string | multiline-string
[42] single-line-string ::= single-line-apos | single-line-quote
[43] single-line-apos ::= '\'' [\'\n]*'\''
[44] single-line-quote ::= '"' [\"\n]*'"'
[45] multi-line-string ::= '""".*'"""'
[46] literal-constant ::= typed-literal-constant |
language-literal-constant
[47] typed-literal-constant ::= string '^^' uriref
[48] language-literal-constant ::= string '@' language
[49] number-constant ::= (signed-number ( (\.simple-number)? ) ('e'
signed-number)?
[50] signed-number ::= [-+]?simple-number
[51] simple-number ::= [-+]?[0-9]+
[52] boolean-constant ::= 'true' | 'false'
[53] typed-literal-pattern ::= ('!') ? string '^^' ('!') ?
(node_pattern | wild_card)
| wild_card '^^' ('!') ? uriref
| wild_card '^^' ('!') ? (node-pattern |
wild-card)
[54] language-literal-pattern ::= string '@' wild-card
| wild-card '@' ('!') ? language
[55] language ::= [a-z]+(-[a-z0-9]+)*
#qName, prefix and localname as defined here:
http://www.w3.org/TR/2004/REC-xml-20040204
#uri references are escaped as per section 4.5
[56] uriref ::= '<'[\<]* '>'
------------------------------------------------------------------------
-----------------
Mike Olson Principal
Consultant
mike.olson at fourthought.com +1 720 253 4662
Fourthought, Inc.
http://Fourthought.com
PO Box 270590, http://4Suite.org
Louisville, CO 80027-5009, USA
XML strategy, XML tools, knowledge management
More information about the Versa
mailing list