From 376b3c745d0f5f95c543ef9950e235568f544098 Mon Sep 17 00:00:00 2001 From: Timothy Washington Date: Thu, 4 Dec 2008 18:44:06 -0500 Subject: [PATCH] -- can now use the following expressions: ./child::node()[ 1 ] ./child::node()[ 1 ]/child::service/child::port/child::soap:address/attribute::location 1 eq 1 and 2 eq 2 1 eq 2 and 3 idiv 0 = 1 1 eq 1 or 3 idiv 0 = 1 5 instance of xs:integer (5, 6) instance of xs:integer+ --- cc/xpath.sablecc | 48 +++++++++++++++++------------------------------- 1 file changed, 17 insertions(+), 31 deletions(-) diff --git a/cc/xpath.sablecc b/cc/xpath.sablecc index c6937e2..3bd6d9e 100755 --- a/cc/xpath.sablecc +++ b/cc/xpath.sablecc @@ -62,10 +62,10 @@ ancestor-or-self::node() ./child::node()[ @asdf='' ] ./child::node()/child::service/child::port/child::soap:address/attribute::location ./child::node()[]/child::service/child::port/child::soap:address/attribute::location -./child::node()[ @name='tim' ] Error: [1,24] Unknown token: 't -[x] ./child::node()[ 1 ] Error: [1,18] expecting: 'for', 'if', 'some', 'every', ',', '$', '(', ']', '+', '-', '*', '/', '//', '@', '..', '.', 'child', 'descendant', 'attribute', 'self', 'descendant-or-self', 'following-sibling', 'following', 'namespace', 'parent', 'ancestor', 'preceding-sibling', 'preceding', 'ancestor-or-self', 'comment', 'document-node', 'element', 'node', 'processing-instruction', 'schema-attribute', 'schema-element', 'text', letter, '_', integerliteral, decimalliteral, doubleliteral, stringliteral +./child::node()[ @name='tim' ] +./child::node()[ 1 ] ./child::node()[ 12 ] -[x] ./child::node()[ 1 ]/child::service/child::port/child::soap:address/attribute::location +./child::node()[ 1 ]/child::service/child::port/child::soap:address/attribute::location /GPS/memory[text()=""] /GPS/memory[text()="64MB"] @@ -86,9 +86,9 @@ ancestor-or-self::node() --> or / and -[x] 1 eq 1 and 2 eq 2 -[x] 1 eq 2 and 3 idiv 0 = 1 -[x] 1 eq 1 or 3 idiv 0 = 1 Error: [1,1] expecting: EOF +1 eq 1 and 2 eq 2 +1 eq 2 and 3 idiv 0 = 1 +1 eq 1 or 3 idiv 0 = 1 --> cast / castable @@ -216,11 +216,7 @@ Helpers 0x0FB9 | [0x20D0..0x20DC] | 0x20E1 | [0x302A..0x302F] | 0x3099 | 0x309A; - digit = [0x0030..0x0039] | [0x0660..0x0669] | [0x06F0..0x06F9] | - [0x0966..0x096F] | [0x09E6..0x09EF] | [0x0A66..0x0A6F] | - [0x0AE6..0x0AEF] | [0x0B66..0x0B6F] | [0x0BE7..0x0BEF] | - [0x0C66..0x0C6F] | [0x0CE6..0x0CEF] | [0x0D66..0x0D6F] | - [0x0E50..0x0E59] | [0x0ED0..0x0ED9] | [0x0F20..0x0F29]; + digit = [ '0' .. '9' ]; extender = 0x00B7 | 0x02D0 | 0x02D1 | 0x0387 | 0x0640 | 0x0E46 | 0x0EC6 | 0x3005 | [0x3031..0x3035] | [0x309D..0x309E] | @@ -236,37 +232,27 @@ Helpers * http://www.w3.org/TR/REC-xml/#NT-Letter */ - /*letter_helper = basechar | + letter_helper = basechar | ideographic; - */ - letter_helper = basechar; - namechar = letter_helper | digit | '.' | '-' | '_' | ':' | combiningchar | extender; + //letter_helper = basechar; + + //namechar = letter_helper | digit | '.' | '-' | '_' | ':' | combiningchar | extender; + namechar = letter_helper | '.' | '-' | '_' | ':' | combiningchar | extender; name = (letter_helper | '_' | ':') (namechar)*; names = name (0x20 name)*; nmtoken = (namechar)+; nmtokens = nmtoken (0x20 nmtoken)*; char = 0x9 | 0xA | 0xD | [0x20-0xD7FF] | [0xE000-0xFFFD] | [0x10000-0x10FFFF]; - digits = ['0' .. '9']*; + escapequot = '""'; - doubleliteral_helper = (('.' digits) | - (digits ('.' [0-9]*)?)) ('e' | 'E') ('+' | '-')? digits; + doubleliteral_helper = (('.' digit) | + (digit ('.' [0-9]*)?)) ('e' | 'E') ('+' | '-')? digit; stringliteral_helper = ( 0x22 (namechar)* 0x22 ) | (''' (namechar)* '''); - //stringliteral_helper = ( 0x22 (escapequot)* 0x22 ) | - // (''' ('''''')* '''); - //doubleliteral_helper = (('.' digits) | - // (digits ('.' [0-9]*)?)) ('e' | 'E') ('+' | '-')? digits; - //stringliteral_helper = ( 0x22 (escapequot | [char - 0x22])* 0x22 ) | - // (''' ('''''' | [char - '''])* '''); - - //escapeapos = ''''; - //comment = '(:' (commentcontents | comment)* ':)'; - //commentcontents = [char+ - (char* ('(:' | ':)') char*)]; - tab = 9; cr = 13; lf = 10; @@ -436,9 +422,9 @@ Tokens underscore = '_'; - integerliteral = digits+; + integerliteral = digit+; - decimalliteral = ('.' digits+) | (digits+ '.' digits*); + decimalliteral = ('.' digit+) | (digit+ '.' digit*); doubleliteral = doubleliteral_helper; -- 2.11.4.GIT