repl-sdk 0.0.0 → 1.0.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.
- package/dist/apl-fqmucPXA.js +141 -0
- package/dist/apl-fqmucPXA.js.map +1 -0
- package/dist/asciiarmor-DucZyvP0.js +57 -0
- package/dist/asciiarmor-DucZyvP0.js.map +1 -0
- package/dist/asn1-BnOEsgAm.js +145 -0
- package/dist/asn1-BnOEsgAm.js.map +1 -0
- package/dist/assets/tar-worker-CxTcoQcr.js +593 -0
- package/dist/assets/tar-worker-CxTcoQcr.js.map +1 -0
- package/dist/asterisk-QAlztEwS.js +346 -0
- package/dist/asterisk-QAlztEwS.js.map +1 -0
- package/dist/brainfuck-DZVCuF_t.js +54 -0
- package/dist/brainfuck-DZVCuF_t.js.map +1 -0
- package/dist/clike-CTYGlS6x.js +800 -0
- package/dist/clike-CTYGlS6x.js.map +1 -0
- package/dist/clojure-BhXMqnxz.js +850 -0
- package/dist/clojure-BhXMqnxz.js.map +1 -0
- package/dist/cmake-BGaNd9E7.js +72 -0
- package/dist/cmake-BGaNd9E7.js.map +1 -0
- package/dist/cobol-4yqQntpt.js +121 -0
- package/dist/cobol-4yqQntpt.js.map +1 -0
- package/dist/codemirror-De3S70Np.js +2912 -0
- package/dist/codemirror-De3S70Np.js.map +1 -0
- package/dist/coffeescript-D2dXvhEc.js +309 -0
- package/dist/coffeescript-D2dXvhEc.js.map +1 -0
- package/dist/commonlisp-CF_VNHQR.js +131 -0
- package/dist/commonlisp-CF_VNHQR.js.map +1 -0
- package/dist/crystal-DyuLTqLs.js +399 -0
- package/dist/crystal-DyuLTqLs.js.map +1 -0
- package/dist/css-DkSyTW67.js +1773 -0
- package/dist/css-DkSyTW67.js.map +1 -0
- package/dist/cypher-Dlu_3r4V.js +122 -0
- package/dist/cypher-Dlu_3r4V.js.map +1 -0
- package/dist/d-UURgV0Ux.js +180 -0
- package/dist/d-UURgV0Ux.js.map +1 -0
- package/dist/diff-B_Bi2Crb.js +26 -0
- package/dist/diff-B_Bi2Crb.js.map +1 -0
- package/dist/dockerfile-Bvk733Ga.js +202 -0
- package/dist/dockerfile-Bvk733Ga.js.map +1 -0
- package/dist/dtd-Dy74G54E.js +115 -0
- package/dist/dtd-Dy74G54E.js.map +1 -0
- package/dist/dylan-TSb-Nfix.js +315 -0
- package/dist/dylan-TSb-Nfix.js.map +1 -0
- package/dist/ebnf-4fKAGW3a.js +141 -0
- package/dist/ebnf-4fKAGW3a.js.map +1 -0
- package/dist/ecl-B59qGGVg.js +179 -0
- package/dist/ecl-B59qGGVg.js.map +1 -0
- package/dist/eiffel-Dze7nlu3.js +135 -0
- package/dist/eiffel-Dze7nlu3.js.map +1 -0
- package/dist/elm-DG7jkhNZ.js +177 -0
- package/dist/elm-DG7jkhNZ.js.map +1 -0
- package/dist/erlang-BO6gOnGA.js +675 -0
- package/dist/erlang-BO6gOnGA.js.map +1 -0
- package/dist/factor-CMxFHDqz.js +66 -0
- package/dist/factor-CMxFHDqz.js.map +1 -0
- package/dist/fcl-CDDUNjTj.js +142 -0
- package/dist/fcl-CDDUNjTj.js.map +1 -0
- package/dist/forth-B9D2JCeE.js +117 -0
- package/dist/forth-B9D2JCeE.js.map +1 -0
- package/dist/fortran-CAG2BFbe.js +468 -0
- package/dist/fortran-CAG2BFbe.js.map +1 -0
- package/dist/gas-0Aw8zDr5.js +294 -0
- package/dist/gas-0Aw8zDr5.js.map +1 -0
- package/dist/gherkin-DhZlEZiy.js +116 -0
- package/dist/gherkin-DhZlEZiy.js.map +1 -0
- package/dist/gjs-DfguZDLq.js +173 -0
- package/dist/gjs-DfguZDLq.js.map +1 -0
- package/dist/gmd-Yas-Oo8k.js +163 -0
- package/dist/gmd-Yas-Oo8k.js.map +1 -0
- package/dist/groovy-CpwJiBl7.js +224 -0
- package/dist/groovy-CpwJiBl7.js.map +1 -0
- package/dist/haskell-ySd-OUo8.js +460 -0
- package/dist/haskell-ySd-OUo8.js.map +1 -0
- package/dist/haxe-7MlzfeYV.js +515 -0
- package/dist/haxe-7MlzfeYV.js.map +1 -0
- package/dist/hbs-CxcmWxSJ.js +62 -0
- package/dist/hbs-CxcmWxSJ.js.map +1 -0
- package/dist/http-BqypyemW.js +80 -0
- package/dist/http-BqypyemW.js.map +1 -0
- package/dist/idl-4HIGJlDI.js +986 -0
- package/dist/idl-4HIGJlDI.js.map +1 -0
- package/dist/index-B3Meoznj.js +118 -0
- package/dist/index-B3Meoznj.js.map +1 -0
- package/dist/index-BQyfDUUx.js +692 -0
- package/dist/index-BQyfDUUx.js.map +1 -0
- package/dist/index-BRDroAD8.js +305 -0
- package/dist/index-BRDroAD8.js.map +1 -0
- package/dist/index-BRMAzRyM.js +179 -0
- package/dist/index-BRMAzRyM.js.map +1 -0
- package/dist/index-Bb8uYQgv.js +927 -0
- package/dist/index-Bb8uYQgv.js.map +1 -0
- package/dist/index-BlOjO66K.js +17618 -0
- package/dist/index-BlOjO66K.js.map +1 -0
- package/dist/index-BoGWnSNL.js +706 -0
- package/dist/index-BoGWnSNL.js.map +1 -0
- package/dist/index-BsRrEiOu.js +98 -0
- package/dist/index-BsRrEiOu.js.map +1 -0
- package/dist/index-C2sFZMth.js +391 -0
- package/dist/index-C2sFZMth.js.map +1 -0
- package/dist/index-C7xwOjmS.js +291 -0
- package/dist/index-C7xwOjmS.js.map +1 -0
- package/dist/index-CA3lFUx6.js +315 -0
- package/dist/index-CA3lFUx6.js.map +1 -0
- package/dist/index-CB-pPTIf.js +98 -0
- package/dist/index-CB-pPTIf.js.map +1 -0
- package/dist/index-CCa6x1FE.js +386 -0
- package/dist/index-CCa6x1FE.js.map +1 -0
- package/dist/index-CD4DINI1.js +158 -0
- package/dist/index-CD4DINI1.js.map +1 -0
- package/dist/index-CE0B_fcG.js +328 -0
- package/dist/index-CE0B_fcG.js.map +1 -0
- package/dist/index-CVGAEPMV.js +2139 -0
- package/dist/index-CVGAEPMV.js.map +1 -0
- package/dist/index-CmaT2afn.js +332 -0
- package/dist/index-CmaT2afn.js.map +1 -0
- package/dist/index-D8sUxXp5.js +83 -0
- package/dist/index-D8sUxXp5.js.map +1 -0
- package/dist/index-DIz8Vpn-.js +737 -0
- package/dist/index-DIz8Vpn-.js.map +1 -0
- package/dist/index-DNP1xT-S.js +408 -0
- package/dist/index-DNP1xT-S.js.map +1 -0
- package/dist/index-DOAqdvnQ.js +862 -0
- package/dist/index-DOAqdvnQ.js.map +1 -0
- package/dist/index-DVUMFbgi.js +152 -0
- package/dist/index-DVUMFbgi.js.map +1 -0
- package/dist/index-VeTBKRVd.js +83 -0
- package/dist/index-VeTBKRVd.js.map +1 -0
- package/dist/index-dXZeR7Bx.js +1767 -0
- package/dist/index-dXZeR7Bx.js.map +1 -0
- package/dist/index-gtqbIb6T.js +62 -0
- package/dist/index-gtqbIb6T.js.map +1 -0
- package/dist/index-pN_pUAQ7.js +2426 -0
- package/dist/index-pN_pUAQ7.js.map +1 -0
- package/dist/index-wasu5VX0.js +1150 -0
- package/dist/index-wasu5VX0.js.map +1 -0
- package/dist/javascript-Bt8B7yTi.js +993 -0
- package/dist/javascript-Bt8B7yTi.js.map +1 -0
- package/dist/julia-Bs6JJhYG.js +408 -0
- package/dist/julia-Bs6JJhYG.js.map +1 -0
- package/dist/livescript-DmzgM3Yt.js +297 -0
- package/dist/livescript-DmzgM3Yt.js.map +1 -0
- package/dist/lua-8cJgIlqe.js +257 -0
- package/dist/lua-8cJgIlqe.js.map +1 -0
- package/dist/mathematica-DNLOL9PQ.js +111 -0
- package/dist/mathematica-DNLOL9PQ.js.map +1 -0
- package/dist/mbox-Ga7d4MMN.js +118 -0
- package/dist/mbox-Ga7d4MMN.js.map +1 -0
- package/dist/mirc-Dma3B8rS.js +108 -0
- package/dist/mirc-Dma3B8rS.js.map +1 -0
- package/dist/mllike-DHn7xckP.js +335 -0
- package/dist/mllike-DHn7xckP.js.map +1 -0
- package/dist/modelica-0d55jYY0.js +148 -0
- package/dist/modelica-0d55jYY0.js.map +1 -0
- package/dist/mscgen-DdqZYINH.js +136 -0
- package/dist/mscgen-DdqZYINH.js.map +1 -0
- package/dist/mumps-Btr8VblO.js +94 -0
- package/dist/mumps-Btr8VblO.js.map +1 -0
- package/dist/nginx-DTDtBDVN.js +142 -0
- package/dist/nginx-DTDtBDVN.js.map +1 -0
- package/dist/nsis-3zG7tgur.js +63 -0
- package/dist/nsis-3zG7tgur.js.map +1 -0
- package/dist/ntriples-CvgOYMpL.js +154 -0
- package/dist/ntriples-CvgOYMpL.js.map +1 -0
- package/dist/octave-DYBj3-tl.js +201 -0
- package/dist/octave-DYBj3-tl.js.map +1 -0
- package/dist/oz-R_e8WMIi.js +232 -0
- package/dist/oz-R_e8WMIi.js.map +1 -0
- package/dist/parse-CAqQaKsh.js +21685 -0
- package/dist/parse-CAqQaKsh.js.map +1 -0
- package/dist/pascal-GD8iposT.js +106 -0
- package/dist/pascal-GD8iposT.js.map +1 -0
- package/dist/perl-DL9mHpoi.js +1106 -0
- package/dist/perl-DL9mHpoi.js.map +1 -0
- package/dist/pig-C_4T4YIV.js +102 -0
- package/dist/pig-C_4T4YIV.js.map +1 -0
- package/dist/powershell-B0suO7Vd.js +329 -0
- package/dist/powershell-B0suO7Vd.js.map +1 -0
- package/dist/properties-BR-vP1aU.js +59 -0
- package/dist/properties-BR-vP1aU.js.map +1 -0
- package/dist/protobuf-BxgpyhoW.js +78 -0
- package/dist/protobuf-BxgpyhoW.js.map +1 -0
- package/dist/pug-vHnWR0UE.js +406 -0
- package/dist/pug-vHnWR0UE.js.map +1 -0
- package/dist/puppet-Bdao66PW.js +138 -0
- package/dist/puppet-Bdao66PW.js.map +1 -0
- package/dist/python-BFGRmuZ9.js +427 -0
- package/dist/python-BFGRmuZ9.js.map +1 -0
- package/dist/q-CrbCVq4a.js +132 -0
- package/dist/q-CrbCVq4a.js.map +1 -0
- package/dist/r-V7nswm59.js +171 -0
- package/dist/r-V7nswm59.js.map +1 -0
- package/dist/render-app-island-B-i8rvGi.js +61 -0
- package/dist/render-app-island-B-i8rvGi.js.map +1 -0
- package/dist/repl-sdk.js +7 -0
- package/dist/repl-sdk.js.map +1 -0
- package/dist/rpm-C-DLY-If.js +110 -0
- package/dist/rpm-C-DLY-If.js.map +1 -0
- package/dist/ruby-JDKLJNK0.js +331 -0
- package/dist/ruby-JDKLJNK0.js.map +1 -0
- package/dist/sas-D2UG-yhZ.js +208 -0
- package/dist/sas-D2UG-yhZ.js.map +1 -0
- package/dist/scheme-BKzrkGJD.js +223 -0
- package/dist/scheme-BKzrkGJD.js.map +1 -0
- package/dist/shell-BlsXDxCn.js +223 -0
- package/dist/shell-BlsXDxCn.js.map +1 -0
- package/dist/sieve-CjwBwOY5.js +136 -0
- package/dist/sieve-CjwBwOY5.js.map +1 -0
- package/dist/simple-mode-DMneyfDu.js +131 -0
- package/dist/simple-mode-DMneyfDu.js.map +1 -0
- package/dist/smalltalk-BOIGQuhN.js +122 -0
- package/dist/smalltalk-BOIGQuhN.js.map +1 -0
- package/dist/solr-CwD7U71z.js +70 -0
- package/dist/solr-CwD7U71z.js.map +1 -0
- package/dist/sparql-DYskk2vE.js +250 -0
- package/dist/sparql-DYskk2vE.js.map +1 -0
- package/dist/spreadsheet-Bgtt3oLP.js +88 -0
- package/dist/spreadsheet-Bgtt3oLP.js.map +1 -0
- package/dist/sql-Cei9CMfk.js +343 -0
- package/dist/sql-Cei9CMfk.js.map +1 -0
- package/dist/stex-C1nZSzAw.js +231 -0
- package/dist/stex-C1nZSzAw.js.map +1 -0
- package/dist/stylus-BkS-boTH.js +566 -0
- package/dist/stylus-BkS-boTH.js.map +1 -0
- package/dist/swift-FRZi1uvB.js +292 -0
- package/dist/swift-FRZi1uvB.js.map +1 -0
- package/dist/tcl-CUcaCdmq.js +115 -0
- package/dist/tcl-CUcaCdmq.js.map +1 -0
- package/dist/textile-BnFpjsrl.js +415 -0
- package/dist/textile-BnFpjsrl.js.map +1 -0
- package/dist/tiddlywiki-CjprD-Qp.js +219 -0
- package/dist/tiddlywiki-CjprD-Qp.js.map +1 -0
- package/dist/tiki-DK9DOeWn.js +269 -0
- package/dist/tiki-DK9DOeWn.js.map +1 -0
- package/dist/toml-BOuWGMcf.js +77 -0
- package/dist/toml-BOuWGMcf.js.map +1 -0
- package/dist/troff-E1bJ0PPL.js +62 -0
- package/dist/troff-E1bJ0PPL.js.map +1 -0
- package/dist/ttcn-cfg-Dc39-fIP.js +134 -0
- package/dist/ttcn-cfg-Dc39-fIP.js.map +1 -0
- package/dist/ttcn-tKd4HLu4.js +193 -0
- package/dist/ttcn-tKd4HLu4.js.map +1 -0
- package/dist/turtle-Dq7-1WAf.js +125 -0
- package/dist/turtle-Dq7-1WAf.js.map +1 -0
- package/dist/vb-Dp90gtsv.js +197 -0
- package/dist/vb-Dp90gtsv.js.map +1 -0
- package/dist/vbscript-Bfn8O8I7.js +479 -0
- package/dist/vbscript-Bfn8O8I7.js.map +1 -0
- package/dist/velocity-BwIZK1TH.js +150 -0
- package/dist/velocity-BwIZK1TH.js.map +1 -0
- package/dist/verilog-CnT9bMk0.js +430 -0
- package/dist/verilog-CnT9bMk0.js.map +1 -0
- package/dist/vhdl-DCkMIyT9.js +159 -0
- package/dist/vhdl-DCkMIyT9.js.map +1 -0
- package/dist/webidl-BTLTThCm.js +205 -0
- package/dist/webidl-BTLTThCm.js.map +1 -0
- package/dist/xquery-BrBUuxMR.js +526 -0
- package/dist/xquery-BrBUuxMR.js.map +1 -0
- package/dist/yacas-b5lAVEIl.js +131 -0
- package/dist/yacas-b5lAVEIl.js.map +1 -0
- package/dist/z80-ClgwfNdB.js +93 -0
- package/dist/z80-ClgwfNdB.js.map +1 -0
- package/package.json +81 -9
- package/src/cache.js +138 -0
- package/src/cdn.js +93 -0
- package/src/codemirror.js +161 -0
- package/src/compilers/ember/gjs.js +212 -0
- package/src/compilers/ember/gmd.js +190 -0
- package/src/compilers/ember/hbs.js +98 -0
- package/src/compilers/ember/render-app-island.js +83 -0
- package/src/compilers/ember.js +166 -0
- package/src/compilers/js.js +32 -0
- package/src/compilers/markdown/build-compiler.js +151 -0
- package/src/compilers/markdown/const.js +2 -0
- package/src/compilers/markdown/heading-id.js +75 -0
- package/src/compilers/markdown/live-code-extraction.js +198 -0
- package/src/compilers/markdown/parse.js +22 -0
- package/src/compilers/markdown/parse.test.ts +363 -0
- package/src/compilers/markdown/sanitize-for-glimmer.js +26 -0
- package/src/compilers/markdown/types.ts +21 -0
- package/src/compilers/markdown/utils.js +78 -0
- package/src/compilers/markdown.js +125 -0
- package/src/compilers/mermaid.js +35 -0
- package/src/compilers/react.js +59 -0
- package/src/compilers/svelte.js +116 -0
- package/src/compilers/vue.js +58 -0
- package/src/compilers.js +108 -0
- package/src/es-module-shim.js +53 -0
- package/src/index.d.ts +53 -4
- package/src/index.js +744 -89
- package/src/npm.js +58 -0
- package/src/request.Request.test.ts +59 -0
- package/src/request.js +140 -0
- package/src/resolve.fromImports.test.ts +35 -0
- package/src/resolve.fromInternalImport.test.ts +69 -0
- package/src/resolve.js +352 -0
- package/src/resolve.resolvePath.test.ts +24 -0
- package/src/resolve.test.ts +23 -0
- package/src/specifier.js +71 -0
- package/src/specifier.test.ts +90 -0
- package/src/tar-worker.js +61 -0
- package/src/tar.js +76 -0
- package/src/types.ts +335 -58
- package/src/utils.js +28 -1
- package/declarations/index.d.ts +0 -73
- package/dist/index.js +0 -107
- package/dist/index.js.map +0 -1
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
var words = {};
|
|
2
|
+
var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;
|
|
3
|
+
function define(style, string) {
|
|
4
|
+
var split = string.split(" ");
|
|
5
|
+
for (var i = 0; i < split.length; i++) {
|
|
6
|
+
words[split[i]] = style;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
define("keyword", "class define site node include import inherits");
|
|
10
|
+
define("keyword", "case if else in and elsif default or");
|
|
11
|
+
define("atom", "false true running present absent file directory undef");
|
|
12
|
+
define("builtin", "action augeas burst chain computer cron destination dport exec file filebucket group host icmp iniface interface jump k5login limit log_level log_prefix macauthorization mailalias maillist mcx mount nagios_command nagios_contact nagios_contactgroup nagios_host nagios_hostdependency nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo nagios_servicegroup nagios_timeperiod name notify outiface package proto reject resources router schedule scheduled_task selboolean selmodule service source sport ssh_authorized_key sshkey stage state table tidy todest toports tosource user vlan yumrepo zfs zone zpool");
|
|
13
|
+
function tokenString(stream, state) {
|
|
14
|
+
var current, prev, found_var = false;
|
|
15
|
+
while (!stream.eol() && (current = stream.next()) != state.pending) {
|
|
16
|
+
if (current === "$" && prev != "\\" && state.pending == '"') {
|
|
17
|
+
found_var = true;
|
|
18
|
+
break;
|
|
19
|
+
}
|
|
20
|
+
prev = current;
|
|
21
|
+
}
|
|
22
|
+
if (found_var) {
|
|
23
|
+
stream.backUp(1);
|
|
24
|
+
}
|
|
25
|
+
if (current == state.pending) {
|
|
26
|
+
state.continueString = false;
|
|
27
|
+
} else {
|
|
28
|
+
state.continueString = true;
|
|
29
|
+
}
|
|
30
|
+
return "string";
|
|
31
|
+
}
|
|
32
|
+
function tokenize(stream, state) {
|
|
33
|
+
var word = stream.match(/[\w]+/, false);
|
|
34
|
+
var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false);
|
|
35
|
+
var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
|
|
36
|
+
var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);
|
|
37
|
+
var ch = stream.next();
|
|
38
|
+
if (ch === "$") {
|
|
39
|
+
if (stream.match(variable_regex)) {
|
|
40
|
+
return state.continueString ? "variableName.special" : "variable";
|
|
41
|
+
}
|
|
42
|
+
return "error";
|
|
43
|
+
}
|
|
44
|
+
if (state.continueString) {
|
|
45
|
+
stream.backUp(1);
|
|
46
|
+
return tokenString(stream, state);
|
|
47
|
+
}
|
|
48
|
+
if (state.inDefinition) {
|
|
49
|
+
if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
|
|
50
|
+
return "def";
|
|
51
|
+
}
|
|
52
|
+
stream.match(/\s+{/);
|
|
53
|
+
state.inDefinition = false;
|
|
54
|
+
}
|
|
55
|
+
if (state.inInclude) {
|
|
56
|
+
stream.match(/(\s+)?\S+(\s+)?/);
|
|
57
|
+
state.inInclude = false;
|
|
58
|
+
return "def";
|
|
59
|
+
}
|
|
60
|
+
if (stream.match(/(\s+)?\w+\(/)) {
|
|
61
|
+
stream.backUp(1);
|
|
62
|
+
return "def";
|
|
63
|
+
}
|
|
64
|
+
if (attribute) {
|
|
65
|
+
stream.match(/(\s+)?\w+/);
|
|
66
|
+
return "tag";
|
|
67
|
+
}
|
|
68
|
+
if (word && words.hasOwnProperty(word)) {
|
|
69
|
+
stream.backUp(1);
|
|
70
|
+
stream.match(/[\w]+/);
|
|
71
|
+
if (stream.match(/\s+\S+\s+{/, false)) {
|
|
72
|
+
state.inDefinition = true;
|
|
73
|
+
}
|
|
74
|
+
if (word == "include") {
|
|
75
|
+
state.inInclude = true;
|
|
76
|
+
}
|
|
77
|
+
return words[word];
|
|
78
|
+
}
|
|
79
|
+
if (/(^|\s+)[A-Z][\w:_]+/.test(word)) {
|
|
80
|
+
stream.backUp(1);
|
|
81
|
+
stream.match(/(^|\s+)[A-Z][\w:_]+/);
|
|
82
|
+
return "def";
|
|
83
|
+
}
|
|
84
|
+
if (resource) {
|
|
85
|
+
stream.match(/(\s+)?[\w:_]+/);
|
|
86
|
+
return "def";
|
|
87
|
+
}
|
|
88
|
+
if (special_resource) {
|
|
89
|
+
stream.match(/(\s+)?[@]{1,2}/);
|
|
90
|
+
return "atom";
|
|
91
|
+
}
|
|
92
|
+
if (ch == "#") {
|
|
93
|
+
stream.skipToEnd();
|
|
94
|
+
return "comment";
|
|
95
|
+
}
|
|
96
|
+
if (ch == "'" || ch == '"') {
|
|
97
|
+
state.pending = ch;
|
|
98
|
+
return tokenString(stream, state);
|
|
99
|
+
}
|
|
100
|
+
if (ch == "{" || ch == "}") {
|
|
101
|
+
return "bracket";
|
|
102
|
+
}
|
|
103
|
+
if (ch == "/") {
|
|
104
|
+
stream.match(/^[^\/]*\//);
|
|
105
|
+
return "string.special";
|
|
106
|
+
}
|
|
107
|
+
if (ch.match(/[0-9]/)) {
|
|
108
|
+
stream.eatWhile(/[0-9]+/);
|
|
109
|
+
return "number";
|
|
110
|
+
}
|
|
111
|
+
if (ch == "=") {
|
|
112
|
+
if (stream.peek() == ">") {
|
|
113
|
+
stream.next();
|
|
114
|
+
}
|
|
115
|
+
return "operator";
|
|
116
|
+
}
|
|
117
|
+
stream.eatWhile(/[\w-]/);
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
const puppet = {
|
|
121
|
+
name: "puppet",
|
|
122
|
+
startState: function() {
|
|
123
|
+
var state = {};
|
|
124
|
+
state.inDefinition = false;
|
|
125
|
+
state.inInclude = false;
|
|
126
|
+
state.continueString = false;
|
|
127
|
+
state.pending = false;
|
|
128
|
+
return state;
|
|
129
|
+
},
|
|
130
|
+
token: function(stream, state) {
|
|
131
|
+
if (stream.eatSpace()) return null;
|
|
132
|
+
return tokenize(stream, state);
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
export {
|
|
136
|
+
puppet
|
|
137
|
+
};
|
|
138
|
+
//# sourceMappingURL=puppet-Bdao66PW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"puppet-Bdao66PW.js","sources":["../../../node_modules/.pnpm/@codemirror+legacy-modes@6.5.2/node_modules/@codemirror/legacy-modes/mode/puppet.js"],"sourcesContent":["// Stores the words from the define method\nvar words = {};\n// Taken, mostly, from the Puppet official variable standards regex\nvar variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;\n\n// Takes a string of words separated by spaces and adds them as\n// keys with the value of the first argument 'style'\nfunction define(style, string) {\n var split = string.split(' ');\n for (var i = 0; i < split.length; i++) {\n words[split[i]] = style;\n }\n}\n\n// Takes commonly known puppet types/words and classifies them to a style\ndefine('keyword', 'class define site node include import inherits');\ndefine('keyword', 'case if else in and elsif default or');\ndefine('atom', 'false true running present absent file directory undef');\ndefine('builtin', 'action augeas burst chain computer cron destination dport exec ' +\n 'file filebucket group host icmp iniface interface jump k5login limit log_level ' +\n 'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' +\n 'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' +\n 'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' +\n 'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' +\n 'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' +\n 'resources router schedule scheduled_task selboolean selmodule service source ' +\n 'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' +\n 'user vlan yumrepo zfs zone zpool');\n\n// After finding a start of a string ('|\") this function attempts to find the end;\n// If a variable is encountered along the way, we display it differently when it\n// is encapsulated in a double-quoted string.\nfunction tokenString(stream, state) {\n var current, prev, found_var = false;\n while (!stream.eol() && (current = stream.next()) != state.pending) {\n if (current === '$' && prev != '\\\\' && state.pending == '\"') {\n found_var = true;\n break;\n }\n prev = current;\n }\n if (found_var) {\n stream.backUp(1);\n }\n if (current == state.pending) {\n state.continueString = false;\n } else {\n state.continueString = true;\n }\n return \"string\";\n}\n\n// Main function\nfunction tokenize(stream, state) {\n // Matches one whole word\n var word = stream.match(/[\\w]+/, false);\n // Matches attributes (i.e. ensure => present ; 'ensure' would be matched)\n var attribute = stream.match(/(\\s+)?\\w+\\s+=>.*/, false);\n // Matches non-builtin resource declarations\n // (i.e. \"apache::vhost {\" or \"mycustomclasss {\" would be matched)\n var resource = stream.match(/(\\s+)?[\\w:_]+(\\s+)?{/, false);\n // Matches virtual and exported resources (i.e. @@user { ; and the like)\n var special_resource = stream.match(/(\\s+)?[@]{1,2}[\\w:_]+(\\s+)?{/, false);\n\n // Finally advance the stream\n var ch = stream.next();\n\n // Have we found a variable?\n if (ch === '$') {\n if (stream.match(variable_regex)) {\n // If so, and its in a string, assign it a different color\n return state.continueString ? 'variableName.special' : 'variable';\n }\n // Otherwise return an invalid variable\n return \"error\";\n }\n // Should we still be looking for the end of a string?\n if (state.continueString) {\n // If so, go through the loop again\n stream.backUp(1);\n return tokenString(stream, state);\n }\n // Are we in a definition (class, node, define)?\n if (state.inDefinition) {\n // If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched)\n if (stream.match(/(\\s+)?[\\w:_]+(\\s+)?/)) {\n return 'def';\n }\n // Match the rest it the next time around\n stream.match(/\\s+{/);\n state.inDefinition = false;\n }\n // Are we in an 'include' statement?\n if (state.inInclude) {\n // Match and return the included class\n stream.match(/(\\s+)?\\S+(\\s+)?/);\n state.inInclude = false;\n return 'def';\n }\n // Do we just have a function on our hands?\n // In 'ensure_resource(\"myclass\")', 'ensure_resource' is matched\n if (stream.match(/(\\s+)?\\w+\\(/)) {\n stream.backUp(1);\n return 'def';\n }\n // Have we matched the prior attribute regex?\n if (attribute) {\n stream.match(/(\\s+)?\\w+/);\n return 'tag';\n }\n // Do we have Puppet specific words?\n if (word && words.hasOwnProperty(word)) {\n // Negates the initial next()\n stream.backUp(1);\n // rs move the stream\n stream.match(/[\\w]+/);\n // We want to process these words differently\n // do to the importance they have in Puppet\n if (stream.match(/\\s+\\S+\\s+{/, false)) {\n state.inDefinition = true;\n }\n if (word == 'include') {\n state.inInclude = true;\n }\n // Returns their value as state in the prior define methods\n return words[word];\n }\n // Is there a match on a reference?\n if (/(^|\\s+)[A-Z][\\w:_]+/.test(word)) {\n // Negate the next()\n stream.backUp(1);\n // Match the full reference\n stream.match(/(^|\\s+)[A-Z][\\w:_]+/);\n return 'def';\n }\n // Have we matched the prior resource regex?\n if (resource) {\n stream.match(/(\\s+)?[\\w:_]+/);\n return 'def';\n }\n // Have we matched the prior special_resource regex?\n if (special_resource) {\n stream.match(/(\\s+)?[@]{1,2}/);\n return 'atom';\n }\n // Match all the comments. All of them.\n if (ch == \"#\") {\n stream.skipToEnd();\n return \"comment\";\n }\n // Have we found a string?\n if (ch == \"'\" || ch == '\"') {\n // Store the type (single or double)\n state.pending = ch;\n // Perform the looping function to find the end\n return tokenString(stream, state);\n }\n // Match all the brackets\n if (ch == '{' || ch == '}') {\n return 'bracket';\n }\n // Match characters that we are going to assume\n // are trying to be regex\n if (ch == '/') {\n stream.match(/^[^\\/]*\\//);\n return 'string.special';\n }\n // Match all the numbers\n if (ch.match(/[0-9]/)) {\n stream.eatWhile(/[0-9]+/);\n return 'number';\n }\n // Match the '=' and '=>' operators\n if (ch == '=') {\n if (stream.peek() == '>') {\n stream.next();\n }\n return \"operator\";\n }\n // Keep advancing through all the rest\n stream.eatWhile(/[\\w-]/);\n // Return a blank line for everything else\n return null;\n}\n// Start it all\nexport const puppet = {\n name: \"puppet\",\n\n startState: function () {\n var state = {};\n state.inDefinition = false;\n state.inInclude = false;\n state.continueString = false;\n state.pending = false;\n return state;\n },\n token: function (stream, state) {\n // Strip the spaces, but regex will account for them eitherway\n if (stream.eatSpace()) return null;\n // Go through the main process\n return tokenize(stream, state);\n }\n};\n"],"names":[],"mappings":"AACA,IAAI,QAAQ,CAAA;AAEZ,IAAI,iBAAiB;AAIrB,SAAS,OAAO,OAAO,QAAQ;AAC7B,MAAI,QAAQ,OAAO,MAAM,GAAG;AAC5B,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACrC,UAAM,MAAM,CAAC,CAAC,IAAI;AAAA,EACpB;AACF;AAGA,OAAO,WAAW,gDAAgD;AAClE,OAAO,WAAW,sCAAsC;AACxD,OAAO,QAAQ,wDAAwD;AACvE,OAAO,WAAW,0rBASuB;AAKzC,SAAS,YAAY,QAAQ,OAAO;AAClC,MAAI,SAAS,MAAM,YAAY;AAC/B,SAAO,CAAC,OAAO,IAAG,MAAO,UAAU,OAAO,KAAI,MAAO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K;AAAA,EAC/B;AACF;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
function wordRegexp(words2) {
|
|
2
|
+
return new RegExp("^((" + words2.join(")|(") + "))\\b");
|
|
3
|
+
}
|
|
4
|
+
var wordOperators = wordRegexp(["and", "or", "not", "is"]);
|
|
5
|
+
var commonKeywords = [
|
|
6
|
+
"as",
|
|
7
|
+
"assert",
|
|
8
|
+
"break",
|
|
9
|
+
"class",
|
|
10
|
+
"continue",
|
|
11
|
+
"def",
|
|
12
|
+
"del",
|
|
13
|
+
"elif",
|
|
14
|
+
"else",
|
|
15
|
+
"except",
|
|
16
|
+
"finally",
|
|
17
|
+
"for",
|
|
18
|
+
"from",
|
|
19
|
+
"global",
|
|
20
|
+
"if",
|
|
21
|
+
"import",
|
|
22
|
+
"lambda",
|
|
23
|
+
"pass",
|
|
24
|
+
"raise",
|
|
25
|
+
"return",
|
|
26
|
+
"try",
|
|
27
|
+
"while",
|
|
28
|
+
"with",
|
|
29
|
+
"yield",
|
|
30
|
+
"in",
|
|
31
|
+
"False",
|
|
32
|
+
"True"
|
|
33
|
+
];
|
|
34
|
+
var commonBuiltins = [
|
|
35
|
+
"abs",
|
|
36
|
+
"all",
|
|
37
|
+
"any",
|
|
38
|
+
"bin",
|
|
39
|
+
"bool",
|
|
40
|
+
"bytearray",
|
|
41
|
+
"callable",
|
|
42
|
+
"chr",
|
|
43
|
+
"classmethod",
|
|
44
|
+
"compile",
|
|
45
|
+
"complex",
|
|
46
|
+
"delattr",
|
|
47
|
+
"dict",
|
|
48
|
+
"dir",
|
|
49
|
+
"divmod",
|
|
50
|
+
"enumerate",
|
|
51
|
+
"eval",
|
|
52
|
+
"filter",
|
|
53
|
+
"float",
|
|
54
|
+
"format",
|
|
55
|
+
"frozenset",
|
|
56
|
+
"getattr",
|
|
57
|
+
"globals",
|
|
58
|
+
"hasattr",
|
|
59
|
+
"hash",
|
|
60
|
+
"help",
|
|
61
|
+
"hex",
|
|
62
|
+
"id",
|
|
63
|
+
"input",
|
|
64
|
+
"int",
|
|
65
|
+
"isinstance",
|
|
66
|
+
"issubclass",
|
|
67
|
+
"iter",
|
|
68
|
+
"len",
|
|
69
|
+
"list",
|
|
70
|
+
"locals",
|
|
71
|
+
"map",
|
|
72
|
+
"max",
|
|
73
|
+
"memoryview",
|
|
74
|
+
"min",
|
|
75
|
+
"next",
|
|
76
|
+
"object",
|
|
77
|
+
"oct",
|
|
78
|
+
"open",
|
|
79
|
+
"ord",
|
|
80
|
+
"pow",
|
|
81
|
+
"property",
|
|
82
|
+
"range",
|
|
83
|
+
"repr",
|
|
84
|
+
"reversed",
|
|
85
|
+
"round",
|
|
86
|
+
"set",
|
|
87
|
+
"setattr",
|
|
88
|
+
"slice",
|
|
89
|
+
"sorted",
|
|
90
|
+
"staticmethod",
|
|
91
|
+
"str",
|
|
92
|
+
"sum",
|
|
93
|
+
"super",
|
|
94
|
+
"tuple",
|
|
95
|
+
"type",
|
|
96
|
+
"vars",
|
|
97
|
+
"zip",
|
|
98
|
+
"__import__",
|
|
99
|
+
"NotImplemented",
|
|
100
|
+
"Ellipsis",
|
|
101
|
+
"__debug__"
|
|
102
|
+
];
|
|
103
|
+
function top(state) {
|
|
104
|
+
return state.scopes[state.scopes.length - 1];
|
|
105
|
+
}
|
|
106
|
+
function mkPython(parserConf) {
|
|
107
|
+
var ERRORCLASS = "error";
|
|
108
|
+
var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
|
|
109
|
+
var operators = [
|
|
110
|
+
parserConf.singleOperators,
|
|
111
|
+
parserConf.doubleOperators,
|
|
112
|
+
parserConf.doubleDelimiters,
|
|
113
|
+
parserConf.tripleDelimiters,
|
|
114
|
+
parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/
|
|
115
|
+
];
|
|
116
|
+
for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1);
|
|
117
|
+
var hangingIndent = parserConf.hangingIndent;
|
|
118
|
+
var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
|
|
119
|
+
if (parserConf.extra_keywords != void 0)
|
|
120
|
+
myKeywords = myKeywords.concat(parserConf.extra_keywords);
|
|
121
|
+
if (parserConf.extra_builtins != void 0)
|
|
122
|
+
myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
|
|
123
|
+
var py3 = !(parserConf.version && Number(parserConf.version) < 3);
|
|
124
|
+
if (py3) {
|
|
125
|
+
var identifiers = parserConf.identifiers || /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
|
|
126
|
+
myKeywords = myKeywords.concat(["nonlocal", "None", "aiter", "anext", "async", "await", "breakpoint", "match", "case"]);
|
|
127
|
+
myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
|
|
128
|
+
var stringPrefixes = new RegExp(`^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|"{3}|['"]))`, "i");
|
|
129
|
+
} else {
|
|
130
|
+
var identifiers = parserConf.identifiers || /^[_A-Za-z][_A-Za-z0-9]*/;
|
|
131
|
+
myKeywords = myKeywords.concat(["exec", "print"]);
|
|
132
|
+
myBuiltins = myBuiltins.concat([
|
|
133
|
+
"apply",
|
|
134
|
+
"basestring",
|
|
135
|
+
"buffer",
|
|
136
|
+
"cmp",
|
|
137
|
+
"coerce",
|
|
138
|
+
"execfile",
|
|
139
|
+
"file",
|
|
140
|
+
"intern",
|
|
141
|
+
"long",
|
|
142
|
+
"raw_input",
|
|
143
|
+
"reduce",
|
|
144
|
+
"reload",
|
|
145
|
+
"unichr",
|
|
146
|
+
"unicode",
|
|
147
|
+
"xrange",
|
|
148
|
+
"None"
|
|
149
|
+
]);
|
|
150
|
+
var stringPrefixes = new RegExp(`^(([rubf]|(ur)|(br))?('{3}|"{3}|['"]))`, "i");
|
|
151
|
+
}
|
|
152
|
+
var keywords = wordRegexp(myKeywords);
|
|
153
|
+
var builtins = wordRegexp(myBuiltins);
|
|
154
|
+
function tokenBase(stream, state) {
|
|
155
|
+
var sol = stream.sol() && state.lastToken != "\\";
|
|
156
|
+
if (sol) state.indent = stream.indentation();
|
|
157
|
+
if (sol && top(state).type == "py") {
|
|
158
|
+
var scopeOffset = top(state).offset;
|
|
159
|
+
if (stream.eatSpace()) {
|
|
160
|
+
var lineOffset = stream.indentation();
|
|
161
|
+
if (lineOffset > scopeOffset)
|
|
162
|
+
pushPyScope(stream, state);
|
|
163
|
+
else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
|
|
164
|
+
state.errorToken = true;
|
|
165
|
+
return null;
|
|
166
|
+
} else {
|
|
167
|
+
var style = tokenBaseInner(stream, state);
|
|
168
|
+
if (scopeOffset > 0 && dedent(stream, state))
|
|
169
|
+
style += " " + ERRORCLASS;
|
|
170
|
+
return style;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
return tokenBaseInner(stream, state);
|
|
174
|
+
}
|
|
175
|
+
function tokenBaseInner(stream, state, inFormat) {
|
|
176
|
+
if (stream.eatSpace()) return null;
|
|
177
|
+
if (!inFormat && stream.match(/^#.*/)) return "comment";
|
|
178
|
+
if (stream.match(/^[0-9\.]/, false)) {
|
|
179
|
+
var floatLiteral = false;
|
|
180
|
+
if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) {
|
|
181
|
+
floatLiteral = true;
|
|
182
|
+
}
|
|
183
|
+
if (stream.match(/^[\d_]+\.\d*/)) {
|
|
184
|
+
floatLiteral = true;
|
|
185
|
+
}
|
|
186
|
+
if (stream.match(/^\.\d+/)) {
|
|
187
|
+
floatLiteral = true;
|
|
188
|
+
}
|
|
189
|
+
if (floatLiteral) {
|
|
190
|
+
stream.eat(/J/i);
|
|
191
|
+
return "number";
|
|
192
|
+
}
|
|
193
|
+
var intLiteral = false;
|
|
194
|
+
if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
|
|
195
|
+
if (stream.match(/^0b[01_]+/i)) intLiteral = true;
|
|
196
|
+
if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
|
|
197
|
+
if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
|
|
198
|
+
stream.eat(/J/i);
|
|
199
|
+
intLiteral = true;
|
|
200
|
+
}
|
|
201
|
+
if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
|
|
202
|
+
if (intLiteral) {
|
|
203
|
+
stream.eat(/L/i);
|
|
204
|
+
return "number";
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (stream.match(stringPrefixes)) {
|
|
208
|
+
var isFmtString = stream.current().toLowerCase().indexOf("f") !== -1;
|
|
209
|
+
if (!isFmtString) {
|
|
210
|
+
state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
|
|
211
|
+
return state.tokenize(stream, state);
|
|
212
|
+
} else {
|
|
213
|
+
state.tokenize = formatStringFactory(stream.current(), state.tokenize);
|
|
214
|
+
return state.tokenize(stream, state);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
for (var i2 = 0; i2 < operators.length; i2++)
|
|
218
|
+
if (stream.match(operators[i2])) return "operator";
|
|
219
|
+
if (stream.match(delimiters)) return "punctuation";
|
|
220
|
+
if (state.lastToken == "." && stream.match(identifiers))
|
|
221
|
+
return "property";
|
|
222
|
+
if (stream.match(keywords) || stream.match(wordOperators))
|
|
223
|
+
return "keyword";
|
|
224
|
+
if (stream.match(builtins))
|
|
225
|
+
return "builtin";
|
|
226
|
+
if (stream.match(/^(self|cls)\b/))
|
|
227
|
+
return "self";
|
|
228
|
+
if (stream.match(identifiers)) {
|
|
229
|
+
if (state.lastToken == "def" || state.lastToken == "class")
|
|
230
|
+
return "def";
|
|
231
|
+
return "variable";
|
|
232
|
+
}
|
|
233
|
+
stream.next();
|
|
234
|
+
return inFormat ? null : ERRORCLASS;
|
|
235
|
+
}
|
|
236
|
+
function formatStringFactory(delimiter, tokenOuter) {
|
|
237
|
+
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
|
238
|
+
delimiter = delimiter.substr(1);
|
|
239
|
+
var singleline = delimiter.length == 1;
|
|
240
|
+
var OUTCLASS = "string";
|
|
241
|
+
function tokenNestedExpr(depth) {
|
|
242
|
+
return function(stream, state) {
|
|
243
|
+
var inner = tokenBaseInner(stream, state, true);
|
|
244
|
+
if (inner == "punctuation") {
|
|
245
|
+
if (stream.current() == "{") {
|
|
246
|
+
state.tokenize = tokenNestedExpr(depth + 1);
|
|
247
|
+
} else if (stream.current() == "}") {
|
|
248
|
+
if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1);
|
|
249
|
+
else state.tokenize = tokenString;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
return inner;
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
function tokenString(stream, state) {
|
|
256
|
+
while (!stream.eol()) {
|
|
257
|
+
stream.eatWhile(/[^'"\{\}\\]/);
|
|
258
|
+
if (stream.eat("\\")) {
|
|
259
|
+
stream.next();
|
|
260
|
+
if (singleline && stream.eol())
|
|
261
|
+
return OUTCLASS;
|
|
262
|
+
} else if (stream.match(delimiter)) {
|
|
263
|
+
state.tokenize = tokenOuter;
|
|
264
|
+
return OUTCLASS;
|
|
265
|
+
} else if (stream.match("{{")) {
|
|
266
|
+
return OUTCLASS;
|
|
267
|
+
} else if (stream.match("{", false)) {
|
|
268
|
+
state.tokenize = tokenNestedExpr(0);
|
|
269
|
+
if (stream.current()) return OUTCLASS;
|
|
270
|
+
else return state.tokenize(stream, state);
|
|
271
|
+
} else if (stream.match("}}")) {
|
|
272
|
+
return OUTCLASS;
|
|
273
|
+
} else if (stream.match("}")) {
|
|
274
|
+
return ERRORCLASS;
|
|
275
|
+
} else {
|
|
276
|
+
stream.eat(/['"]/);
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
if (singleline) {
|
|
280
|
+
if (parserConf.singleLineStringErrors)
|
|
281
|
+
return ERRORCLASS;
|
|
282
|
+
else
|
|
283
|
+
state.tokenize = tokenOuter;
|
|
284
|
+
}
|
|
285
|
+
return OUTCLASS;
|
|
286
|
+
}
|
|
287
|
+
tokenString.isString = true;
|
|
288
|
+
return tokenString;
|
|
289
|
+
}
|
|
290
|
+
function tokenStringFactory(delimiter, tokenOuter) {
|
|
291
|
+
while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
|
|
292
|
+
delimiter = delimiter.substr(1);
|
|
293
|
+
var singleline = delimiter.length == 1;
|
|
294
|
+
var OUTCLASS = "string";
|
|
295
|
+
function tokenString(stream, state) {
|
|
296
|
+
while (!stream.eol()) {
|
|
297
|
+
stream.eatWhile(/[^'"\\]/);
|
|
298
|
+
if (stream.eat("\\")) {
|
|
299
|
+
stream.next();
|
|
300
|
+
if (singleline && stream.eol())
|
|
301
|
+
return OUTCLASS;
|
|
302
|
+
} else if (stream.match(delimiter)) {
|
|
303
|
+
state.tokenize = tokenOuter;
|
|
304
|
+
return OUTCLASS;
|
|
305
|
+
} else {
|
|
306
|
+
stream.eat(/['"]/);
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
if (singleline) {
|
|
310
|
+
if (parserConf.singleLineStringErrors)
|
|
311
|
+
return ERRORCLASS;
|
|
312
|
+
else
|
|
313
|
+
state.tokenize = tokenOuter;
|
|
314
|
+
}
|
|
315
|
+
return OUTCLASS;
|
|
316
|
+
}
|
|
317
|
+
tokenString.isString = true;
|
|
318
|
+
return tokenString;
|
|
319
|
+
}
|
|
320
|
+
function pushPyScope(stream, state) {
|
|
321
|
+
while (top(state).type != "py") state.scopes.pop();
|
|
322
|
+
state.scopes.push({
|
|
323
|
+
offset: top(state).offset + stream.indentUnit,
|
|
324
|
+
type: "py",
|
|
325
|
+
align: null
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
function pushBracketScope(stream, state, type) {
|
|
329
|
+
var align = stream.match(/^[\s\[\{\(]*(?:#|$)/, false) ? null : stream.column() + 1;
|
|
330
|
+
state.scopes.push({
|
|
331
|
+
offset: state.indent + (hangingIndent || stream.indentUnit),
|
|
332
|
+
type,
|
|
333
|
+
align
|
|
334
|
+
});
|
|
335
|
+
}
|
|
336
|
+
function dedent(stream, state) {
|
|
337
|
+
var indented = stream.indentation();
|
|
338
|
+
while (state.scopes.length > 1 && top(state).offset > indented) {
|
|
339
|
+
if (top(state).type != "py") return true;
|
|
340
|
+
state.scopes.pop();
|
|
341
|
+
}
|
|
342
|
+
return top(state).offset != indented;
|
|
343
|
+
}
|
|
344
|
+
function tokenLexer(stream, state) {
|
|
345
|
+
if (stream.sol()) {
|
|
346
|
+
state.beginningOfLine = true;
|
|
347
|
+
state.dedent = false;
|
|
348
|
+
}
|
|
349
|
+
var style = state.tokenize(stream, state);
|
|
350
|
+
var current = stream.current();
|
|
351
|
+
if (state.beginningOfLine && current == "@")
|
|
352
|
+
return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
|
|
353
|
+
if (/\S/.test(current)) state.beginningOfLine = false;
|
|
354
|
+
if ((style == "variable" || style == "builtin") && state.lastToken == "meta")
|
|
355
|
+
style = "meta";
|
|
356
|
+
if (current == "pass" || current == "return")
|
|
357
|
+
state.dedent = true;
|
|
358
|
+
if (current == "lambda") state.lambda = true;
|
|
359
|
+
if (current == ":" && !state.lambda && top(state).type == "py" && stream.match(/^\s*(?:#|$)/, false))
|
|
360
|
+
pushPyScope(stream, state);
|
|
361
|
+
if (current.length == 1 && !/string|comment/.test(style)) {
|
|
362
|
+
var delimiter_index = "[({".indexOf(current);
|
|
363
|
+
if (delimiter_index != -1)
|
|
364
|
+
pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index + 1));
|
|
365
|
+
delimiter_index = "])}".indexOf(current);
|
|
366
|
+
if (delimiter_index != -1) {
|
|
367
|
+
if (top(state).type == current) state.indent = state.scopes.pop().offset - (hangingIndent || stream.indentUnit);
|
|
368
|
+
else return ERRORCLASS;
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
if (state.dedent && stream.eol() && top(state).type == "py" && state.scopes.length > 1)
|
|
372
|
+
state.scopes.pop();
|
|
373
|
+
return style;
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
376
|
+
name: "python",
|
|
377
|
+
startState: function() {
|
|
378
|
+
return {
|
|
379
|
+
tokenize: tokenBase,
|
|
380
|
+
scopes: [{ offset: 0, type: "py", align: null }],
|
|
381
|
+
indent: 0,
|
|
382
|
+
lastToken: null,
|
|
383
|
+
lambda: false,
|
|
384
|
+
dedent: 0
|
|
385
|
+
};
|
|
386
|
+
},
|
|
387
|
+
token: function(stream, state) {
|
|
388
|
+
var addErr = state.errorToken;
|
|
389
|
+
if (addErr) state.errorToken = false;
|
|
390
|
+
var style = tokenLexer(stream, state);
|
|
391
|
+
if (style && style != "comment")
|
|
392
|
+
state.lastToken = style == "keyword" || style == "punctuation" ? stream.current() : style;
|
|
393
|
+
if (style == "punctuation") style = null;
|
|
394
|
+
if (stream.eol() && state.lambda)
|
|
395
|
+
state.lambda = false;
|
|
396
|
+
return addErr ? ERRORCLASS : style;
|
|
397
|
+
},
|
|
398
|
+
indent: function(state, textAfter, cx) {
|
|
399
|
+
if (state.tokenize != tokenBase)
|
|
400
|
+
return state.tokenize.isString ? null : 0;
|
|
401
|
+
var scope = top(state);
|
|
402
|
+
var closing = scope.type == textAfter.charAt(0) || scope.type == "py" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter);
|
|
403
|
+
if (scope.align != null)
|
|
404
|
+
return scope.align - (closing ? 1 : 0);
|
|
405
|
+
else
|
|
406
|
+
return scope.offset - (closing ? hangingIndent || cx.unit : 0);
|
|
407
|
+
},
|
|
408
|
+
languageData: {
|
|
409
|
+
autocomplete: commonKeywords.concat(commonBuiltins).concat(["exec", "print"]),
|
|
410
|
+
indentOnInput: /^\s*([\}\]\)]|else:|elif |except |finally:)$/,
|
|
411
|
+
commentTokens: { line: "#" },
|
|
412
|
+
closeBrackets: { brackets: ["(", "[", "{", "'", '"', "'''", '"""'] }
|
|
413
|
+
}
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
var words = function(str) {
|
|
417
|
+
return str.split(" ");
|
|
418
|
+
};
|
|
419
|
+
mkPython({});
|
|
420
|
+
const cython = mkPython({
|
|
421
|
+
extra_keywords: words("by cdef cimport cpdef ctypedef enum except extern gil include nogil property public readonly struct union DEF IF ELIF ELSE")
|
|
422
|
+
});
|
|
423
|
+
export {
|
|
424
|
+
cython,
|
|
425
|
+
mkPython
|
|
426
|
+
};
|
|
427
|
+
//# sourceMappingURL=python-BFGRmuZ9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-BFGRmuZ9.js","sources":["../../../node_modules/.pnpm/@codemirror+legacy-modes@6.5.2/node_modules/@codemirror/legacy-modes/mode/python.js"],"sourcesContent":["function wordRegexp(words) {\n return new RegExp(\"^((\" + words.join(\")|(\") + \"))\\\\b\");\n}\n\nvar wordOperators = wordRegexp([\"and\", \"or\", \"not\", \"is\"]);\nvar commonKeywords = [\"as\", \"assert\", \"break\", \"class\", \"continue\",\n \"def\", \"del\", \"elif\", \"else\", \"except\", \"finally\",\n \"for\", \"from\", \"global\", \"if\", \"import\",\n \"lambda\", \"pass\", \"raise\", \"return\",\n \"try\", \"while\", \"with\", \"yield\", \"in\", \"False\", \"True\"];\nvar commonBuiltins = [\"abs\", \"all\", \"any\", \"bin\", \"bool\", \"bytearray\", \"callable\", \"chr\",\n \"classmethod\", \"compile\", \"complex\", \"delattr\", \"dict\", \"dir\", \"divmod\",\n \"enumerate\", \"eval\", \"filter\", \"float\", \"format\", \"frozenset\",\n \"getattr\", \"globals\", \"hasattr\", \"hash\", \"help\", \"hex\", \"id\",\n \"input\", \"int\", \"isinstance\", \"issubclass\", \"iter\", \"len\",\n \"list\", \"locals\", \"map\", \"max\", \"memoryview\", \"min\", \"next\",\n \"object\", \"oct\", \"open\", \"ord\", \"pow\", \"property\", \"range\",\n \"repr\", \"reversed\", \"round\", \"set\", \"setattr\", \"slice\",\n \"sorted\", \"staticmethod\", \"str\", \"sum\", \"super\", \"tuple\",\n \"type\", \"vars\", \"zip\", \"__import__\", \"NotImplemented\",\n \"Ellipsis\", \"__debug__\"];\n\nfunction top(state) {\n return state.scopes[state.scopes.length - 1];\n}\n\nexport function mkPython(parserConf) {\n var ERRORCLASS = \"error\";\n\n var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\\(\\)\\[\\]\\{\\}@,:`=;\\.\\\\]/;\n // (Backwards-compatibility with old, cumbersome config system)\n var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,\n parserConf.operators || /^([-+*/%\\/&|^]=?|[<>=]+|\\/\\/=?|\\*\\*=?|!=|[~!@]|\\.\\.\\.)/]\n for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)\n\n var hangingIndent = parserConf.hangingIndent;\n\n var myKeywords = commonKeywords, myBuiltins = commonBuiltins;\n if (parserConf.extra_keywords != undefined)\n myKeywords = myKeywords.concat(parserConf.extra_keywords);\n\n if (parserConf.extra_builtins != undefined)\n myBuiltins = myBuiltins.concat(parserConf.extra_builtins);\n\n var py3 = !(parserConf.version && Number(parserConf.version) < 3)\n if (py3) {\n // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator\n var identifiers = parserConf.identifiers|| /^[_A-Za-z\\u00A1-\\uFFFF][_A-Za-z0-9\\u00A1-\\uFFFF]*/;\n myKeywords = myKeywords.concat([\"nonlocal\", \"None\", \"aiter\", \"anext\", \"async\", \"await\", \"breakpoint\", \"match\", \"case\"]);\n myBuiltins = myBuiltins.concat([\"ascii\", \"bytes\", \"exec\", \"print\"]);\n var stringPrefixes = new RegExp(\"^(([rbuf]|(br)|(rb)|(fr)|(rf))?('{3}|\\\"{3}|['\\\"]))\", \"i\");\n } else {\n var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;\n myKeywords = myKeywords.concat([\"exec\", \"print\"]);\n myBuiltins = myBuiltins.concat([\"apply\", \"basestring\", \"buffer\", \"cmp\", \"coerce\", \"execfile\",\n \"file\", \"intern\", \"long\", \"raw_input\", \"reduce\", \"reload\",\n \"unichr\", \"unicode\", \"xrange\", \"None\"]);\n var stringPrefixes = new RegExp(\"^(([rubf]|(ur)|(br))?('{3}|\\\"{3}|['\\\"]))\", \"i\");\n }\n var keywords = wordRegexp(myKeywords);\n var builtins = wordRegexp(myBuiltins);\n\n // tokenizers\n function tokenBase(stream, state) {\n var sol = stream.sol() && state.lastToken != \"\\\\\"\n if (sol) state.indent = stream.indentation()\n // Handle scope changes\n if (sol && top(state).type == \"py\") {\n var scopeOffset = top(state).offset;\n if (stream.eatSpace()) {\n var lineOffset = stream.indentation();\n if (lineOffset > scopeOffset)\n pushPyScope(stream, state);\n else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != \"#\")\n state.errorToken = true;\n return null;\n } else {\n var style = tokenBaseInner(stream, state);\n if (scopeOffset > 0 && dedent(stream, state))\n style += \" \" + ERRORCLASS;\n return style;\n }\n }\n return tokenBaseInner(stream, state);\n }\n\n function tokenBaseInner(stream, state, inFormat) {\n if (stream.eatSpace()) return null;\n\n // Handle Comments\n if (!inFormat && stream.match(/^#.*/)) return \"comment\";\n\n // Handle Number Literals\n if (stream.match(/^[0-9\\.]/, false)) {\n var floatLiteral = false;\n // Floats\n if (stream.match(/^[\\d_]*\\.\\d+(e[\\+\\-]?\\d+)?/i)) { floatLiteral = true; }\n if (stream.match(/^[\\d_]+\\.\\d*/)) { floatLiteral = true; }\n if (stream.match(/^\\.\\d+/)) { floatLiteral = true; }\n if (floatLiteral) {\n // Float literals may be \"imaginary\"\n stream.eat(/J/i);\n return \"number\";\n }\n // Integers\n var intLiteral = false;\n // Hex\n if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;\n // Binary\n if (stream.match(/^0b[01_]+/i)) intLiteral = true;\n // Octal\n if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;\n // Decimal\n if (stream.match(/^[1-9][\\d_]*(e[\\+\\-]?[\\d_]+)?/)) {\n // Decimal literals may be \"imaginary\"\n stream.eat(/J/i);\n // TODO - Can you have imaginary longs?\n intLiteral = true;\n }\n // Zero by itself with no other piece of number.\n if (stream.match(/^0(?![\\dx])/i)) intLiteral = true;\n if (intLiteral) {\n // Integer literals may be \"long\"\n stream.eat(/L/i);\n return \"number\";\n }\n }\n\n // Handle Strings\n if (stream.match(stringPrefixes)) {\n var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;\n if (!isFmtString) {\n state.tokenize = tokenStringFactory(stream.current(), state.tokenize);\n return state.tokenize(stream, state);\n } else {\n state.tokenize = formatStringFactory(stream.current(), state.tokenize);\n return state.tokenize(stream, state);\n }\n }\n\n for (var i = 0; i < operators.length; i++)\n if (stream.match(operators[i])) return \"operator\"\n\n if (stream.match(delimiters)) return \"punctuation\";\n\n if (state.lastToken == \".\" && stream.match(identifiers))\n return \"property\";\n\n if (stream.match(keywords) || stream.match(wordOperators))\n return \"keyword\";\n\n if (stream.match(builtins))\n return \"builtin\";\n\n if (stream.match(/^(self|cls)\\b/))\n return \"self\";\n\n if (stream.match(identifiers)) {\n if (state.lastToken == \"def\" || state.lastToken == \"class\")\n return \"def\";\n return \"variable\";\n }\n\n // Handle non-detected items\n stream.next();\n return inFormat ? null :ERRORCLASS;\n }\n\n function formatStringFactory(delimiter, tokenOuter) {\n while (\"rubf\".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)\n delimiter = delimiter.substr(1);\n\n var singleline = delimiter.length == 1;\n var OUTCLASS = \"string\";\n\n function tokenNestedExpr(depth) {\n return function(stream, state) {\n var inner = tokenBaseInner(stream, state, true)\n if (inner == \"punctuation\") {\n if (stream.current() == \"{\") {\n state.tokenize = tokenNestedExpr(depth + 1)\n } else if (stream.current() == \"}\") {\n if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)\n else state.tokenize = tokenString\n }\n }\n return inner\n }\n }\n\n function tokenString(stream, state) {\n while (!stream.eol()) {\n stream.eatWhile(/[^'\"\\{\\}\\\\]/);\n if (stream.eat(\"\\\\\")) {\n stream.next();\n if (singleline && stream.eol())\n return OUTCLASS;\n } else if (stream.match(delimiter)) {\n state.tokenize = tokenOuter;\n return OUTCLASS;\n } else if (stream.match('{{')) {\n // ignore {{ in f-str\n return OUTCLASS;\n } else if (stream.match('{', false)) {\n // switch to nested mode\n state.tokenize = tokenNestedExpr(0)\n if (stream.current()) return OUTCLASS;\n else return state.tokenize(stream, state)\n } else if (stream.match('}}')) {\n return OUTCLASS;\n } else if (stream.match('}')) {\n // single } in f-string is an error\n return ERRORCLASS;\n } else {\n stream.eat(/['\"]/);\n }\n }\n if (singleline) {\n if (parserConf.singleLineStringErrors)\n return ERRORCLASS;\n else\n state.tokenize = tokenOuter;\n }\n return OUTCLASS;\n }\n tokenString.isString = true;\n return tokenString;\n }\n\n function tokenStringFactory(delimiter, tokenOuter) {\n while (\"rubf\".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)\n delimiter = delimiter.substr(1);\n\n var singleline = delimiter.length == 1;\n var OUTCLASS = \"string\";\n\n function tokenString(stream, state) {\n while (!stream.eol()) {\n stream.eatWhile(/[^'\"\\\\]/);\n if (stream.eat(\"\\\\\")) {\n stream.next();\n if (singleline && stream.eol())\n return OUTCLASS;\n } else if (stream.match(delimiter)) {\n state.tokenize = tokenOuter;\n return OUTCLASS;\n } else {\n stream.eat(/['\"]/);\n }\n }\n if (singleline) {\n if (parserConf.singleLineStringErrors)\n return ERRORCLASS;\n else\n state.tokenize = tokenOuter;\n }\n return OUTCLASS;\n }\n tokenString.isString = true;\n return tokenString;\n }\n\n function pushPyScope(stream, state) {\n while (top(state).type != \"py\") state.scopes.pop()\n state.scopes.push({offset: top(state).offset + stream.indentUnit,\n type: \"py\",\n align: null})\n }\n\n function pushBracketScope(stream, state, type) {\n var align = stream.match(/^[\\s\\[\\{\\(]*(?:#|$)/, false) ? null : stream.column() + 1\n state.scopes.push({offset: state.indent + (hangingIndent || stream.indentUnit),\n type: type,\n align: align})\n }\n\n function dedent(stream, state) {\n var indented = stream.indentation();\n while (state.scopes.length > 1 && top(state).offset > indented) {\n if (top(state).type != \"py\") return true;\n state.scopes.pop();\n }\n return top(state).offset != indented;\n }\n\n function tokenLexer(stream, state) {\n if (stream.sol()) {\n state.beginningOfLine = true;\n state.dedent = false;\n }\n\n var style = state.tokenize(stream, state);\n var current = stream.current();\n\n // Handle decorators\n if (state.beginningOfLine && current == \"@\")\n return stream.match(identifiers, false) ? \"meta\" : py3 ? \"operator\" : ERRORCLASS;\n\n if (/\\S/.test(current)) state.beginningOfLine = false;\n\n if ((style == \"variable\" || style == \"builtin\")\n && state.lastToken == \"meta\")\n style = \"meta\";\n\n // Handle scope changes.\n if (current == \"pass\" || current == \"return\")\n state.dedent = true;\n\n if (current == \"lambda\") state.lambda = true;\n if (current == \":\" && !state.lambda && top(state).type == \"py\" && stream.match(/^\\s*(?:#|$)/, false))\n pushPyScope(stream, state);\n\n if (current.length == 1 && !/string|comment/.test(style)) {\n var delimiter_index = \"[({\".indexOf(current);\n if (delimiter_index != -1)\n pushBracketScope(stream, state, \"])}\".slice(delimiter_index, delimiter_index+1));\n\n delimiter_index = \"])}\".indexOf(current);\n if (delimiter_index != -1) {\n if (top(state).type == current) state.indent = state.scopes.pop().offset - (hangingIndent || stream.indentUnit)\n else return ERRORCLASS;\n }\n }\n if (state.dedent && stream.eol() && top(state).type == \"py\" && state.scopes.length > 1)\n state.scopes.pop();\n\n return style;\n }\n\n return {\n name: \"python\",\n\n startState: function() {\n return {\n tokenize: tokenBase,\n scopes: [{offset: 0, type: \"py\", align: null}],\n indent: 0,\n lastToken: null,\n lambda: false,\n dedent: 0\n };\n },\n\n token: function(stream, state) {\n var addErr = state.errorToken;\n if (addErr) state.errorToken = false;\n var style = tokenLexer(stream, state);\n\n if (style && style != \"comment\")\n state.lastToken = (style == \"keyword\" || style == \"punctuation\") ? stream.current() : style;\n if (style == \"punctuation\") style = null;\n\n if (stream.eol() && state.lambda)\n state.lambda = false;\n return addErr ? ERRORCLASS : style;\n },\n\n indent: function(state, textAfter, cx) {\n if (state.tokenize != tokenBase)\n return state.tokenize.isString ? null : 0;\n\n var scope = top(state)\n var closing = scope.type == textAfter.charAt(0) ||\n scope.type == \"py\" && !state.dedent && /^(else:|elif |except |finally:)/.test(textAfter)\n if (scope.align != null)\n return scope.align - (closing ? 1 : 0)\n else\n return scope.offset - (closing ? hangingIndent || cx.unit : 0)\n },\n\n languageData: {\n autocomplete: commonKeywords.concat(commonBuiltins).concat([\"exec\", \"print\"]),\n indentOnInput: /^\\s*([\\}\\]\\)]|else:|elif |except |finally:)$/,\n commentTokens: {line: \"#\"},\n closeBrackets: {brackets: [\"(\", \"[\", \"{\", \"'\", '\"', \"'''\", '\"\"\"']}\n }\n };\n};\n\nvar words = function(str) { return str.split(\" \"); };\n\nexport const python = mkPython({})\n\nexport const cython = mkPython({\n extra_keywords: words(\"by cdef cimport cpdef ctypedef enum except \"+\n \"extern gil include nogil property public \"+\n \"readonly struct union DEF IF ELIF ELSE\")\n})\n"],"names":["words","i"],"mappings":"AAAA,SAAS,WAAWA,QAAO;AACzB,SAAO,IAAI,OAAO,QAAQA,OAAM,KAAK,KAAK,IAAI,OAAO;AACvD;AAEA,IAAI,gBAAgB,WAAW,CAAC,OAAO,MAAM,OAAO,IAAI,CAAC;AACzD,IAAI,iBAAiB;AAAA,EAAC;AAAA,EAAM;AAAA,EAAU;AAAA,EAAS;AAAA,EAAS;AAAA,EAClC;AAAA,EAAO;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAQ;AAAA,EAAU;AAAA,EACxC;AAAA,EAAO;AAAA,EAAQ;AAAA,EAAU;AAAA,EAAM;AAAA,EAC/B;AAAA,EAAU;AAAA,EAAQ;AAAA,EAAS;AAAA,EAC3B;AAAA,EAAO;AAAA,EAAS;AAAA,EAAQ;AAAA,EAAS;AAAA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