From 4cd02da333caa95583acad9be74e458244ecb3da Mon Sep 17 00:00:00 2001 From: caugner Date: Sat, 29 Jan 2011 02:37:27 +0100 Subject: add alternative peg-based url parser --- src/nodejs/alternative/xapi-peg-grammar.peg | 48 +++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 src/nodejs/alternative/xapi-peg-grammar.peg (limited to 'src/nodejs/alternative/xapi-peg-grammar.peg') diff --git a/src/nodejs/alternative/xapi-peg-grammar.peg b/src/nodejs/alternative/xapi-peg-grammar.peg new file mode 100644 index 0000000..d9f5547 --- /dev/null +++ b/src/nodejs/alternative/xapi-peg-grammar.peg @@ -0,0 +1,48 @@ +Expr ← Path Type XPath? +Path ← "/" +Type ← WildCard / "node" / "way" / "relation" +XPath ← Bbox (Tag Child?)? / Bbox Child Tag? / Tag (Bbox Child?)? / Tag Child Bbox? / Child (Tag Bbox?)? / Child Bbox Tag? +Bbox ← LeftBracket BboxPredicate RightBracket +Tag ← LeftBracket TagPredicate RightBracket +Child ← LeftBracket ChildPredicate RightBracket + +BboxPredicate ← [bB] [bB] [oO] [xX] Equals Left Komma Bottom Komma Right Komma Top +Left ← Coordinate +Bottom ← Coordinate +Right ← Coordinate +Top ← Coordinate +Coordinate ← Sign? Double / Sign? Integer + +TagPredicate ← Keys Equals Vals + +Keys ← Key (Pipe Key)* +Key ← Chars +Vals ← WildCard / Val +Val ← Chars Pipe Keys / Chars + +Chars ← Char (Char)* +SpecialChar ← Escape Special +Special ← Equals / LeftBracket / RightBracket / LeftParent / RightParent / Pipe / Backslash +Space ← [ U+0020 ] +Equals ← [ U+003D ] +Escape ← [ U+005C ] +LeftBracket ← [ U+005B ] +RightBracket ← [ U+005D ] +LeftParent ← [ U+0028 ] +RightParent ← [ U+0029 ] +Backslash ← [ U+005C ] +Pipe ← [ U+007C ] +Char ← SpecialChar / [U+0021-U+0027] / [U+002B-U+003C] / [U+003E-U+005A] / [U+005C] / [U+005E-U+007B] / [U+007D-U+FFFF] + +ChildPredicate ← "nd" / "not(nd)" / "tag" / "not(tag)" / "not(tag)" / "way" / "not(way)" / "node" / "not(node)" / "relation" / "not(relation)" + +Integer ← "0" / Sign? [1-9] [0-9]* +Double ← Integer "." [0-9]* +Sign ← "+" / "-" +Empty ← "" + +Dot ← "." +Komma ← "," +WildCard ← "*" +CR ← [U+0013] +LF ← [U+000A] \ No newline at end of file -- cgit v1.2.3