Python3.g4 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151
  1. /*
  2. * The MIT License (MIT)
  3. *
  4. * Copyright (c) 2014 by Bart Kiers
  5. *
  6. * Permission is hereby granted, free of charge, to any person
  7. * obtaining a copy of this software and associated documentation
  8. * files (the "Software"), to deal in the Software without
  9. * restriction, including without limitation the rights to use,
  10. * copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. * copies of the Software, and to permit persons to whom the
  12. * Software is furnished to do so, subject to the following
  13. * conditions:
  14. *
  15. * The above copyright notice and this permission notice shall be
  16. * included in all copies or substantial portions of the Software.
  17. *
  18. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  19. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
  20. * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  21. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
  22. * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
  23. * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  24. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  25. * OTHER DEALINGS IN THE SOFTWARE.
  26. *
  27. * Project : python3-parser; an ANTLR4 grammar for Python 3
  28. * https://github.com/bkiers/python3-parser
  29. * Developed by : Bart Kiers, bart@big-o.nl
  30. */
  31. grammar Python3;
  32. // All comments that start with "///" are copy-pasted from
  33. // The Python Language Reference: https://docs.python.org/3.3/reference/grammar.html
  34. tokens { INDENT, DEDENT }
  35. @lexer::members {
  36. // A queue where extra tokens are pushed on (see the NEWLINE lexer rule).
  37. private java.util.LinkedList<Token> tokens = new java.util.LinkedList<>();
  38. // The stack that keeps track of the indentation level.
  39. private java.util.Stack<Integer> indents = new java.util.Stack<>();
  40. // The amount of opened braces, brackets and parenthesis.
  41. private int opened = 0;
  42. // The most recently produced token.
  43. private Token lastToken = null;
  44. @Override
  45. public void emit(Token t) {
  46. super.setToken(t);
  47. tokens.offer(t);
  48. }
  49. @Override
  50. public Token nextToken() {
  51. // Check if the end-of-file is ahead and there are still some DEDENTS expected.
  52. if (_input.LA(1) == EOF && !this.indents.isEmpty()) {
  53. // Remove any trailing EOF tokens from our buffer.
  54. for (int i = tokens.size() - 1; i >= 0; i--) {
  55. if (tokens.get(i).getType() == EOF) {
  56. tokens.remove(i);
  57. }
  58. }
  59. // First emit an extra line break that serves as the end of the statement.
  60. this.emit(commonToken(Python3Parser.NEWLINE, "\n"));
  61. // Now emit as much DEDENT tokens as needed.
  62. while (!indents.isEmpty()) {
  63. this.emit(createDedent());
  64. indents.pop();
  65. }
  66. // Put the EOF back on the token stream.
  67. this.emit(commonToken(Python3Parser.EOF, "<EOF>"));
  68. }
  69. Token next = super.nextToken();
  70. if (next.getChannel() == Token.DEFAULT_CHANNEL) {
  71. // Keep track of the last token on the default channel.
  72. this.lastToken = next;
  73. }
  74. return tokens.isEmpty() ? next : tokens.poll();
  75. }
  76. private Token createDedent() {
  77. CommonToken dedent = commonToken(Python3Parser.DEDENT, "");
  78. dedent.setLine(this.lastToken.getLine());
  79. return dedent;
  80. }
  81. private CommonToken commonToken(int type, String text) {
  82. int stop = this.getCharIndex() - 1;
  83. int start = text.isEmpty() ? stop : stop - text.length() + 1;
  84. return new CommonToken(this._tokenFactorySourcePair, type, DEFAULT_TOKEN_CHANNEL, start, stop);
  85. }
  86. // Calculates the indentation of the provided spaces, taking the
  87. // following rules into account:
  88. //
  89. // "Tabs are replaced (from left to right) by one to eight spaces
  90. // such that the total number of characters up to and including
  91. // the replacement is a multiple of eight [...]"
  92. //
  93. // -- https://docs.python.org/3.1/reference/lexical_analysis.html#indentation
  94. static int getIndentationCount(String spaces) {
  95. int count = 0;
  96. for (char ch : spaces.toCharArray()) {
  97. switch (ch) {
  98. case '\t':
  99. count += 8 - (count % 8);
  100. break;
  101. default:
  102. // A normal space char.
  103. count++;
  104. }
  105. }
  106. return count;
  107. }
  108. boolean atStartOfInput() {
  109. return super.getCharPositionInLine() == 0 && super.getLine() == 1;
  110. }
  111. }
  112. /*
  113. * parser rules
  114. */
  115. single_input: NEWLINE | simple_stmt | compound_stmt NEWLINE;
  116. file_input: (NEWLINE | stmt)* EOF;
  117. eval_input: testlist NEWLINE* EOF;
  118. decorator: '@' dotted_name ( '(' (arglist)? ')' )? NEWLINE;
  119. decorators: decorator+;
  120. decorated: decorators (classdef | funcdef | async_funcdef);
  121. async_funcdef: ASYNC funcdef;
  122. funcdef: 'def' NAME parameters ('->' test)? ':' suite;
  123. parameters: '(' (typedargslist)? ')';
  124. typedargslist: (tfpdef ('=' test)? (',' tfpdef ('=' test)?)* (',' (
  125. '*' (tfpdef)? (',' tfpdef ('=' test)?)* (',' ('**' tfpdef (',')?)?)?
  126. | '**' tfpdef (',')?)?)?
  127. | '*' (tfpdef)? (',' tfpdef ('=' test)?)* (',' ('**' tfpdef (',')?)?)?
  128. | '**' tfpdef (',')?);
  129. tfpdef: NAME (':' test)?;
  130. varargslist: (vfpdef ('=' test)? (',' vfpdef ('=' test)?)* (',' (
  131. '*' (vfpdef)? (',' vfpdef ('=' test)?)* (',' ('**' vfpdef (',')?)?)?
  132. | '**' vfpdef (',')?)?)?
  133. | '*' (vfpdef)? (',' vfpdef ('=' test)?)* (',' ('**' vfpdef (',')?)?)?
  134. | '**' vfpdef (',')?
  135. );
  136. vfpdef: NAME;
  137. stmt: simple_stmt | compound_stmt;
  138. simple_stmt: small_stmt (';' small_stmt)* (';')? NEWLINE;
  139. small_stmt: (expr_stmt | del_stmt | pass_stmt | flow_stmt |
  140. import_stmt | global_stmt | nonlocal_stmt | assert_stmt);
  141. expr_stmt: testlist_star_expr (annassign | augassign (yield_expr|testlist) |
  142. ('=' (yield_expr|testlist_star_expr))*);
  143. annassign: ':' test ('=' test)?;
  144. testlist_star_expr: (test|star_expr) (',' (test|star_expr))* (',')?;
  145. augassign: ('+=' | '-=' | '*=' | '@=' | '/=' | '%=' | '&=' | '|=' | '^=' |
  146. '<<=' | '>>=' | '**=' | '//=');
  147. // For normal and annotated assignments, additional restrictions enforced by the interpreter
  148. del_stmt: 'del' exprlist;
  149. pass_stmt: 'pass';
  150. flow_stmt: break_stmt | continue_stmt | return_stmt | raise_stmt | yield_stmt;
  151. break_stmt: 'break';
  152. continue_stmt: 'continue';
  153. return_stmt: 'return' (testlist)?;
  154. yield_stmt: yield_expr;
  155. raise_stmt: 'raise' (test ('from' test)?)?;
  156. import_stmt: import_name | import_from;
  157. import_name: 'import' dotted_as_names;
  158. // note below: the ('.' | '...') is necessary because '...' is tokenized as ELLIPSIS
  159. import_from: ('from' (('.' | '...')* dotted_name | ('.' | '...')+)
  160. 'import' ('*' | '(' import_as_names ')' | import_as_names));
  161. import_as_name: NAME ('as' NAME)?;
  162. dotted_as_name: dotted_name ('as' NAME)?;
  163. import_as_names: import_as_name (',' import_as_name)* (',')?;
  164. dotted_as_names: dotted_as_name (',' dotted_as_name)*;
  165. dotted_name: NAME ('.' NAME)*;
  166. global_stmt: 'global' NAME (',' NAME)*;
  167. nonlocal_stmt: 'nonlocal' NAME (',' NAME)*;
  168. assert_stmt: 'assert' test (',' test)?;
  169. compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | with_stmt | funcdef | classdef | decorated | async_stmt;
  170. async_stmt: ASYNC (funcdef | with_stmt | for_stmt);
  171. if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ('else' ':' suite)?;
  172. while_stmt: 'while' test ':' suite ('else' ':' suite)?;
  173. for_stmt: 'for' exprlist 'in' testlist ':' suite ('else' ':' suite)?;
  174. try_stmt: ('try' ':' suite
  175. ((except_clause ':' suite)+
  176. ('else' ':' suite)?
  177. ('finally' ':' suite)? |
  178. 'finally' ':' suite));
  179. with_stmt: 'with' with_item (',' with_item)* ':' suite;
  180. with_item: test ('as' expr)?;
  181. // NB compile.c makes sure that the default except clause is last
  182. except_clause: 'except' (test ('as' NAME)?)?;
  183. suite: simple_stmt | NEWLINE INDENT stmt+ DEDENT;
  184. test: or_test ('if' or_test 'else' test)? | lambdef;
  185. test_nocond: or_test | lambdef_nocond;
  186. lambdef: 'lambda' (varargslist)? ':' test;
  187. lambdef_nocond: 'lambda' (varargslist)? ':' test_nocond;
  188. or_test: and_test ('or' and_test)*;
  189. and_test: not_test ('and' not_test)*;
  190. not_test: 'not' not_test | comparison;
  191. comparison: expr (comp_op expr)*;
  192. // <> isn't actually a valid comparison operator in Python. It's here for the
  193. // sake of a __future__ import described in PEP 401 (which really works :-)
  194. comp_op: '<'|'>'|'=='|'>='|'<='|'<>'|'!='|'in'|'not' 'in'|'is'|'is' 'not';
  195. star_expr: '*' expr;
  196. expr: xor_expr ('|' xor_expr)*;
  197. xor_expr: and_expr ('^' and_expr)*;
  198. and_expr: shift_expr ('&' shift_expr)*;
  199. shift_expr: arith_expr (('<<'|'>>') arith_expr)*;
  200. arith_expr: term (('+'|'-') term)*;
  201. term: factor (('*'|'@'|'/'|'%'|'//') factor)*;
  202. factor: ('+'|'-'|'~') factor | power;
  203. power: atom_expr ('**' factor)?;
  204. atom_expr: (AWAIT)? atom trailer*;
  205. atom: ('(' (yield_expr|testlist_comp)? ')' |
  206. '[' (testlist_comp)? ']' |
  207. '{' (dictorsetmaker)? '}' |
  208. NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False');
  209. testlist_comp: (test|star_expr) ( comp_for | (',' (test|star_expr))* (',')? );
  210. trailer: '(' (arglist)? ')' | '[' subscriptlist ']' | '.' NAME;
  211. subscriptlist: subscript (',' subscript)* (',')?;
  212. subscript: test | (test)? ':' (test)? (sliceop)?;
  213. sliceop: ':' (test)?;
  214. exprlist: (expr|star_expr) (',' (expr|star_expr))* (',')?;
  215. testlist: test (',' test)* (',')?;
  216. dictorsetmaker: ( ((test ':' test | '**' expr)
  217. (comp_for | (',' (test ':' test | '**' expr))* (',')?)) |
  218. ((test | star_expr)
  219. (comp_for | (',' (test | star_expr))* (',')?)) );
  220. classdef: 'class' NAME ('(' (arglist)? ')')? ':' suite;
  221. arglist: argument (',' argument)* (',')?;
  222. // The reason that keywords are test nodes instead of NAME is that using NAME
  223. // results in an ambiguity. ast.c makes sure it's a NAME.
  224. // "test '=' test" is really "keyword '=' test", but we have no such token.
  225. // These need to be in a single rule to avoid grammar that is ambiguous
  226. // to our LL(1) parser. Even though 'test' includes '*expr' in star_expr,
  227. // we explicitly match '*' here, too, to give it proper precedence.
  228. // Illegal combinations and orderings are blocked in ast.c:
  229. // multiple (test comp_for) arguments are blocked; keyword unpackings
  230. // that precede iterable unpackings are blocked; etc.
  231. argument: ( test (comp_for)? |
  232. test '=' test |
  233. '**' test |
  234. '*' test );
  235. comp_iter: comp_for | comp_if;
  236. comp_for: (ASYNC)? 'for' exprlist 'in' or_test (comp_iter)?;
  237. comp_if: 'if' test_nocond (comp_iter)?;
  238. // not used in grammar, but may appear in "node" passed from Parser to Compiler
  239. encoding_decl: NAME;
  240. yield_expr: 'yield' (yield_arg)?;
  241. yield_arg: 'from' test | testlist;
  242. /*
  243. * lexer rules
  244. */
  245. STRING
  246. : STRING_LITERAL
  247. | BYTES_LITERAL
  248. ;
  249. NUMBER
  250. : INTEGER
  251. | FLOAT_NUMBER
  252. | IMAG_NUMBER
  253. ;
  254. INTEGER
  255. : DECIMAL_INTEGER
  256. | OCT_INTEGER
  257. | HEX_INTEGER
  258. | BIN_INTEGER
  259. ;
  260. DEF : 'def';
  261. RETURN : 'return';
  262. RAISE : 'raise';
  263. FROM : 'from';
  264. IMPORT : 'import';
  265. AS : 'as';
  266. GLOBAL : 'global';
  267. NONLOCAL : 'nonlocal';
  268. ASSERT : 'assert';
  269. IF : 'if';
  270. ELIF : 'elif';
  271. ELSE : 'else';
  272. WHILE : 'while';
  273. FOR : 'for';
  274. IN : 'in';
  275. TRY : 'try';
  276. FINALLY : 'finally';
  277. WITH : 'with';
  278. EXCEPT : 'except';
  279. LAMBDA : 'lambda';
  280. OR : 'or';
  281. AND : 'and';
  282. NOT : 'not';
  283. IS : 'is';
  284. NONE : 'None';
  285. TRUE : 'True';
  286. FALSE : 'False';
  287. CLASS : 'class';
  288. YIELD : 'yield';
  289. DEL : 'del';
  290. PASS : 'pass';
  291. CONTINUE : 'continue';
  292. BREAK : 'break';
  293. ASYNC : 'async';
  294. AWAIT : 'await';
  295. NEWLINE
  296. : ( {atStartOfInput()}? SPACES
  297. | ( '\r'? '\n' | '\r' ) SPACES?
  298. )
  299. {
  300. String newLine = getText().replaceAll("[^\r\n]+", "");
  301. String spaces = getText().replaceAll("[\r\n]+", "");
  302. int next = _input.LA(1);
  303. if (opened > 0 || next == '\r' || next == '\n' || next == '#') {
  304. // If we're inside a list or on a blank line, ignore all indents,
  305. // dedents and line breaks.
  306. skip();
  307. }
  308. else {
  309. emit(commonToken(NEWLINE, newLine));
  310. int indent = getIndentationCount(spaces);
  311. int previous = indents.isEmpty() ? 0 : indents.peek();
  312. if (indent == previous) {
  313. // skip indents of the same size as the present indent-size
  314. skip();
  315. }
  316. else if (indent > previous) {
  317. indents.push(indent);
  318. emit(commonToken(Python3Parser.INDENT, spaces));
  319. }
  320. else {
  321. // Possibly emit more than 1 DEDENT token.
  322. while(!indents.isEmpty() && indents.peek() > indent) {
  323. this.emit(createDedent());
  324. indents.pop();
  325. }
  326. }
  327. }
  328. }
  329. ;
  330. /// identifier ::= id_start id_continue*
  331. NAME
  332. : ID_START ID_CONTINUE*
  333. ;
  334. /// stringliteral ::= [stringprefix](shortstring | longstring)
  335. /// stringprefix ::= "r" | "u" | "R" | "U" | "f" | "F"
  336. /// | "fr" | "Fr" | "fR" | "FR" | "rf" | "rF" | "Rf" | "RF"
  337. STRING_LITERAL
  338. : ( [rR] | [uU] | [fF] | ( [fF] [rR] ) | ( [rR] [fF] ) )? ( SHORT_STRING | LONG_STRING )
  339. ;
  340. /// bytesliteral ::= bytesprefix(shortbytes | longbytes)
  341. /// bytesprefix ::= "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"
  342. BYTES_LITERAL
  343. : ( [bB] | ( [bB] [rR] ) | ( [rR] [bB] ) ) ( SHORT_BYTES | LONG_BYTES )
  344. ;
  345. /// decimalinteger ::= nonzerodigit digit* | "0"+
  346. DECIMAL_INTEGER
  347. : NON_ZERO_DIGIT DIGIT*
  348. | '0'+
  349. ;
  350. /// octinteger ::= "0" ("o" | "O") octdigit+
  351. OCT_INTEGER
  352. : '0' [oO] OCT_DIGIT+
  353. ;
  354. /// hexinteger ::= "0" ("x" | "X") hexdigit+
  355. HEX_INTEGER
  356. : '0' [xX] HEX_DIGIT+
  357. ;
  358. /// bininteger ::= "0" ("b" | "B") bindigit+
  359. BIN_INTEGER
  360. : '0' [bB] BIN_DIGIT+
  361. ;
  362. /// floatnumber ::= pointfloat | exponentfloat
  363. FLOAT_NUMBER
  364. : POINT_FLOAT
  365. | EXPONENT_FLOAT
  366. ;
  367. /// imagnumber ::= (floatnumber | intpart) ("j" | "J")
  368. IMAG_NUMBER
  369. : ( FLOAT_NUMBER | INT_PART ) [jJ]
  370. ;
  371. DOT : '.';
  372. ELLIPSIS : '...';
  373. STAR : '*';
  374. OPEN_PAREN : '(' {opened++;};
  375. CLOSE_PAREN : ')' {opened--;};
  376. COMMA : ',';
  377. COLON : ':';
  378. SEMI_COLON : ';';
  379. POWER : '**';
  380. ASSIGN : '=';
  381. OPEN_BRACK : '[' {opened++;};
  382. CLOSE_BRACK : ']' {opened--;};
  383. OR_OP : '|';
  384. XOR : '^';
  385. AND_OP : '&';
  386. LEFT_SHIFT : '<<';
  387. RIGHT_SHIFT : '>>';
  388. ADD : '+';
  389. MINUS : '-';
  390. DIV : '/';
  391. MOD : '%';
  392. IDIV : '//';
  393. NOT_OP : '~';
  394. OPEN_BRACE : '{' {opened++;};
  395. CLOSE_BRACE : '}' {opened--;};
  396. LESS_THAN : '<';
  397. GREATER_THAN : '>';
  398. EQUALS : '==';
  399. GT_EQ : '>=';
  400. LT_EQ : '<=';
  401. NOT_EQ_1 : '<>';
  402. NOT_EQ_2 : '!=';
  403. AT : '@';
  404. ARROW : '->';
  405. ADD_ASSIGN : '+=';
  406. SUB_ASSIGN : '-=';
  407. MULT_ASSIGN : '*=';
  408. AT_ASSIGN : '@=';
  409. DIV_ASSIGN : '/=';
  410. MOD_ASSIGN : '%=';
  411. AND_ASSIGN : '&=';
  412. OR_ASSIGN : '|=';
  413. XOR_ASSIGN : '^=';
  414. LEFT_SHIFT_ASSIGN : '<<=';
  415. RIGHT_SHIFT_ASSIGN : '>>=';
  416. POWER_ASSIGN : '**=';
  417. IDIV_ASSIGN : '//=';
  418. SKIP_
  419. : ( SPACES | COMMENT | LINE_JOINING ) -> skip
  420. ;
  421. UNKNOWN_CHAR
  422. : .
  423. ;
  424. /*
  425. * fragments
  426. */
  427. /// shortstring ::= "'" shortstringitem* "'" | '"' shortstringitem* '"'
  428. /// shortstringitem ::= shortstringchar | stringescapeseq
  429. /// shortstringchar ::= <any source character except "\" or newline or the quote>
  430. fragment SHORT_STRING
  431. : '\'' ( STRING_ESCAPE_SEQ | ~[\\\r\n'] )* '\''
  432. | '"' ( STRING_ESCAPE_SEQ | ~[\\\r\n"] )* '"'
  433. ;
  434. /// longstring ::= "'''" longstringitem* "'''" | '"""' longstringitem* '"""'
  435. fragment LONG_STRING
  436. : '\'\'\'' LONG_STRING_ITEM*? '\'\'\''
  437. | '"""' LONG_STRING_ITEM*? '"""'
  438. ;
  439. /// longstringitem ::= longstringchar | stringescapeseq
  440. fragment LONG_STRING_ITEM
  441. : LONG_STRING_CHAR
  442. | STRING_ESCAPE_SEQ
  443. ;
  444. /// longstringchar ::= <any source character except "\">
  445. fragment LONG_STRING_CHAR
  446. : ~'\\'
  447. ;
  448. /// stringescapeseq ::= "\" <any source character>
  449. fragment STRING_ESCAPE_SEQ
  450. : '\\' .
  451. | '\\' NEWLINE
  452. ;
  453. /// nonzerodigit ::= "1"..."9"
  454. fragment NON_ZERO_DIGIT
  455. : [1-9]
  456. ;
  457. /// digit ::= "0"..."9"
  458. fragment DIGIT
  459. : [0-9]
  460. ;
  461. /// octdigit ::= "0"..."7"
  462. fragment OCT_DIGIT
  463. : [0-7]
  464. ;
  465. /// hexdigit ::= digit | "a"..."f" | "A"..."F"
  466. fragment HEX_DIGIT
  467. : [0-9a-fA-F]
  468. ;
  469. /// bindigit ::= "0" | "1"
  470. fragment BIN_DIGIT
  471. : [01]
  472. ;
  473. /// pointfloat ::= [intpart] fraction | intpart "."
  474. fragment POINT_FLOAT
  475. : INT_PART? FRACTION
  476. | INT_PART '.'
  477. ;
  478. /// exponentfloat ::= (intpart | pointfloat) exponent
  479. fragment EXPONENT_FLOAT
  480. : ( INT_PART | POINT_FLOAT ) EXPONENT
  481. ;
  482. /// intpart ::= digit+
  483. fragment INT_PART
  484. : DIGIT+
  485. ;
  486. /// fraction ::= "." digit+
  487. fragment FRACTION
  488. : '.' DIGIT+
  489. ;
  490. /// exponent ::= ("e" | "E") ["+" | "-"] digit+
  491. fragment EXPONENT
  492. : [eE] [+-]? DIGIT+
  493. ;
  494. /// shortbytes ::= "'" shortbytesitem* "'" | '"' shortbytesitem* '"'
  495. /// shortbytesitem ::= shortbyteschar | bytesescapeseq
  496. fragment SHORT_BYTES
  497. : '\'' ( SHORT_BYTES_CHAR_NO_SINGLE_QUOTE | BYTES_ESCAPE_SEQ )* '\''
  498. | '"' ( SHORT_BYTES_CHAR_NO_DOUBLE_QUOTE | BYTES_ESCAPE_SEQ )* '"'
  499. ;
  500. /// longbytes ::= "'''" longbytesitem* "'''" | '"""' longbytesitem* '"""'
  501. fragment LONG_BYTES
  502. : '\'\'\'' LONG_BYTES_ITEM*? '\'\'\''
  503. | '"""' LONG_BYTES_ITEM*? '"""'
  504. ;
  505. /// longbytesitem ::= longbyteschar | bytesescapeseq
  506. fragment LONG_BYTES_ITEM
  507. : LONG_BYTES_CHAR
  508. | BYTES_ESCAPE_SEQ
  509. ;
  510. /// shortbyteschar ::= <any ASCII character except "\" or newline or the quote>
  511. fragment SHORT_BYTES_CHAR_NO_SINGLE_QUOTE
  512. : [\u0000-\u0009]
  513. | [\u000B-\u000C]
  514. | [\u000E-\u0026]
  515. | [\u0028-\u005B]
  516. | [\u005D-\u007F]
  517. ;
  518. fragment SHORT_BYTES_CHAR_NO_DOUBLE_QUOTE
  519. : [\u0000-\u0009]
  520. | [\u000B-\u000C]
  521. | [\u000E-\u0021]
  522. | [\u0023-\u005B]
  523. | [\u005D-\u007F]
  524. ;
  525. /// longbyteschar ::= <any ASCII character except "\">
  526. fragment LONG_BYTES_CHAR
  527. : [\u0000-\u005B]
  528. | [\u005D-\u007F]
  529. ;
  530. /// bytesescapeseq ::= "\" <any ASCII character>
  531. fragment BYTES_ESCAPE_SEQ
  532. : '\\' [\u0000-\u007F]
  533. ;
  534. fragment SPACES
  535. : [ \t]+
  536. ;
  537. fragment COMMENT
  538. : '#' ~[\r\n]*
  539. ;
  540. fragment LINE_JOINING
  541. : '\\' SPACES? ( '\r'? '\n' | '\r' )
  542. ;
  543. /// id_start ::= <all characters in general categories Lu, Ll, Lt, Lm, Lo, Nl, the underscore, and characters with the Other_ID_Start property>
  544. fragment ID_START
  545. : '_'
  546. | [A-Z]
  547. | [a-z]
  548. | '\u00AA'
  549. | '\u00B5'
  550. | '\u00BA'
  551. | [\u00C0-\u00D6]
  552. | [\u00D8-\u00F6]
  553. | [\u00F8-\u01BA]
  554. | '\u01BB'
  555. | [\u01BC-\u01BF]
  556. | [\u01C0-\u01C3]
  557. | [\u01C4-\u0241]
  558. | [\u0250-\u02AF]
  559. | [\u02B0-\u02C1]
  560. | [\u02C6-\u02D1]
  561. | [\u02E0-\u02E4]
  562. | '\u02EE'
  563. | '\u037A'
  564. | '\u0386'
  565. | [\u0388-\u038A]
  566. | '\u038C'
  567. | [\u038E-\u03A1]
  568. | [\u03A3-\u03CE]
  569. | [\u03D0-\u03F5]
  570. | [\u03F7-\u0481]
  571. | [\u048A-\u04CE]
  572. | [\u04D0-\u04F9]
  573. | [\u0500-\u050F]
  574. | [\u0531-\u0556]
  575. | '\u0559'
  576. | [\u0561-\u0587]
  577. | [\u05D0-\u05EA]
  578. | [\u05F0-\u05F2]
  579. | [\u0621-\u063A]
  580. | '\u0640'
  581. | [\u0641-\u064A]
  582. | [\u066E-\u066F]
  583. | [\u0671-\u06D3]
  584. | '\u06D5'
  585. | [\u06E5-\u06E6]
  586. | [\u06EE-\u06EF]
  587. | [\u06FA-\u06FC]
  588. | '\u06FF'
  589. | '\u0710'
  590. | [\u0712-\u072F]
  591. | [\u074D-\u076D]
  592. | [\u0780-\u07A5]
  593. | '\u07B1'
  594. | [\u0904-\u0939]
  595. | '\u093D'
  596. | '\u0950'
  597. | [\u0958-\u0961]
  598. | '\u097D'
  599. | [\u0985-\u098C]
  600. | [\u098F-\u0990]
  601. | [\u0993-\u09A8]
  602. | [\u09AA-\u09B0]
  603. | '\u09B2'
  604. | [\u09B6-\u09B9]
  605. | '\u09BD'
  606. | '\u09CE'
  607. | [\u09DC-\u09DD]
  608. | [\u09DF-\u09E1]
  609. | [\u09F0-\u09F1]
  610. | [\u0A05-\u0A0A]
  611. | [\u0A0F-\u0A10]
  612. | [\u0A13-\u0A28]
  613. | [\u0A2A-\u0A30]
  614. | [\u0A32-\u0A33]
  615. | [\u0A35-\u0A36]
  616. | [\u0A38-\u0A39]
  617. | [\u0A59-\u0A5C]
  618. | '\u0A5E'
  619. | [\u0A72-\u0A74]
  620. | [\u0A85-\u0A8D]
  621. | [\u0A8F-\u0A91]
  622. | [\u0A93-\u0AA8]
  623. | [\u0AAA-\u0AB0]
  624. | [\u0AB2-\u0AB3]
  625. | [\u0AB5-\u0AB9]
  626. | '\u0ABD'
  627. | '\u0AD0'
  628. | [\u0AE0-\u0AE1]
  629. | [\u0B05-\u0B0C]
  630. | [\u0B0F-\u0B10]
  631. | [\u0B13-\u0B28]
  632. | [\u0B2A-\u0B30]
  633. | [\u0B32-\u0B33]
  634. | [\u0B35-\u0B39]
  635. | '\u0B3D'
  636. | [\u0B5C-\u0B5D]
  637. | [\u0B5F-\u0B61]
  638. | '\u0B71'
  639. | '\u0B83'
  640. | [\u0B85-\u0B8A]
  641. | [\u0B8E-\u0B90]
  642. | [\u0B92-\u0B95]
  643. | [\u0B99-\u0B9A]
  644. | '\u0B9C'
  645. | [\u0B9E-\u0B9F]
  646. | [\u0BA3-\u0BA4]
  647. | [\u0BA8-\u0BAA]
  648. | [\u0BAE-\u0BB9]
  649. | [\u0C05-\u0C0C]
  650. | [\u0C0E-\u0C10]
  651. | [\u0C12-\u0C28]
  652. | [\u0C2A-\u0C33]
  653. | [\u0C35-\u0C39]
  654. | [\u0C60-\u0C61]
  655. | [\u0C85-\u0C8C]
  656. | [\u0C8E-\u0C90]
  657. | [\u0C92-\u0CA8]
  658. | [\u0CAA-\u0CB3]
  659. | [\u0CB5-\u0CB9]
  660. | '\u0CBD'
  661. | '\u0CDE'
  662. | [\u0CE0-\u0CE1]
  663. | [\u0D05-\u0D0C]
  664. | [\u0D0E-\u0D10]
  665. | [\u0D12-\u0D28]
  666. | [\u0D2A-\u0D39]
  667. | [\u0D60-\u0D61]
  668. | [\u0D85-\u0D96]
  669. | [\u0D9A-\u0DB1]
  670. | [\u0DB3-\u0DBB]
  671. | '\u0DBD'
  672. | [\u0DC0-\u0DC6]
  673. | [\u0E01-\u0E30]
  674. | [\u0E32-\u0E33]
  675. | [\u0E40-\u0E45]
  676. | '\u0E46'
  677. | [\u0E81-\u0E82]
  678. | '\u0E84'
  679. | [\u0E87-\u0E88]
  680. | '\u0E8A'
  681. | '\u0E8D'
  682. | [\u0E94-\u0E97]
  683. | [\u0E99-\u0E9F]
  684. | [\u0EA1-\u0EA3]
  685. | '\u0EA5'
  686. | '\u0EA7'
  687. | [\u0EAA-\u0EAB]
  688. | [\u0EAD-\u0EB0]
  689. | [\u0EB2-\u0EB3]
  690. | '\u0EBD'
  691. | [\u0EC0-\u0EC4]
  692. | '\u0EC6'
  693. | [\u0EDC-\u0EDD]
  694. | '\u0F00'
  695. | [\u0F40-\u0F47]
  696. | [\u0F49-\u0F6A]
  697. | [\u0F88-\u0F8B]
  698. | [\u1000-\u1021]
  699. | [\u1023-\u1027]
  700. | [\u1029-\u102A]
  701. | [\u1050-\u1055]
  702. | [\u10A0-\u10C5]
  703. | [\u10D0-\u10FA]
  704. | '\u10FC'
  705. | [\u1100-\u1159]
  706. | [\u115F-\u11A2]
  707. | [\u11A8-\u11F9]
  708. | [\u1200-\u1248]
  709. | [\u124A-\u124D]
  710. | [\u1250-\u1256]
  711. | '\u1258'
  712. | [\u125A-\u125D]
  713. | [\u1260-\u1288]
  714. | [\u128A-\u128D]
  715. | [\u1290-\u12B0]
  716. | [\u12B2-\u12B5]
  717. | [\u12B8-\u12BE]
  718. | '\u12C0'
  719. | [\u12C2-\u12C5]
  720. | [\u12C8-\u12D6]
  721. | [\u12D8-\u1310]
  722. | [\u1312-\u1315]
  723. | [\u1318-\u135A]
  724. | [\u1380-\u138F]
  725. | [\u13A0-\u13F4]
  726. | [\u1401-\u166C]
  727. | [\u166F-\u1676]
  728. | [\u1681-\u169A]
  729. | [\u16A0-\u16EA]
  730. | [\u16EE-\u16F0]
  731. | [\u1700-\u170C]
  732. | [\u170E-\u1711]
  733. | [\u1720-\u1731]
  734. | [\u1740-\u1751]
  735. | [\u1760-\u176C]
  736. | [\u176E-\u1770]
  737. | [\u1780-\u17B3]
  738. | '\u17D7'
  739. | '\u17DC'
  740. | [\u1820-\u1842]
  741. | '\u1843'
  742. | [\u1844-\u1877]
  743. | [\u1880-\u18A8]
  744. | [\u1900-\u191C]
  745. | [\u1950-\u196D]
  746. | [\u1970-\u1974]
  747. | [\u1980-\u19A9]
  748. | [\u19C1-\u19C7]
  749. | [\u1A00-\u1A16]
  750. | [\u1D00-\u1D2B]
  751. | [\u1D2C-\u1D61]
  752. | [\u1D62-\u1D77]
  753. | '\u1D78'
  754. | [\u1D79-\u1D9A]
  755. | [\u1D9B-\u1DBF]
  756. | [\u1E00-\u1E9B]
  757. | [\u1EA0-\u1EF9]
  758. | [\u1F00-\u1F15]
  759. | [\u1F18-\u1F1D]
  760. | [\u1F20-\u1F45]
  761. | [\u1F48-\u1F4D]
  762. | [\u1F50-\u1F57]
  763. | '\u1F59'
  764. | '\u1F5B'
  765. | '\u1F5D'
  766. | [\u1F5F-\u1F7D]
  767. | [\u1F80-\u1FB4]
  768. | [\u1FB6-\u1FBC]
  769. | '\u1FBE'
  770. | [\u1FC2-\u1FC4]
  771. | [\u1FC6-\u1FCC]
  772. | [\u1FD0-\u1FD3]
  773. | [\u1FD6-\u1FDB]
  774. | [\u1FE0-\u1FEC]
  775. | [\u1FF2-\u1FF4]
  776. | [\u1FF6-\u1FFC]
  777. | '\u2071'
  778. | '\u207F'
  779. | [\u2090-\u2094]
  780. | '\u2102'
  781. | '\u2107'
  782. | [\u210A-\u2113]
  783. | '\u2115'
  784. | '\u2118'
  785. | [\u2119-\u211D]
  786. | '\u2124'
  787. | '\u2126'
  788. | '\u2128'
  789. | [\u212A-\u212D]
  790. | '\u212E'
  791. | [\u212F-\u2131]
  792. | [\u2133-\u2134]
  793. | [\u2135-\u2138]
  794. | '\u2139'
  795. | [\u213C-\u213F]
  796. | [\u2145-\u2149]
  797. | [\u2160-\u2183]
  798. | [\u2C00-\u2C2E]
  799. | [\u2C30-\u2C5E]
  800. | [\u2C80-\u2CE4]
  801. | [\u2D00-\u2D25]
  802. | [\u2D30-\u2D65]
  803. | '\u2D6F'
  804. | [\u2D80-\u2D96]
  805. | [\u2DA0-\u2DA6]
  806. | [\u2DA8-\u2DAE]
  807. | [\u2DB0-\u2DB6]
  808. | [\u2DB8-\u2DBE]
  809. | [\u2DC0-\u2DC6]
  810. | [\u2DC8-\u2DCE]
  811. | [\u2DD0-\u2DD6]
  812. | [\u2DD8-\u2DDE]
  813. | '\u3005'
  814. | '\u3006'
  815. | '\u3007'
  816. | [\u3021-\u3029]
  817. | [\u3031-\u3035]
  818. | [\u3038-\u303A]
  819. | '\u303B'
  820. | '\u303C'
  821. | [\u3041-\u3096]
  822. | [\u309B-\u309C]
  823. | [\u309D-\u309E]
  824. | '\u309F'
  825. | [\u30A1-\u30FA]
  826. | [\u30FC-\u30FE]
  827. | '\u30FF'
  828. | [\u3105-\u312C]
  829. | [\u3131-\u318E]
  830. | [\u31A0-\u31B7]
  831. | [\u31F0-\u31FF]
  832. | [\u3400-\u4DB5]
  833. | [\u4E00-\u9FBB]
  834. | [\uA000-\uA014]
  835. | '\uA015'
  836. | [\uA016-\uA48C]
  837. | [\uA800-\uA801]
  838. | [\uA803-\uA805]
  839. | [\uA807-\uA80A]
  840. | [\uA80C-\uA822]
  841. | [\uAC00-\uD7A3]
  842. | [\uF900-\uFA2D]
  843. | [\uFA30-\uFA6A]
  844. | [\uFA70-\uFAD9]
  845. | [\uFB00-\uFB06]
  846. | [\uFB13-\uFB17]
  847. | '\uFB1D'
  848. | [\uFB1F-\uFB28]
  849. | [\uFB2A-\uFB36]
  850. | [\uFB38-\uFB3C]
  851. | '\uFB3E'
  852. | [\uFB40-\uFB41]
  853. | [\uFB43-\uFB44]
  854. | [\uFB46-\uFBB1]
  855. | [\uFBD3-\uFD3D]
  856. | [\uFD50-\uFD8F]
  857. | [\uFD92-\uFDC7]
  858. | [\uFDF0-\uFDFB]
  859. | [\uFE70-\uFE74]
  860. | [\uFE76-\uFEFC]
  861. | [\uFF21-\uFF3A]
  862. | [\uFF41-\uFF5A]
  863. | [\uFF66-\uFF6F]
  864. | '\uFF70'
  865. | [\uFF71-\uFF9D]
  866. | [\uFF9E-\uFF9F]
  867. | [\uFFA0-\uFFBE]
  868. | [\uFFC2-\uFFC7]
  869. | [\uFFCA-\uFFCF]
  870. | [\uFFD2-\uFFD7]
  871. | [\uFFDA-\uFFDC]
  872. ;
  873. /// id_continue ::= <all characters in id_start, plus characters in the categories Mn, Mc, Nd, Pc and others with the Other_ID_Continue property>
  874. fragment ID_CONTINUE
  875. : ID_START
  876. | [0-9]
  877. | [\u0300-\u036F]
  878. | [\u0483-\u0486]
  879. | [\u0591-\u05B9]
  880. | [\u05BB-\u05BD]
  881. | '\u05BF'
  882. | [\u05C1-\u05C2]
  883. | [\u05C4-\u05C5]
  884. | '\u05C7'
  885. | [\u0610-\u0615]
  886. | [\u064B-\u065E]
  887. | [\u0660-\u0669]
  888. | '\u0670'
  889. | [\u06D6-\u06DC]
  890. | [\u06DF-\u06E4]
  891. | [\u06E7-\u06E8]
  892. | [\u06EA-\u06ED]
  893. | [\u06F0-\u06F9]
  894. | '\u0711'
  895. | [\u0730-\u074A]
  896. | [\u07A6-\u07B0]
  897. | [\u0901-\u0902]
  898. | '\u0903'
  899. | '\u093C'
  900. | [\u093E-\u0940]
  901. | [\u0941-\u0948]
  902. | [\u0949-\u094C]
  903. | '\u094D'
  904. | [\u0951-\u0954]
  905. | [\u0962-\u0963]
  906. | [\u0966-\u096F]
  907. | '\u0981'
  908. | [\u0982-\u0983]
  909. | '\u09BC'
  910. | [\u09BE-\u09C0]
  911. | [\u09C1-\u09C4]
  912. | [\u09C7-\u09C8]
  913. | [\u09CB-\u09CC]
  914. | '\u09CD'
  915. | '\u09D7'
  916. | [\u09E2-\u09E3]
  917. | [\u09E6-\u09EF]
  918. | [\u0A01-\u0A02]
  919. | '\u0A03'
  920. | '\u0A3C'
  921. | [\u0A3E-\u0A40]
  922. | [\u0A41-\u0A42]
  923. | [\u0A47-\u0A48]
  924. | [\u0A4B-\u0A4D]
  925. | [\u0A66-\u0A6F]
  926. | [\u0A70-\u0A71]
  927. | [\u0A81-\u0A82]
  928. | '\u0A83'
  929. | '\u0ABC'
  930. | [\u0ABE-\u0AC0]
  931. | [\u0AC1-\u0AC5]
  932. | [\u0AC7-\u0AC8]
  933. | '\u0AC9'
  934. | [\u0ACB-\u0ACC]
  935. | '\u0ACD'
  936. | [\u0AE2-\u0AE3]
  937. | [\u0AE6-\u0AEF]
  938. | '\u0B01'
  939. | [\u0B02-\u0B03]
  940. | '\u0B3C'
  941. | '\u0B3E'
  942. | '\u0B3F'
  943. | '\u0B40'
  944. | [\u0B41-\u0B43]
  945. | [\u0B47-\u0B48]
  946. | [\u0B4B-\u0B4C]
  947. | '\u0B4D'
  948. | '\u0B56'
  949. | '\u0B57'
  950. | [\u0B66-\u0B6F]
  951. | '\u0B82'
  952. | [\u0BBE-\u0BBF]
  953. | '\u0BC0'
  954. | [\u0BC1-\u0BC2]
  955. | [\u0BC6-\u0BC8]
  956. | [\u0BCA-\u0BCC]
  957. | '\u0BCD'
  958. | '\u0BD7'
  959. | [\u0BE6-\u0BEF]
  960. | [\u0C01-\u0C03]
  961. | [\u0C3E-\u0C40]
  962. | [\u0C41-\u0C44]
  963. | [\u0C46-\u0C48]
  964. | [\u0C4A-\u0C4D]
  965. | [\u0C55-\u0C56]
  966. | [\u0C66-\u0C6F]
  967. | [\u0C82-\u0C83]
  968. | '\u0CBC'
  969. | '\u0CBE'
  970. | '\u0CBF'
  971. | [\u0CC0-\u0CC4]
  972. | '\u0CC6'
  973. | [\u0CC7-\u0CC8]
  974. | [\u0CCA-\u0CCB]
  975. | [\u0CCC-\u0CCD]
  976. | [\u0CD5-\u0CD6]
  977. | [\u0CE6-\u0CEF]
  978. | [\u0D02-\u0D03]
  979. | [\u0D3E-\u0D40]
  980. | [\u0D41-\u0D43]
  981. | [\u0D46-\u0D48]
  982. | [\u0D4A-\u0D4C]
  983. | '\u0D4D'
  984. | '\u0D57'
  985. | [\u0D66-\u0D6F]
  986. | [\u0D82-\u0D83]
  987. | '\u0DCA'
  988. | [\u0DCF-\u0DD1]
  989. | [\u0DD2-\u0DD4]
  990. | '\u0DD6'
  991. | [\u0DD8-\u0DDF]
  992. | [\u0DF2-\u0DF3]
  993. | '\u0E31'
  994. | [\u0E34-\u0E3A]
  995. | [\u0E47-\u0E4E]
  996. | [\u0E50-\u0E59]
  997. | '\u0EB1'
  998. | [\u0EB4-\u0EB9]
  999. | [\u0EBB-\u0EBC]
  1000. | [\u0EC8-\u0ECD]
  1001. | [\u0ED0-\u0ED9]
  1002. | [\u0F18-\u0F19]
  1003. | [\u0F20-\u0F29]
  1004. | '\u0F35'
  1005. | '\u0F37'
  1006. | '\u0F39'
  1007. | [\u0F3E-\u0F3F]
  1008. | [\u0F71-\u0F7E]
  1009. | '\u0F7F'
  1010. | [\u0F80-\u0F84]
  1011. | [\u0F86-\u0F87]
  1012. | [\u0F90-\u0F97]
  1013. | [\u0F99-\u0FBC]
  1014. | '\u0FC6'
  1015. | '\u102C'
  1016. | [\u102D-\u1030]
  1017. | '\u1031'
  1018. | '\u1032'
  1019. | [\u1036-\u1037]
  1020. | '\u1038'
  1021. | '\u1039'
  1022. | [\u1040-\u1049]
  1023. | [\u1056-\u1057]
  1024. | [\u1058-\u1059]
  1025. | '\u135F'
  1026. | [\u1369-\u1371]
  1027. | [\u1712-\u1714]
  1028. | [\u1732-\u1734]
  1029. | [\u1752-\u1753]
  1030. | [\u1772-\u1773]
  1031. | '\u17B6'
  1032. | [\u17B7-\u17BD]
  1033. | [\u17BE-\u17C5]
  1034. | '\u17C6'
  1035. | [\u17C7-\u17C8]
  1036. | [\u17C9-\u17D3]
  1037. | '\u17DD'
  1038. | [\u17E0-\u17E9]
  1039. | [\u180B-\u180D]
  1040. | [\u1810-\u1819]
  1041. | '\u18A9'
  1042. | [\u1920-\u1922]
  1043. | [\u1923-\u1926]
  1044. | [\u1927-\u1928]
  1045. | [\u1929-\u192B]
  1046. | [\u1930-\u1931]
  1047. | '\u1932'
  1048. | [\u1933-\u1938]
  1049. | [\u1939-\u193B]
  1050. | [\u1946-\u194F]
  1051. | [\u19B0-\u19C0]
  1052. | [\u19C8-\u19C9]
  1053. | [\u19D0-\u19D9]
  1054. | [\u1A17-\u1A18]
  1055. | [\u1A19-\u1A1B]
  1056. | [\u1DC0-\u1DC3]
  1057. | [\u203F-\u2040]
  1058. | '\u2054'
  1059. | [\u20D0-\u20DC]
  1060. | '\u20E1'
  1061. | [\u20E5-\u20EB]
  1062. | [\u302A-\u302F]
  1063. | [\u3099-\u309A]
  1064. | '\uA802'
  1065. | '\uA806'
  1066. | '\uA80B'
  1067. | [\uA823-\uA824]
  1068. | [\uA825-\uA826]
  1069. | '\uA827'
  1070. | '\uFB1E'
  1071. | [\uFE00-\uFE0F]
  1072. | [\uFE20-\uFE23]
  1073. | [\uFE33-\uFE34]
  1074. | [\uFE4D-\uFE4F]
  1075. | [\uFF10-\uFF19]
  1076. | '\uFF3F'
  1077. ;