rapydscript-ng 0.7.24 → 0.8.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +80 -26
  3. package/bin/build.ts +117 -0
  4. package/bin/package.json +1 -0
  5. package/bin/rapydscript +65 -62
  6. package/build_wheels.py +133 -0
  7. package/editor-plugins/README.md +80 -0
  8. package/editor-plugins/nvim.lua +321 -0
  9. package/local-agent.md +28 -0
  10. package/package.json +4 -5
  11. package/publish.py +27 -17
  12. package/release/baselib-plain-pretty.js +448 -326
  13. package/release/baselib-plain-ugly.js +3 -3
  14. package/release/compiler.js +9027 -8139
  15. package/release/signatures.json +27 -27
  16. package/release/stdlib_modules.json +1 -0
  17. package/src/ast.pyj +428 -280
  18. package/src/baselib-builtins.pyj +49 -28
  19. package/src/baselib-containers.pyj +241 -226
  20. package/src/baselib-errors.pyj +8 -1
  21. package/src/baselib-internal.pyj +38 -23
  22. package/src/baselib-itertools.pyj +13 -7
  23. package/src/baselib-str.pyj +59 -84
  24. package/src/compiler.pyj +4 -4
  25. package/src/errors.pyj +3 -4
  26. package/src/lib/aes.pyj +46 -32
  27. package/src/lib/elementmaker.pyj +11 -9
  28. package/src/lib/encodings.pyj +15 -5
  29. package/src/lib/gettext.pyj +9 -4
  30. package/src/lib/math.pyj +106 -45
  31. package/src/lib/operator.pyj +10 -10
  32. package/src/lib/pythonize.pyj +2 -1
  33. package/src/lib/random.pyj +28 -21
  34. package/src/lib/re.pyj +492 -19
  35. package/src/lib/traceback.pyj +171 -29
  36. package/src/lib/uuid.pyj +2 -2
  37. package/src/output/classes.pyj +28 -27
  38. package/src/output/codegen.pyj +87 -83
  39. package/src/output/comments.pyj +8 -8
  40. package/src/output/exceptions.pyj +20 -21
  41. package/src/output/functions.pyj +66 -64
  42. package/src/output/literals.pyj +24 -23
  43. package/src/output/loops.pyj +84 -142
  44. package/src/output/modules.pyj +55 -68
  45. package/src/output/operators.pyj +40 -29
  46. package/src/output/statements.pyj +21 -15
  47. package/src/output/stream.pyj +82 -56
  48. package/src/output/utils.pyj +12 -8
  49. package/src/parse.pyj +971 -620
  50. package/src/string_interpolation.pyj +5 -3
  51. package/src/tokenizer.pyj +188 -148
  52. package/src/utils.pyj +32 -15
  53. package/test/_treeshake_mod.pyj +30 -0
  54. package/test/_treeshake_side_effect.pyj +9 -0
  55. package/test/ast_serialization.pyj +392 -0
  56. package/test/async.pyj +95 -0
  57. package/test/baselib.pyj +1 -2
  58. package/test/embedded_compiler.pyj +57 -0
  59. package/test/fmt.pyj +291 -0
  60. package/test/generic.pyj +16 -3
  61. package/test/imports.pyj +8 -6
  62. package/test/internationalization.pyj +38 -37
  63. package/test/lint.pyj +120 -117
  64. package/test/lsp.pyj +257 -0
  65. package/test/repl.pyj +70 -65
  66. package/test/sourcemaps.pyj +315 -0
  67. package/test/starargs.pyj +46 -39
  68. package/test/str.pyj +8 -0
  69. package/test/traceback.pyj +263 -0
  70. package/test/treeshaking.pyj +181 -0
  71. package/test/web_repl_export.pyj +88 -0
  72. package/tools/ast_serialize.mjs +557 -0
  73. package/tools/cli.mjs +531 -0
  74. package/tools/compile.mjs +205 -0
  75. package/tools/compiler.mjs +159 -0
  76. package/tools/{completer.js → completer.mjs} +6 -6
  77. package/tools/{embedded_compiler.js → embedded_compiler.mjs} +17 -13
  78. package/tools/export.js +109 -56
  79. package/tools/fmt.mjs +975 -0
  80. package/tools/{gettext.js → gettext.mjs} +46 -53
  81. package/tools/ini.mjs +175 -0
  82. package/tools/{lint.js → lint.mjs} +78 -55
  83. package/tools/lsp.mjs +964 -0
  84. package/tools/lsp_protocol.mjs +259 -0
  85. package/tools/lsp_symbols.mjs +418 -0
  86. package/tools/{msgfmt.js → msgfmt.mjs} +18 -18
  87. package/tools/{repl.js → repl.mjs} +56 -42
  88. package/tools/{self.js → self.mjs} +71 -46
  89. package/tools/sourcemap.mjs +123 -0
  90. package/tools/test.mjs +252 -0
  91. package/tools/treeshake.mjs +400 -0
  92. package/tools/{utils.js → utils.mjs} +26 -23
  93. package/tools/{web_repl.js → web_repl.mjs} +15 -13
  94. package/tools/web_repl_export.mjs +97 -0
  95. package/tree-sitter/README.md +101 -0
  96. package/tree-sitter/grammar.js +992 -0
  97. package/tree-sitter/package.json +43 -0
  98. package/tree-sitter/queries/highlights.scm +232 -0
  99. package/tree-sitter/queries/indents.scm +64 -0
  100. package/tree-sitter/queries/injections.scm +14 -0
  101. package/tree-sitter/queries/locals.scm +108 -0
  102. package/tree-sitter/src/grammar.json +4976 -0
  103. package/tree-sitter/src/node-types.json +2901 -0
  104. package/tree-sitter/src/parser.c +196465 -0
  105. package/tree-sitter/src/scanner.c +294 -0
  106. package/tree-sitter/src/tree_sitter/alloc.h +54 -0
  107. package/tree-sitter/src/tree_sitter/array.h +330 -0
  108. package/tree-sitter/src/tree_sitter/parser.h +286 -0
  109. package/tree-sitter/test/corpus/chaining.txt +99 -0
  110. package/tree-sitter/test/corpus/classes.txt +147 -0
  111. package/tree-sitter/test/corpus/comprehensions.txt +155 -0
  112. package/tree-sitter/test/corpus/containers.txt +242 -0
  113. package/tree-sitter/test/corpus/control_flow.txt +361 -0
  114. package/tree-sitter/test/corpus/decorators.txt +64 -0
  115. package/tree-sitter/test/corpus/existential.txt +102 -0
  116. package/tree-sitter/test/corpus/functions.txt +293 -0
  117. package/tree-sitter/test/corpus/imports.txt +117 -0
  118. package/tree-sitter/test/corpus/literals.txt +135 -0
  119. package/tree-sitter/test/corpus/operators.txt +296 -0
  120. package/tree-sitter/test/corpus/statements.txt +189 -0
  121. package/tree-sitter/test/corpus/strings.txt +90 -0
  122. package/tree-sitter/test/corpus/subscripts.txt +227 -0
  123. package/tree-sitter/tree-sitter.json +36 -0
  124. package/web-repl/env.js +35 -23
  125. package/web-repl/main.js +8 -8
  126. package/bin/export +0 -75
  127. package/bin/web-repl-export +0 -102
  128. package/tools/cli.js +0 -523
  129. package/tools/compile.js +0 -184
  130. package/tools/compiler.js +0 -84
  131. package/tools/ini.js +0 -65
  132. package/tools/test.js +0 -110
package/src/lib/re.pyj CHANGED
@@ -3,19 +3,479 @@
3
3
  # Copyright: 2015, Kovid Goyal <kovid at kovidgoyal.net>
4
4
  # Copyright: 2013, Alexander Tsepkov
5
5
 
6
- # globals: ρσ_iterator_symbol, ρσ_list_decorate
6
+ # globals: ρσ_iterator_symbol
7
7
 
8
8
  # basic implementation of Python's 're' library
9
9
 
10
10
  from __python__ import bound_methods
11
11
 
12
12
  # Alias DB from http://www.unicode.org/Public/8.0.0/ucd/NameAliases.txt {{{
13
- _ALIAS_MAP = {"null":0,"nul":0,"start of heading":1,"soh":1,"start of text":2,"stx":2,"end of text":3,"etx":3,"end of transmission":4,"eot":4,"enquiry":5,"enq":5,"acknowledge":6,"ack":6,"alert":7,"bel":7,"backspace":8,"bs":8,"character tabulation":9,"horizontal tabulation":9,"ht":9,"tab":9,"line feed":10,"new line":10,"end of line":10,"lf":10,"nl":10,"eol":10,"line tabulation":11,"vertical tabulation":11,"vt":11,"form feed":12,"ff":12,"carriage return":13,"cr":13,"shift out":14,"locking-shift one":14,"so":14,"shift in":15,"locking-shift zero":15,"si":15,"data link escape":16,"dle":16,"device control one":17,"dc1":17,"device control two":18,"dc2":18,"device control three":19,"dc3":19,"device control four":20,"dc4":20,"negative acknowledge":21,"nak":21,"synchronous idle":22,"syn":22,"end of transmission block":23,"etb":23,"cancel":24,"can":24,"end of medium":25,"eom":25,"substitute":26,"sub":26,"escape":27,"esc":27,"information separator four":28,"file separator":28,"fs":28,"information separator three":29,"group separator":29,"gs":29,"information separator two":30,"record separator":30,"rs":30,"information separator one":31,"unit separator":31,"us":31,"sp":32,"delete":127,"del":127,"padding character":128,"pad":128,"high octet preset":129,"hop":129,"break permitted here":130,"bph":130,"no break here":131,"nbh":131,"index":132,"ind":132,"next line":133,"nel":133,"start of selected area":134,"ssa":134,"end of selected area":135,"esa":135,"character tabulation set":136,"horizontal tabulation set":136,"hts":136,"character tabulation with justification":137,"horizontal tabulation with justification":137,"htj":137,"line tabulation set":138,"vertical tabulation set":138,"vts":138,"partial line forward":139,"partial line down":139,"pld":139,"partial line backward":140,"partial line up":140,"plu":140,"reverse line feed":141,"reverse index":141,"ri":141,"single shift two":142,"single-shift-2":142,"ss2":142,"single shift three":143,"single-shift-3":143,"ss3":143,"device control string":144,"dcs":144,"private use one":145,"private use-1":145,"pu1":145,"private use two":146,"private use-2":146,"pu2":146,"set transmit state":147,"sts":147,"cancel character":148,"cch":148,"message waiting":149,"mw":149,"start of guarded area":150,"start of protected area":150,"spa":150,"end of guarded area":151,"end of protected area":151,"epa":151,"start of string":152,"sos":152,"single graphic character introducer":153,"sgc":153,"single character introducer":154,"sci":154,"control sequence introducer":155,"csi":155,"string terminator":156,"st":156,"operating system command":157,"osc":157,"privacy message":158,"pm":158,"application program command":159,"apc":159,"nbsp":160,"shy":173,"latin capital letter gha":418,"latin small letter gha":419,"cgj":847,"alm":1564,"syriac sublinear colon skewed left":1801,"kannada letter llla":3294,"lao letter fo fon":3741,"lao letter fo fay":3743,"lao letter ro":3747,"lao letter lo":3749,"tibetan mark bka- shog gi mgo rgyan":4048,"fvs1":6155,"fvs2":6156,"fvs3":6157,"mvs":6158,"zwsp":8203,"zwnj":8204,"zwj":8205,"lrm":8206,"rlm":8207,"lre":8234,"rle":8235,"pdf":8236,"lro":8237,"rlo":8238,"nnbsp":8239,"mmsp":8287,"wj":8288,"lri":8294,"rli":8295,"fsi":8296,"pdi":8297,"weierstrass elliptic function":8472,"micr on us symbol":9288,"micr dash symbol":9289,"leftwards triangle-headed arrow with double vertical stroke":11130,"rightwards triangle-headed arrow with double vertical stroke":11132,"yi syllable iteration mark":40981,"presentation form for vertical right white lenticular bracket":65048,"vs1":65024,"vs2":65025,"vs3":65026,"vs4":65027,"vs5":65028,"vs6":65029,"vs7":65030,"vs8":65031,"vs9":65032,"vs10":65033,"vs11":65034,"vs12":65035,"vs13":65036,"vs14":65037,"vs15":65038,"vs16":65039,"byte order mark":65279,"bom":65279,"zwnbsp":65279,"cuneiform sign nu11 tenu":74452,"cuneiform sign nu11 over nu11 bur over bur":74453,"byzantine musical symbol fthora skliron chroma vasis":118981,"vs17":917760,"vs18":917761,"vs19":917762,"vs20":917763,"vs21":917764,"vs22":917765,"vs23":917766,"vs24":917767,"vs25":917768,"vs26":917769,"vs27":917770,"vs28":917771,"vs29":917772,"vs30":917773,"vs31":917774,"vs32":917775,"vs33":917776,"vs34":917777,"vs35":917778,"vs36":917779,"vs37":917780,"vs38":917781,"vs39":917782,"vs40":917783,"vs41":917784,"vs42":917785,"vs43":917786,"vs44":917787,"vs45":917788,"vs46":917789,"vs47":917790,"vs48":917791,"vs49":917792,"vs50":917793,"vs51":917794,"vs52":917795,"vs53":917796,"vs54":917797,"vs55":917798,"vs56":917799,"vs57":917800,"vs58":917801,"vs59":917802,"vs60":917803,"vs61":917804,"vs62":917805,"vs63":917806,"vs64":917807,"vs65":917808,"vs66":917809,"vs67":917810,"vs68":917811,"vs69":917812,"vs70":917813,"vs71":917814,"vs72":917815,"vs73":917816,"vs74":917817,"vs75":917818,"vs76":917819,"vs77":917820,"vs78":917821,"vs79":917822,"vs80":917823,"vs81":917824,"vs82":917825,"vs83":917826,"vs84":917827,"vs85":917828,"vs86":917829,"vs87":917830,"vs88":917831,"vs89":917832,"vs90":917833,"vs91":917834,"vs92":917835,"vs93":917836,"vs94":917837,"vs95":917838,"vs96":917839,"vs97":917840,"vs98":917841,"vs99":917842,"vs100":917843,"vs101":917844,"vs102":917845,"vs103":917846,"vs104":917847,"vs105":917848,"vs106":917849,"vs107":917850,"vs108":917851,"vs109":917852,"vs110":917853,"vs111":917854,"vs112":917855,"vs113":917856,"vs114":917857,"vs115":917858,"vs116":917859,"vs117":917860,"vs118":917861,"vs119":917862,"vs120":917863,"vs121":917864,"vs122":917865,"vs123":917866,"vs124":917867,"vs125":917868,"vs126":917869,"vs127":917870,"vs128":917871,"vs129":917872,"vs130":917873,"vs131":917874,"vs132":917875,"vs133":917876,"vs134":917877,"vs135":917878,"vs136":917879,"vs137":917880,"vs138":917881,"vs139":917882,"vs140":917883,"vs141":917884,"vs142":917885,"vs143":917886,"vs144":917887,"vs145":917888,"vs146":917889,"vs147":917890,"vs148":917891,"vs149":917892,"vs150":917893,"vs151":917894,"vs152":917895,"vs153":917896,"vs154":917897,"vs155":917898,"vs156":917899,"vs157":917900,"vs158":917901,"vs159":917902,"vs160":917903,"vs161":917904,"vs162":917905,"vs163":917906,"vs164":917907,"vs165":917908,"vs166":917909,"vs167":917910,"vs168":917911,"vs169":917912,"vs170":917913,"vs171":917914,"vs172":917915,"vs173":917916,"vs174":917917,"vs175":917918,"vs176":917919,"vs177":917920,"vs178":917921,"vs179":917922,"vs180":917923,"vs181":917924,"vs182":917925,"vs183":917926,"vs184":917927,"vs185":917928,"vs186":917929,"vs187":917930,"vs188":917931,"vs189":917932,"vs190":917933,"vs191":917934,"vs192":917935,"vs193":917936,"vs194":917937,"vs195":917938,"vs196":917939,"vs197":917940,"vs198":917941,"vs199":917942,"vs200":917943,"vs201":917944,"vs202":917945,"vs203":917946,"vs204":917947,"vs205":917948,"vs206":917949,"vs207":917950,"vs208":917951,"vs209":917952,"vs210":917953,"vs211":917954,"vs212":917955,"vs213":917956,"vs214":917957,"vs215":917958,"vs216":917959,"vs217":917960,"vs218":917961,"vs219":917962,"vs220":917963,"vs221":917964,"vs222":917965,"vs223":917966,"vs224":917967,"vs225":917968,"vs226":917969,"vs227":917970,"vs228":917971,"vs229":917972,"vs230":917973,"vs231":917974,"vs232":917975,"vs233":917976,"vs234":917977,"vs235":917978,"vs236":917979,"vs237":917980,"vs238":917981,"vs239":917982,"vs240":917983,"vs241":917984,"vs242":917985,"vs243":917986,"vs244":917987,"vs245":917988,"vs246":917989,"vs247":917990,"vs248":917991,"vs249":917992,"vs250":917993,"vs251":917994,"vs252":917995,"vs253":917996,"vs254":917997,"vs255":917998,"vs256":917999}
13
+ _ALIAS_MAP = {
14
+ 'null': 0,
15
+ 'nul': 0,
16
+ 'start of heading': 1,
17
+ 'soh': 1,
18
+ 'start of text': 2,
19
+ 'stx': 2,
20
+ 'end of text': 3,
21
+ 'etx': 3,
22
+ 'end of transmission': 4,
23
+ 'eot': 4,
24
+ 'enquiry': 5,
25
+ 'enq': 5,
26
+ 'acknowledge': 6,
27
+ 'ack': 6,
28
+ 'alert': 7,
29
+ 'bel': 7,
30
+ 'backspace': 8,
31
+ 'bs': 8,
32
+ 'character tabulation': 9,
33
+ 'horizontal tabulation': 9,
34
+ 'ht': 9,
35
+ 'tab': 9,
36
+ 'line feed': 10,
37
+ 'new line': 10,
38
+ 'end of line': 10,
39
+ 'lf': 10,
40
+ 'nl': 10,
41
+ 'eol': 10,
42
+ 'line tabulation': 11,
43
+ 'vertical tabulation': 11,
44
+ 'vt': 11,
45
+ 'form feed': 12,
46
+ 'ff': 12,
47
+ 'carriage return': 13,
48
+ 'cr': 13,
49
+ 'shift out': 14,
50
+ 'locking-shift one': 14,
51
+ 'so': 14,
52
+ 'shift in': 15,
53
+ 'locking-shift zero': 15,
54
+ 'si': 15,
55
+ 'data link escape': 16,
56
+ 'dle': 16,
57
+ 'device control one': 17,
58
+ 'dc1': 17,
59
+ 'device control two': 18,
60
+ 'dc2': 18,
61
+ 'device control three': 19,
62
+ 'dc3': 19,
63
+ 'device control four': 20,
64
+ 'dc4': 20,
65
+ 'negative acknowledge': 21,
66
+ 'nak': 21,
67
+ 'synchronous idle': 22,
68
+ 'syn': 22,
69
+ 'end of transmission block': 23,
70
+ 'etb': 23,
71
+ 'cancel': 24,
72
+ 'can': 24,
73
+ 'end of medium': 25,
74
+ 'eom': 25,
75
+ 'substitute': 26,
76
+ 'sub': 26,
77
+ 'escape': 27,
78
+ 'esc': 27,
79
+ 'information separator four': 28,
80
+ 'file separator': 28,
81
+ 'fs': 28,
82
+ 'information separator three': 29,
83
+ 'group separator': 29,
84
+ 'gs': 29,
85
+ 'information separator two': 30,
86
+ 'record separator': 30,
87
+ 'rs': 30,
88
+ 'information separator one': 31,
89
+ 'unit separator': 31,
90
+ 'us': 31,
91
+ 'sp': 32,
92
+ 'delete': 127,
93
+ 'del': 127,
94
+ 'padding character': 128,
95
+ 'pad': 128,
96
+ 'high octet preset': 129,
97
+ 'hop': 129,
98
+ 'break permitted here': 130,
99
+ 'bph': 130,
100
+ 'no break here': 131,
101
+ 'nbh': 131,
102
+ 'index': 132,
103
+ 'ind': 132,
104
+ 'next line': 133,
105
+ 'nel': 133,
106
+ 'start of selected area': 134,
107
+ 'ssa': 134,
108
+ 'end of selected area': 135,
109
+ 'esa': 135,
110
+ 'character tabulation set': 136,
111
+ 'horizontal tabulation set': 136,
112
+ 'hts': 136,
113
+ 'character tabulation with justification': 137,
114
+ 'horizontal tabulation with justification': 137,
115
+ 'htj': 137,
116
+ 'line tabulation set': 138,
117
+ 'vertical tabulation set': 138,
118
+ 'vts': 138,
119
+ 'partial line forward': 139,
120
+ 'partial line down': 139,
121
+ 'pld': 139,
122
+ 'partial line backward': 140,
123
+ 'partial line up': 140,
124
+ 'plu': 140,
125
+ 'reverse line feed': 141,
126
+ 'reverse index': 141,
127
+ 'ri': 141,
128
+ 'single shift two': 142,
129
+ 'single-shift-2': 142,
130
+ 'ss2': 142,
131
+ 'single shift three': 143,
132
+ 'single-shift-3': 143,
133
+ 'ss3': 143,
134
+ 'device control string': 144,
135
+ 'dcs': 144,
136
+ 'private use one': 145,
137
+ 'private use-1': 145,
138
+ 'pu1': 145,
139
+ 'private use two': 146,
140
+ 'private use-2': 146,
141
+ 'pu2': 146,
142
+ 'set transmit state': 147,
143
+ 'sts': 147,
144
+ 'cancel character': 148,
145
+ 'cch': 148,
146
+ 'message waiting': 149,
147
+ 'mw': 149,
148
+ 'start of guarded area': 150,
149
+ 'start of protected area': 150,
150
+ 'spa': 150,
151
+ 'end of guarded area': 151,
152
+ 'end of protected area': 151,
153
+ 'epa': 151,
154
+ 'start of string': 152,
155
+ 'sos': 152,
156
+ 'single graphic character introducer': 153,
157
+ 'sgc': 153,
158
+ 'single character introducer': 154,
159
+ 'sci': 154,
160
+ 'control sequence introducer': 155,
161
+ 'csi': 155,
162
+ 'string terminator': 156,
163
+ 'st': 156,
164
+ 'operating system command': 157,
165
+ 'osc': 157,
166
+ 'privacy message': 158,
167
+ 'pm': 158,
168
+ 'application program command': 159,
169
+ 'apc': 159,
170
+ 'nbsp': 160,
171
+ 'shy': 173,
172
+ 'latin capital letter gha': 418,
173
+ 'latin small letter gha': 419,
174
+ 'cgj': 847,
175
+ 'alm': 1564,
176
+ 'syriac sublinear colon skewed left': 1801,
177
+ 'kannada letter llla': 3294,
178
+ 'lao letter fo fon': 3741,
179
+ 'lao letter fo fay': 3743,
180
+ 'lao letter ro': 3747,
181
+ 'lao letter lo': 3749,
182
+ 'tibetan mark bka- shog gi mgo rgyan': 4048,
183
+ 'fvs1': 6155,
184
+ 'fvs2': 6156,
185
+ 'fvs3': 6157,
186
+ 'mvs': 6158,
187
+ 'zwsp': 8203,
188
+ 'zwnj': 8204,
189
+ 'zwj': 8205,
190
+ 'lrm': 8206,
191
+ 'rlm': 8207,
192
+ 'lre': 8234,
193
+ 'rle': 8235,
194
+ 'pdf': 8236,
195
+ 'lro': 8237,
196
+ 'rlo': 8238,
197
+ 'nnbsp': 8239,
198
+ 'mmsp': 8287,
199
+ 'wj': 8288,
200
+ 'lri': 8294,
201
+ 'rli': 8295,
202
+ 'fsi': 8296,
203
+ 'pdi': 8297,
204
+ 'weierstrass elliptic function': 8472,
205
+ 'micr on us symbol': 9288,
206
+ 'micr dash symbol': 9289,
207
+ 'leftwards triangle-headed arrow with double vertical stroke': 11130,
208
+ 'rightwards triangle-headed arrow with double vertical stroke': 11132,
209
+ 'yi syllable iteration mark': 40981,
210
+ 'presentation form for vertical right white lenticular bracket': 65048,
211
+ 'vs1': 65024,
212
+ 'vs2': 65025,
213
+ 'vs3': 65026,
214
+ 'vs4': 65027,
215
+ 'vs5': 65028,
216
+ 'vs6': 65029,
217
+ 'vs7': 65030,
218
+ 'vs8': 65031,
219
+ 'vs9': 65032,
220
+ 'vs10': 65033,
221
+ 'vs11': 65034,
222
+ 'vs12': 65035,
223
+ 'vs13': 65036,
224
+ 'vs14': 65037,
225
+ 'vs15': 65038,
226
+ 'vs16': 65039,
227
+ 'byte order mark': 65279,
228
+ 'bom': 65279,
229
+ 'zwnbsp': 65279,
230
+ 'cuneiform sign nu11 tenu': 74452,
231
+ 'cuneiform sign nu11 over nu11 bur over bur': 74453,
232
+ 'byzantine musical symbol fthora skliron chroma vasis': 118981,
233
+ 'vs17': 917760,
234
+ 'vs18': 917761,
235
+ 'vs19': 917762,
236
+ 'vs20': 917763,
237
+ 'vs21': 917764,
238
+ 'vs22': 917765,
239
+ 'vs23': 917766,
240
+ 'vs24': 917767,
241
+ 'vs25': 917768,
242
+ 'vs26': 917769,
243
+ 'vs27': 917770,
244
+ 'vs28': 917771,
245
+ 'vs29': 917772,
246
+ 'vs30': 917773,
247
+ 'vs31': 917774,
248
+ 'vs32': 917775,
249
+ 'vs33': 917776,
250
+ 'vs34': 917777,
251
+ 'vs35': 917778,
252
+ 'vs36': 917779,
253
+ 'vs37': 917780,
254
+ 'vs38': 917781,
255
+ 'vs39': 917782,
256
+ 'vs40': 917783,
257
+ 'vs41': 917784,
258
+ 'vs42': 917785,
259
+ 'vs43': 917786,
260
+ 'vs44': 917787,
261
+ 'vs45': 917788,
262
+ 'vs46': 917789,
263
+ 'vs47': 917790,
264
+ 'vs48': 917791,
265
+ 'vs49': 917792,
266
+ 'vs50': 917793,
267
+ 'vs51': 917794,
268
+ 'vs52': 917795,
269
+ 'vs53': 917796,
270
+ 'vs54': 917797,
271
+ 'vs55': 917798,
272
+ 'vs56': 917799,
273
+ 'vs57': 917800,
274
+ 'vs58': 917801,
275
+ 'vs59': 917802,
276
+ 'vs60': 917803,
277
+ 'vs61': 917804,
278
+ 'vs62': 917805,
279
+ 'vs63': 917806,
280
+ 'vs64': 917807,
281
+ 'vs65': 917808,
282
+ 'vs66': 917809,
283
+ 'vs67': 917810,
284
+ 'vs68': 917811,
285
+ 'vs69': 917812,
286
+ 'vs70': 917813,
287
+ 'vs71': 917814,
288
+ 'vs72': 917815,
289
+ 'vs73': 917816,
290
+ 'vs74': 917817,
291
+ 'vs75': 917818,
292
+ 'vs76': 917819,
293
+ 'vs77': 917820,
294
+ 'vs78': 917821,
295
+ 'vs79': 917822,
296
+ 'vs80': 917823,
297
+ 'vs81': 917824,
298
+ 'vs82': 917825,
299
+ 'vs83': 917826,
300
+ 'vs84': 917827,
301
+ 'vs85': 917828,
302
+ 'vs86': 917829,
303
+ 'vs87': 917830,
304
+ 'vs88': 917831,
305
+ 'vs89': 917832,
306
+ 'vs90': 917833,
307
+ 'vs91': 917834,
308
+ 'vs92': 917835,
309
+ 'vs93': 917836,
310
+ 'vs94': 917837,
311
+ 'vs95': 917838,
312
+ 'vs96': 917839,
313
+ 'vs97': 917840,
314
+ 'vs98': 917841,
315
+ 'vs99': 917842,
316
+ 'vs100': 917843,
317
+ 'vs101': 917844,
318
+ 'vs102': 917845,
319
+ 'vs103': 917846,
320
+ 'vs104': 917847,
321
+ 'vs105': 917848,
322
+ 'vs106': 917849,
323
+ 'vs107': 917850,
324
+ 'vs108': 917851,
325
+ 'vs109': 917852,
326
+ 'vs110': 917853,
327
+ 'vs111': 917854,
328
+ 'vs112': 917855,
329
+ 'vs113': 917856,
330
+ 'vs114': 917857,
331
+ 'vs115': 917858,
332
+ 'vs116': 917859,
333
+ 'vs117': 917860,
334
+ 'vs118': 917861,
335
+ 'vs119': 917862,
336
+ 'vs120': 917863,
337
+ 'vs121': 917864,
338
+ 'vs122': 917865,
339
+ 'vs123': 917866,
340
+ 'vs124': 917867,
341
+ 'vs125': 917868,
342
+ 'vs126': 917869,
343
+ 'vs127': 917870,
344
+ 'vs128': 917871,
345
+ 'vs129': 917872,
346
+ 'vs130': 917873,
347
+ 'vs131': 917874,
348
+ 'vs132': 917875,
349
+ 'vs133': 917876,
350
+ 'vs134': 917877,
351
+ 'vs135': 917878,
352
+ 'vs136': 917879,
353
+ 'vs137': 917880,
354
+ 'vs138': 917881,
355
+ 'vs139': 917882,
356
+ 'vs140': 917883,
357
+ 'vs141': 917884,
358
+ 'vs142': 917885,
359
+ 'vs143': 917886,
360
+ 'vs144': 917887,
361
+ 'vs145': 917888,
362
+ 'vs146': 917889,
363
+ 'vs147': 917890,
364
+ 'vs148': 917891,
365
+ 'vs149': 917892,
366
+ 'vs150': 917893,
367
+ 'vs151': 917894,
368
+ 'vs152': 917895,
369
+ 'vs153': 917896,
370
+ 'vs154': 917897,
371
+ 'vs155': 917898,
372
+ 'vs156': 917899,
373
+ 'vs157': 917900,
374
+ 'vs158': 917901,
375
+ 'vs159': 917902,
376
+ 'vs160': 917903,
377
+ 'vs161': 917904,
378
+ 'vs162': 917905,
379
+ 'vs163': 917906,
380
+ 'vs164': 917907,
381
+ 'vs165': 917908,
382
+ 'vs166': 917909,
383
+ 'vs167': 917910,
384
+ 'vs168': 917911,
385
+ 'vs169': 917912,
386
+ 'vs170': 917913,
387
+ 'vs171': 917914,
388
+ 'vs172': 917915,
389
+ 'vs173': 917916,
390
+ 'vs174': 917917,
391
+ 'vs175': 917918,
392
+ 'vs176': 917919,
393
+ 'vs177': 917920,
394
+ 'vs178': 917921,
395
+ 'vs179': 917922,
396
+ 'vs180': 917923,
397
+ 'vs181': 917924,
398
+ 'vs182': 917925,
399
+ 'vs183': 917926,
400
+ 'vs184': 917927,
401
+ 'vs185': 917928,
402
+ 'vs186': 917929,
403
+ 'vs187': 917930,
404
+ 'vs188': 917931,
405
+ 'vs189': 917932,
406
+ 'vs190': 917933,
407
+ 'vs191': 917934,
408
+ 'vs192': 917935,
409
+ 'vs193': 917936,
410
+ 'vs194': 917937,
411
+ 'vs195': 917938,
412
+ 'vs196': 917939,
413
+ 'vs197': 917940,
414
+ 'vs198': 917941,
415
+ 'vs199': 917942,
416
+ 'vs200': 917943,
417
+ 'vs201': 917944,
418
+ 'vs202': 917945,
419
+ 'vs203': 917946,
420
+ 'vs204': 917947,
421
+ 'vs205': 917948,
422
+ 'vs206': 917949,
423
+ 'vs207': 917950,
424
+ 'vs208': 917951,
425
+ 'vs209': 917952,
426
+ 'vs210': 917953,
427
+ 'vs211': 917954,
428
+ 'vs212': 917955,
429
+ 'vs213': 917956,
430
+ 'vs214': 917957,
431
+ 'vs215': 917958,
432
+ 'vs216': 917959,
433
+ 'vs217': 917960,
434
+ 'vs218': 917961,
435
+ 'vs219': 917962,
436
+ 'vs220': 917963,
437
+ 'vs221': 917964,
438
+ 'vs222': 917965,
439
+ 'vs223': 917966,
440
+ 'vs224': 917967,
441
+ 'vs225': 917968,
442
+ 'vs226': 917969,
443
+ 'vs227': 917970,
444
+ 'vs228': 917971,
445
+ 'vs229': 917972,
446
+ 'vs230': 917973,
447
+ 'vs231': 917974,
448
+ 'vs232': 917975,
449
+ 'vs233': 917976,
450
+ 'vs234': 917977,
451
+ 'vs235': 917978,
452
+ 'vs236': 917979,
453
+ 'vs237': 917980,
454
+ 'vs238': 917981,
455
+ 'vs239': 917982,
456
+ 'vs240': 917983,
457
+ 'vs241': 917984,
458
+ 'vs242': 917985,
459
+ 'vs243': 917986,
460
+ 'vs244': 917987,
461
+ 'vs245': 917988,
462
+ 'vs246': 917989,
463
+ 'vs247': 917990,
464
+ 'vs248': 917991,
465
+ 'vs249': 917992,
466
+ 'vs250': 917993,
467
+ 'vs251': 917994,
468
+ 'vs252': 917995,
469
+ 'vs253': 917996,
470
+ 'vs254': 917997,
471
+ 'vs255': 917998,
472
+ 'vs256': 917999,
473
+ }
14
474
  # }}}
15
475
 
16
- _ASCII_CONTROL_CHARS = {'a':7, 'b':8, 'f': 12, 'n': 10, 'r': 13, 't': 9, 'v': 11}
476
+ _ASCII_CONTROL_CHARS = {'a': 7, 'b': 8, 'f': 12, 'n': 10, 'r': 13, 't': 9, 'v': 11}
17
477
  _HEX_PAT = /^[a-fA-F0-9]/
18
- _NUM_PAT = /^[0-9]/
478
+ _NUM_PAT = /^[0-9]/
19
479
  _GROUP_PAT = /<([^>]+)>/
20
480
  _NAME_PAT = /^[a-zA-Z ]/
21
481
 
@@ -38,6 +498,7 @@ _re_cache_items = v'[]'
38
498
  error = SyntaxError # This is the error JS throws for invalid regexps
39
499
  has_prop = Object.prototype.hasOwnProperty.call.bind(Object.prototype.hasOwnProperty)
40
500
 
501
+
41
502
  def _expand(groups, repl, group_name_map):
42
503
  i = 0
43
504
 
@@ -103,7 +564,7 @@ def _expand(groups, repl, group_name_map):
103
564
  if code <= 0xFFFF:
104
565
  return String.fromCharCode(code)
105
566
  code -= 0x10000
106
- return String.fromCharCode(0xD800+(code>>10), 0xDC00+(code&0x3FF))
567
+ return String.fromCharCode(0xD800 + (code >> 10), 0xDC00 + (code & 0x3FF))
107
568
  return '\\U' + code
108
569
  if q is 'N' and peek() is '{':
109
570
  next()
@@ -120,7 +581,7 @@ def _expand(groups, repl, group_name_map):
120
581
  if code <= 0xFFFF:
121
582
  return String.fromCharCode(code)
122
583
  code -= 0x10000
123
- return String.fromCharCode(0xD800+(code>>10), 0xDC00+(code&0x3FF))
584
+ return String.fromCharCode(0xD800 + (code >> 10), 0xDC00 + (code & 0x3FF))
124
585
 
125
586
  return '\\' + q
126
587
 
@@ -135,6 +596,7 @@ def _expand(groups, repl, group_name_map):
135
596
  ans += ch
136
597
  return ans
137
598
 
599
+
138
600
  def transform_regex(source, flags):
139
601
  pos = 0
140
602
  previous_backslash = in_class = False
@@ -175,11 +637,11 @@ def transform_regex(source, flags):
175
637
  pos = close + 1
176
638
  continue
177
639
  if 'aiLmsux'.indexOf(extension) is not -1:
178
- flag_map = {'a':ASCII, 'i':IGNORECASE, 'L':LOCALE, 'm':MULTILINE, 's':DOTALL, 'u':UNICODE, 'x':VERBOSE}
640
+ flag_map = {'a': ASCII, 'i': IGNORECASE, 'L': LOCALE, 'm': MULTILINE, 's': DOTALL, 'u': UNICODE, 'x': VERBOSE}
179
641
  close = source.indexOf(')', pos + 1)
180
642
  if close is -1:
181
643
  raise SyntaxError('Expecting a closing )')
182
- flgs = source[pos+1:close]
644
+ flgs = source[pos + 1:close]
183
645
  for v'var i = 0; i < flgs.length; i++':
184
646
  q = flgs[i] # noqa:undef
185
647
  if not has_prop(flag_map, q):
@@ -196,7 +658,7 @@ def transform_regex(source, flags):
196
658
  close = source.indexOf('>', pos)
197
659
  if close is -1:
198
660
  raise SyntaxError('Named group not closed, expecting >')
199
- name = source[pos+1:close]
661
+ name = source[pos + 1:close]
200
662
  if not has_prop(group_map, name):
201
663
  group_map[name] = v'[]'
202
664
  group_map[name].push(v'++group_count')
@@ -205,7 +667,7 @@ def transform_regex(source, flags):
205
667
  close = source.indexOf(')', pos)
206
668
  if close is -1:
207
669
  raise SyntaxError('Named group back-reference not closed, expecting a )')
208
- name = source[pos+1:close]
670
+ name = source[pos + 1:close]
209
671
  if not isNaN(parseInt(name, 10)):
210
672
  ans += '\\' + name
211
673
  else:
@@ -226,8 +688,8 @@ def transform_regex(source, flags):
226
688
 
227
689
  return ans, flags, group_map
228
690
 
229
- class MatchObject:
230
691
 
692
+ class MatchObject:
231
693
  def __init__(self, regex, match, pos, endpos):
232
694
  self.re = regex
233
695
  self.string = match.input
@@ -249,12 +711,12 @@ class MatchObject:
249
711
  g = match[i]
250
712
  loc = extent.indexOf(g, loc)
251
713
  if loc is -1:
252
- self._start[i] = self._start[i-1]
253
- self._end[i] = self._end[i-1]
714
+ self._start[i] = self._start[i - 1]
715
+ self._end[i] = self._end[i - 1]
254
716
  else:
255
717
  self._start[i] = offset + loc
256
718
  loc += g.length
257
- self._end[i] = offset + loc # noqa:undef
719
+ self._end[i] = offset + loc # noqa:undef
258
720
 
259
721
  def groups(self, defval=None):
260
722
  ans = v'[]'
@@ -347,8 +809,8 @@ class MatchObject:
347
809
  ans[name] = self.captures(name)
348
810
  return ans
349
811
 
350
- class RegexObject:
351
812
 
813
+ class RegexObject:
352
814
  def __init__(self, pattern, flags):
353
815
  self.pattern = pattern.source if isinstance(pattern, RegExp) else pattern
354
816
  self.js_pattern, self.flags, self.group_name_map = transform_regex(self.pattern, flags)
@@ -384,15 +846,15 @@ class RegexObject:
384
846
 
385
847
  def findall(self, string):
386
848
  self._pattern.lastIndex = 0
387
- return ρσ_list_decorate(string.match(self._pattern) or v'[]')
849
+ return string.match(self._pattern) or v'[]'
388
850
 
389
851
  def finditer(self, string):
390
852
  # We have to copy pat since lastIndex is mutable
391
853
  pat = RegExp(this._pattern.source, this._modifiers) # noqa: unused-local
392
854
  ans = v"{'_string':string, '_r':pat, '_self':self}"
393
- ans[ρσ_iterator_symbol] = def():
855
+ ans[ρσ_iterator_symbol] = def ():
394
856
  return this
395
- ans['next'] = def():
857
+ ans['next'] = def ():
396
858
  m = this._r.exec(this._string)
397
859
  if m is None:
398
860
  return v"{'done':true}"
@@ -402,7 +864,7 @@ class RegexObject:
402
864
  def subn(self, repl, string, count=0):
403
865
  expand = _expand
404
866
  if jstype(repl) is 'function':
405
- expand = def(m, repl, gnm): return '' + repl(MatchObject(self, m, 0, None))
867
+ expand = def (m, repl, gnm): return '' + repl(MatchObject(self, m, 0, None))
406
868
  this._pattern.lastIndex = 0
407
869
  num = 0
408
870
  matches = v'[]'
@@ -424,6 +886,7 @@ class RegexObject:
424
886
  def sub(self, repl, string, count=0):
425
887
  return self.subn(repl, string, count)[0]
426
888
 
889
+
427
890
  def _get_from_cache(pattern, flags):
428
891
  if isinstance(pattern, RegExp):
429
892
  pattern = pattern.source
@@ -437,33 +900,43 @@ def _get_from_cache(pattern, flags):
437
900
  _re_cache_items.push(key)
438
901
  return ans
439
902
 
903
+
440
904
  def compile(pattern, flags=0):
441
905
  return _get_from_cache(pattern, flags)
442
906
 
907
+
443
908
  def search(pattern, string, flags=0):
444
909
  return _get_from_cache(pattern, flags).search(string)
445
910
 
911
+
446
912
  def match(pattern, string, flags=0):
447
913
  return _get_from_cache(pattern, flags).match(string)
448
914
 
915
+
449
916
  def split(pattern, string, maxsplit=0, flags=0):
450
917
  return _get_from_cache(pattern, flags).split(string)
451
918
 
919
+
452
920
  def findall(pattern, string, flags=0):
453
921
  return _get_from_cache(pattern, flags).findall(string)
454
922
 
923
+
455
924
  def finditer(pattern, string, flags=0):
456
925
  return _get_from_cache(pattern, flags).finditer(string)
457
926
 
927
+
458
928
  def sub(pattern, repl, string, count=0, flags=0):
459
929
  return _get_from_cache(pattern, flags).sub(repl, string, count)
460
930
 
931
+
461
932
  def subn(pattern, repl, string, count=0, flags=0):
462
933
  return _get_from_cache(pattern, flags).subn(repl, string, count)
463
934
 
935
+
464
936
  def escape(string):
465
937
  return string.replace(_RE_ESCAPE, '\\$&')
466
938
 
939
+
467
940
  def purge():
468
941
  nonlocal _re_cache_map, _re_cache_items
469
942
  _re_cache_map = {}