abouttreesummaryrefslogcommitdiff
path: root/antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4
diff options
context:
space:
mode:
authorPatrick Schönberger2021-08-14 14:56:12 +0200
committerPatrick Schönberger2021-08-14 14:56:12 +0200
commitc6ad2948bb98d42f8e0883ef82cd14cd2d5eda60 (patch)
tree9e83d6d8f61e56f5d3425b8709314d6bdb9315a9 /antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4
parent9f94b672a5dc32da5ad01742bd4e976315a30d9c (diff)
downloadtoc-c6ad2948bb98d42f8e0883ef82cd14cd2d5eda60.tar.gz
toc-c6ad2948bb98d42f8e0883ef82cd14cd2d5eda60.zip
add antlr source code and ReadMeHEADmain
Diffstat (limited to 'antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4')
-rw-r--r--antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g464
1 files changed, 64 insertions, 0 deletions
diff --git a/antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4 b/antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4
new file mode 100644
index 0000000..14bcf5a
--- /dev/null
+++ b/antlr4-cpp-runtime-4.9.2-source/runtime/src/tree/xpath/XPathLexer.g4
@@ -0,0 +1,64 @@
+lexer grammar XPathLexer;
+
+tokens { TOKEN_REF, RULE_REF }
+
+/*
+path : separator? word (separator word)* EOF ;
+
+separator
+ : '/' '!'
+ | '//' '!'
+ | '/'
+ | '//'
+ ;
+
+word: TOKEN_REF
+ | RULE_REF
+ | STRING
+ | '*'
+ ;
+*/
+
+ANYWHERE : '//' ;
+ROOT : '/' ;
+WILDCARD : '*' ;
+BANG : '!' ;
+
+ID : NameStartChar NameChar*
+ {
+ if (isupper(getText()[0]))
+ setType(TOKEN_REF);
+ else
+ setType(RULE_REF);
+ }
+ ;
+
+fragment
+NameChar : NameStartChar
+ | '0'..'9'
+ | '_'
+ | '\u00B7'
+ | '\u0300'..'\u036F'
+ | '\u203F'..'\u2040'
+ ;
+
+fragment
+NameStartChar
+ : 'A'..'Z' | 'a'..'z'
+ | '\u00C0'..'\u00D6'
+ | '\u00D8'..'\u00F6'
+ | '\u00F8'..'\u02FF'
+ | '\u0370'..'\u037D'
+ | '\u037F'..'\u1FFF'
+ | '\u200C'..'\u200D'
+ | '\u2070'..'\u218F'
+ | '\u2C00'..'\u2FEF'
+ | '\u3001'..'\uD7FF'
+ | '\uF900'..'\uFDCF'
+ | '\uFDF0'..'\uFFFF' // implicitly includes ['\u10000-'\uEFFFF]
+ ;
+
+STRING : '\'' .*? '\'';
+
+//WS : [ \t\r\n]+ -> skip ;
+