@vc-shell/framework 1.1.2 → 1.1.4
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/CHANGELOG.md +18 -0
- package/dist/apl-B2DGVGxc.js +76 -0
- package/dist/asciiarmor-2LVJmxlE.js +34 -0
- package/dist/asn1-jKiBa2Ya.js +95 -0
- package/dist/asterisk-DS281yxp.js +271 -0
- package/dist/brainfuck-C_p9pTT8.js +34 -0
- package/dist/clike-BUuHEmgZ.js +620 -0
- package/dist/clojure-CCKyeQKf.js +800 -0
- package/dist/cmake-CuaCgAKt.js +28 -0
- package/dist/cobol-BlTKFDRj.js +72 -0
- package/dist/coffeescript-BVCvwO8I.js +179 -0
- package/dist/commonlisp-D_kxz07b.js +75 -0
- package/dist/crystal-D309uH6_.js +217 -0
- package/dist/css-bIlmDBTK.js +1560 -0
- package/dist/cypher-BMq4Fwjl.js +68 -0
- package/dist/d-BZcgY6La.js +127 -0
- package/dist/diff-Cg9d_RX2.js +18 -0
- package/dist/{assets/dockerfile-D0MivFIF.js → dockerfile-DIy8NleC.js} +36 -41
- package/dist/dtd-CtLokQ-U.js +84 -0
- package/dist/dylan-QYeExnWK.js +234 -0
- package/dist/ebnf-DUPDuY4r.js +78 -0
- package/dist/ecl-CiXN-g_D.js +121 -0
- package/dist/eiffel-yQhjl4T1.js +110 -0
- package/dist/elm-CNT9vbN0.js +108 -0
- package/dist/erlang-CFOYdy9e.js +487 -0
- package/dist/factor-DDOC7X6P.js +65 -0
- package/dist/fcl-CPC2WYrI.js +103 -0
- package/dist/forth-BmxRyE9S.js +60 -0
- package/dist/fortran-9bvPyrOW.js +442 -0
- package/dist/framework.js +288 -29
- package/dist/gas-BdfkXJT_.js +183 -0
- package/dist/gherkin-CJuwpceU.js +34 -0
- package/dist/groovy-DZeT_VM-.js +146 -0
- package/dist/haskell-Bvt3Qq1t.js +375 -0
- package/dist/haxe-70NVW1pR.js +359 -0
- package/dist/http-D9LttvKF.js +44 -0
- package/dist/idl-B6TRFYjl.js +947 -0
- package/dist/{assets/index-BKF-A58l.js → index-BBYKbiRX.js} +79 -92
- package/dist/index-BDm0tcWn.js +145680 -0
- package/dist/{assets/index-CeeaNa4F.js → index-BDqUaIyQ.js} +136 -167
- package/dist/index-BdflTsg6.js +308 -0
- package/dist/{assets/index-CtmpJVwa.js → index-BpBTtmQ6.js} +270 -312
- package/dist/index-Br0y2YMn.js +58 -0
- package/dist/index-CIcET-ZI.js +71 -0
- package/dist/index-CYAMpxnu.js +341 -0
- package/dist/index-Cf2H7YZ1.js +98 -0
- package/dist/{assets/index-Bv_z_qRq.js → index-Ck055pN8.js} +121 -124
- package/dist/index-D-fPN3yf.js +75 -0
- package/dist/{assets/index-BT8o9-M5.js → index-DJOis7Nc.js} +267 -386
- package/dist/index-DKtQMsy4.js +538 -0
- package/dist/{assets/index-DMTL7O1s.js → index-DWTsz5bC.js} +570 -586
- package/dist/{assets/index-C7zlEJy8.js → index-DuY7BIGm.js} +229 -302
- package/dist/{assets/index-B1srGfDb.js → index-o6aSdNED.js} +119 -165
- package/dist/index-wfv8ehcx.js +249 -0
- package/dist/index.css +9 -18
- package/dist/javascript-WMWNx-Vj.js +690 -0
- package/dist/jinja2-DnB6dQmV.js +154 -0
- package/dist/julia-DpvXAuO6.js +241 -0
- package/dist/livescript-CanGTf8u.js +272 -0
- package/dist/lua-XplVlWi_.js +217 -0
- package/dist/mathematica-jaRHnSxC.js +35 -0
- package/dist/mbox-BctzC1hL.js +76 -0
- package/dist/mirc-CFBPAOaF.js +72 -0
- package/dist/mllike-BSnXJBGA.js +272 -0
- package/dist/modelica-vUgVs--1.js +93 -0
- package/dist/mscgen-Cpl0NYLN.js +104 -0
- package/dist/mumps-CQoS1kWX.js +25 -0
- package/dist/nginx-zDPm3Z74.js +89 -0
- package/dist/nsis-fePjrhq7.js +62 -0
- package/dist/ntriples-CsNjv2QF.js +79 -0
- package/dist/octave-C8PmmSRH.js +143 -0
- package/dist/oz-Ce8aN8oE.js +151 -0
- package/dist/pascal-De0D6mP7.js +77 -0
- package/dist/perl-B4bSCe1C.js +915 -0
- package/dist/pig-D24Z8EXi.js +54 -0
- package/dist/powershell-DkYVfTzP.js +249 -0
- package/dist/properties-Dn9wna3M.js +26 -0
- package/dist/protobuf-BPIjwpzm.js +49 -0
- package/dist/pug-BqUR2bBq.js +248 -0
- package/dist/puppet-nyd4dhjf.js +45 -0
- package/dist/python-B5QdSKoL.js +313 -0
- package/dist/q-DXjKs-tC.js +83 -0
- package/dist/r-LKEuhEGI.js +104 -0
- package/dist/rpm-IznJm2Xc.js +57 -0
- package/dist/ruby-CcYfvIk6.js +228 -0
- package/dist/sas-7E8yHoCW.js +105 -0
- package/dist/scheme-DjibxsNh.js +124 -0
- package/dist/shell-C0C2sNA_.js +182 -0
- package/dist/sieve-Bwz7vjP5.js +72 -0
- package/dist/simple-mode-B0dvCdAA.js +89 -0
- package/dist/smalltalk-Bhddl2pB.js +48 -0
- package/dist/solr-BNlsLglM.js +41 -0
- package/dist/sparql-FarWu_Gb.js +197 -0
- package/dist/spreadsheet-C-cy4P5N.js +49 -0
- package/dist/sql-mMre1Bo3.js +282 -0
- package/dist/stex-92raWT1r.js +129 -0
- package/dist/stylus-CAdqWld3.js +250 -0
- package/dist/swift-DSxqR9R6.js +230 -0
- package/dist/tcl-xfoLljhY.js +81 -0
- package/dist/textile-D1AWE-pc.js +295 -0
- package/dist/tiddlywiki-5wqsXtSk.js +155 -0
- package/dist/tiki-__Kn3CeS.js +181 -0
- package/dist/toml-BHiuTcfn.js +49 -0
- package/dist/troff-D2UO-fKf.js +35 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/ttcn-Bsa4sfRm.js +123 -0
- package/dist/ttcn-cfg-Bac_acMi.js +88 -0
- package/dist/turtle-xwJUxoPV.js +80 -0
- package/dist/ui/components/atoms/vc-widget/vc-widget.vue.d.ts.map +1 -1
- package/dist/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue.d.ts.map +1 -1
- package/dist/vb-c2kQGd6-.js +74 -0
- package/dist/vbscript-Dz1TtKsy.js +324 -0
- package/dist/velocity-DJd0pTTC.js +96 -0
- package/dist/verilog-C4VGD9n1.js +263 -0
- package/dist/vhdl-T9HkrbI2.js +106 -0
- package/dist/webidl-CjfDENEo.js +155 -0
- package/dist/xquery-BUQdORAS.js +422 -0
- package/dist/yacas-C0absKBh.js +73 -0
- package/dist/z80-C8rPtw-0.js +61 -0
- package/package.json +4 -4
- package/ui/components/atoms/vc-widget/vc-widget.vue +2 -0
- package/ui/components/organisms/vc-blade/_internal/vc-blade-toolbar/vc-blade-toolbar.vue +65 -32
- package/dist/assets/apl-NdZ6-T1z.js +0 -142
- package/dist/assets/asciiarmor-CmJEbAuq.js +0 -56
- package/dist/assets/asn1-Ctc8K72v.js +0 -192
- package/dist/assets/asterisk-D6r__RMF.js +0 -187
- package/dist/assets/brainfuck-COwWCBpq.js +0 -70
- package/dist/assets/clike-C-PtfL50.js +0 -1019
- package/dist/assets/clojure-C2XPrGCa.js +0 -274
- package/dist/assets/cmake-BGrEgXCL.js +0 -81
- package/dist/assets/cobol-DShPmpZe.js +0 -234
- package/dist/assets/coffeescript-BG8vTfSz.js +0 -329
- package/dist/assets/commonlisp-8oE2EpEe.js +0 -108
- package/dist/assets/core-api-BMLS9FrT.js +0 -8288
- package/dist/assets/core-composables-DYxpIWyY.js +0 -1799
- package/dist/assets/core-constants-DiKDBbnD.js +0 -83
- package/dist/assets/core-directives-QhJx9kWh.js +0 -41
- package/dist/assets/core-interceptors-CSjUvxQ0.js +0 -78
- package/dist/assets/core-plugins-wv2bDZ0l.js +0 -4919
- package/dist/assets/core-services-CAfJRsjs.js +0 -4
- package/dist/assets/core-utilities-BTktq_a-.js +0 -33
- package/dist/assets/crystal--rIRMl16.js +0 -419
- package/dist/assets/css/core-directives-FL4vIIkN.css +0 -73
- package/dist/assets/css/fonts-M1mtyV8L.css +0 -305
- package/dist/assets/css/icons-css-DbCVsovz.css +0 -41
- package/dist/assets/css/shared-components-bnLHdCtf.css +0 -429
- package/dist/assets/css/shared-modules-CNOICmYQ.css +0 -45
- package/dist/assets/css/styles-C62nDZwV.css +0 -4096
- package/dist/assets/css/ui-app-Bh9hmlIB.css +0 -1287
- package/dist/assets/css/ui-content-B29jsmK7.css +0 -1187
- package/dist/assets/css/ui-controls-CRtfFczw.css +0 -387
- package/dist/assets/css/ui-data-CYLxfdUa.css +0 -1555
- package/dist/assets/css/ui-form-C3WrWfVl.css +0 -71
- package/dist/assets/css/ui-form-fields-DOtHhDeM.css +0 -1360
- package/dist/assets/css/ui-helpers-bOoNv5dS.css +0 -37
- package/dist/assets/css/ui-indicators-CybQnCoU.css +0 -628
- package/dist/assets/css/ui-layout-DyGKgizy.css +0 -251
- package/dist/assets/css/ui-media-TWYep8js.css +0 -298
- package/dist/assets/css/ui-media-advanced-BGxy3VSB.css +0 -183
- package/dist/assets/css/ui-navigation-DcPRn8SB.css +0 -1693
- package/dist/assets/css-C_ZeEwz2.js +0 -847
- package/dist/assets/cypher-Bayei42D.js +0 -122
- package/dist/assets/d-B0hhz6be.js +0 -205
- package/dist/assets/diff-DQutOIXs.js +0 -30
- package/dist/assets/dtd-C1CeYVnM.js +0 -121
- package/dist/assets/dylan-Dm9-uD-A.js +0 -337
- package/dist/assets/ebnf-jWG_1Yly.js +0 -151
- package/dist/assets/ecl-CgJPA6z9.js +0 -190
- package/dist/assets/eiffel-lj7uLahq.js +0 -146
- package/dist/assets/elm-Cz7o1ijk.js +0 -230
- package/dist/assets/erlang-CyL5QOyR.js +0 -581
- package/dist/assets/factor-BVWHwYpu.js +0 -65
- package/dist/assets/fcl-DiozYjc8.js +0 -154
- package/dist/assets/forth-B7vn5ze0.js +0 -164
- package/dist/assets/fortran-D2XNEnBT.js +0 -172
- package/dist/assets/gas-B_Tj57Ve.js +0 -343
- package/dist/assets/gherkin-CJ6Qk4EZ.js +0 -147
- package/dist/assets/groovy-ioGz2WSV.js +0 -228
- package/dist/assets/haskell-BHnm1B83.js +0 -239
- package/dist/assets/haxe-Bn6Yo6N3.js +0 -490
- package/dist/assets/http-BOd5SYCT.js +0 -89
- package/dist/assets/idl-FSFk8_xX.js +0 -274
- package/dist/assets/index--5fKpGeN.js +0 -792
- package/dist/assets/index-0lME64YH.js +0 -342
- package/dist/assets/index-B6Ip0FgO.js +0 -437
- package/dist/assets/index-BmV05E5M.js +0 -479
- package/dist/assets/index-C6MavZDA.js +0 -131
- package/dist/assets/index-CwKpgcYl.js +0 -85
- package/dist/assets/index-DRUmDL0J.js +0 -59
- package/dist/assets/index-DgFC-M9G.js +0 -96
- package/dist/assets/javascript-DGrAs70C.js +0 -922
- package/dist/assets/jinja2-D9k5QrXv.js +0 -171
- package/dist/assets/julia-DM42tOPB.js +0 -369
- package/dist/assets/livescript-Dci8HnOi.js +0 -259
- package/dist/assets/lua-CByQu4v6.js +0 -137
- package/dist/assets/lucide-icons-af0BY3bi.js +0 -34555
- package/dist/assets/mathematica-Dkv0uCYF.js +0 -153
- package/dist/assets/mbox-CYTvs5kC.js +0 -114
- package/dist/assets/mirc-DpgP3GCo.js +0 -176
- package/dist/assets/mllike-C6tNn2Yt.js +0 -343
- package/dist/assets/modelica-CR6hTSce.js +0 -192
- package/dist/assets/mscgen-D0GXtzMS.js +0 -149
- package/dist/assets/mumps-Bf1EyDa6.js +0 -129
- package/dist/assets/nginx-By9Phklj.js +0 -163
- package/dist/assets/nsis-B5ggMLQ9.js +0 -80
- package/dist/assets/ntriples-C7VJ7pnm.js +0 -141
- package/dist/assets/octave-6yR_ix15.js +0 -112
- package/dist/assets/oz-CEUnktiQ.js +0 -235
- package/dist/assets/pascal-Dksf1EyF.js +0 -124
- package/dist/assets/perl-B99DUQQt.js +0 -819
- package/dist/assets/pig-DFeDRta6.js +0 -149
- package/dist/assets/powershell-DhwsNWMx.js +0 -381
- package/dist/assets/properties-o21uErwC.js +0 -62
- package/dist/assets/protobuf-YxlANsmD.js +0 -54
- package/dist/assets/pug-bUgjeODZ.js +0 -504
- package/dist/assets/puppet-B8WICGYE.js +0 -205
- package/dist/assets/python-D3FFx1Id.js +0 -389
- package/dist/assets/q-D2Hjhl2C.js +0 -123
- package/dist/assets/r-D73k5lac.js +0 -174
- package/dist/assets/rpm-Duv_WH0z.js +0 -89
- package/dist/assets/ruby-DGCVqZDt.js +0 -287
- package/dist/assets/sas-XjPv1Vy5.js +0 -268
- package/dist/assets/scheme-DeaA28vt.js +0 -263
- package/dist/assets/shared-components-CfAt2hC6.js +0 -1501
- package/dist/assets/shared-composables-v9NkNuAe.js +0 -35
- package/dist/assets/shared-modules-CDP-H5ZB.js +0 -3588
- package/dist/assets/shared-pages-BGRRA5WB.js +0 -20
- package/dist/assets/shell-Bx6QZTgx.js +0 -145
- package/dist/assets/sieve-CWCD62sW.js +0 -178
- package/dist/assets/simple-mode-BAO9cD7H.js +0 -136
- package/dist/assets/smalltalk-DSQbF4MF.js +0 -153
- package/dist/assets/solr-v_XRf31C.js +0 -80
- package/dist/assets/sparql-BrfDqf0-.js +0 -170
- package/dist/assets/spreadsheet-Csn84Pef.js +0 -98
- package/dist/assets/sql-D4utlq1l.js +0 -480
- package/dist/assets/stex-DBkktma-.js +0 -246
- package/dist/assets/stylus-ByG-Fd6f.js +0 -750
- package/dist/assets/swift-CHbTprt3.js +0 -202
- package/dist/assets/tcl-BRlMUELr.js +0 -125
- package/dist/assets/textile-CqfTUjd4.js +0 -441
- package/dist/assets/tiddlywiki-BrsoM8KB.js +0 -278
- package/dist/assets/tiki-D-ivWPkc.js +0 -289
- package/dist/assets/toml-t_IhJu83.js +0 -75
- package/dist/assets/troff-DckGF2AE.js +0 -64
- package/dist/assets/ttcn-B8TAFbRR.js +0 -253
- package/dist/assets/ttcn-cfg-NHh25oCM.js +0 -197
- package/dist/assets/turtle-D9Js0BlL.js +0 -141
- package/dist/assets/ui-app-D31Pr1WY.js +0 -1993
- package/dist/assets/ui-content-B7SxH8y9.js +0 -52887
- package/dist/assets/ui-controls-nmDJYLmC.js +0 -348
- package/dist/assets/ui-data-Ci3b1ye0.js +0 -22901
- package/dist/assets/ui-form-Cs5ooOo7.js +0 -159
- package/dist/assets/ui-form-fields-DFQi31jT.js +0 -40575
- package/dist/assets/ui-helpers-CF-EUlOg.js +0 -1736
- package/dist/assets/ui-indicators-mIQeEqha.js +0 -199
- package/dist/assets/ui-layout-v2XBQky3.js +0 -320
- package/dist/assets/ui-media-WWYrwmZw.js +0 -1259
- package/dist/assets/ui-media-advanced-T8ibi153.js +0 -492
- package/dist/assets/ui-modals-BdZXzI85.js +0 -2
- package/dist/assets/ui-navigation-BtHa6ovW.js +0 -24269
- package/dist/assets/utils-DZK5fu48.js +0 -17216
- package/dist/assets/vb-CbIGLrpY.js +0 -249
- package/dist/assets/vbscript-8ANWle9n.js +0 -320
- package/dist/assets/velocity-D6hz3Hzw.js +0 -186
- package/dist/assets/verilog-DIV442at.js +0 -565
- package/dist/assets/vhdl-BlTiZo_v.js +0 -174
- package/dist/assets/vueuse-CTQm4Zh0.js +0 -9308
- package/dist/assets/webidl-Cp3tcqdk.js +0 -179
- package/dist/assets/xquery-Dd4TBzXv.js +0 -411
- package/dist/assets/yacas-DQ1WucF0.js +0 -182
- package/dist/assets/z80-P1j44jDI.js +0 -102
|
@@ -1,504 +0,0 @@
|
|
|
1
|
-
import { javascript } from './javascript-DGrAs70C.js';
|
|
2
|
-
|
|
3
|
-
var ATTRS_NEST = {
|
|
4
|
-
'{': '}',
|
|
5
|
-
'(': ')',
|
|
6
|
-
'[': ']'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
function defaultCopyState(state) {
|
|
10
|
-
if (typeof state != "object") return state
|
|
11
|
-
let newState = {};
|
|
12
|
-
for (let prop in state) {
|
|
13
|
-
let val = state[prop];
|
|
14
|
-
newState[prop] = val instanceof Array ? val.slice() : val;
|
|
15
|
-
}
|
|
16
|
-
return newState
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
class State {
|
|
20
|
-
constructor(indentUnit) {
|
|
21
|
-
this.indentUnit = indentUnit;
|
|
22
|
-
|
|
23
|
-
this.javaScriptLine = false;
|
|
24
|
-
this.javaScriptLineExcludesColon = false;
|
|
25
|
-
|
|
26
|
-
this.javaScriptArguments = false;
|
|
27
|
-
this.javaScriptArgumentsDepth = 0;
|
|
28
|
-
|
|
29
|
-
this.isInterpolating = false;
|
|
30
|
-
this.interpolationNesting = 0;
|
|
31
|
-
|
|
32
|
-
this.jsState = javascript.startState(indentUnit);
|
|
33
|
-
|
|
34
|
-
this.restOfLine = '';
|
|
35
|
-
|
|
36
|
-
this.isIncludeFiltered = false;
|
|
37
|
-
this.isEach = false;
|
|
38
|
-
|
|
39
|
-
this.lastTag = '';
|
|
40
|
-
|
|
41
|
-
// Attributes Mode
|
|
42
|
-
this.isAttrs = false;
|
|
43
|
-
this.attrsNest = [];
|
|
44
|
-
this.inAttributeName = true;
|
|
45
|
-
this.attributeIsType = false;
|
|
46
|
-
this.attrValue = '';
|
|
47
|
-
|
|
48
|
-
// Indented Mode
|
|
49
|
-
this.indentOf = Infinity;
|
|
50
|
-
this.indentToken = '';
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
copy() {
|
|
54
|
-
var res = new State(this.indentUnit);
|
|
55
|
-
res.javaScriptLine = this.javaScriptLine;
|
|
56
|
-
res.javaScriptLineExcludesColon = this.javaScriptLineExcludesColon;
|
|
57
|
-
res.javaScriptArguments = this.javaScriptArguments;
|
|
58
|
-
res.javaScriptArgumentsDepth = this.javaScriptArgumentsDepth;
|
|
59
|
-
res.isInterpolating = this.isInterpolating;
|
|
60
|
-
res.interpolationNesting = this.interpolationNesting;
|
|
61
|
-
|
|
62
|
-
res.jsState = (javascript.copyState || defaultCopyState)(this.jsState);
|
|
63
|
-
|
|
64
|
-
res.restOfLine = this.restOfLine;
|
|
65
|
-
|
|
66
|
-
res.isIncludeFiltered = this.isIncludeFiltered;
|
|
67
|
-
res.isEach = this.isEach;
|
|
68
|
-
res.lastTag = this.lastTag;
|
|
69
|
-
res.isAttrs = this.isAttrs;
|
|
70
|
-
res.attrsNest = this.attrsNest.slice();
|
|
71
|
-
res.inAttributeName = this.inAttributeName;
|
|
72
|
-
res.attributeIsType = this.attributeIsType;
|
|
73
|
-
res.attrValue = this.attrValue;
|
|
74
|
-
res.indentOf = this.indentOf;
|
|
75
|
-
res.indentToken = this.indentToken;
|
|
76
|
-
|
|
77
|
-
return res
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
function javaScript(stream, state) {
|
|
82
|
-
if (stream.sol()) {
|
|
83
|
-
// if javaScriptLine was set at end of line, ignore it
|
|
84
|
-
state.javaScriptLine = false;
|
|
85
|
-
state.javaScriptLineExcludesColon = false;
|
|
86
|
-
}
|
|
87
|
-
if (state.javaScriptLine) {
|
|
88
|
-
if (state.javaScriptLineExcludesColon && stream.peek() === ':') {
|
|
89
|
-
state.javaScriptLine = false;
|
|
90
|
-
state.javaScriptLineExcludesColon = false;
|
|
91
|
-
return
|
|
92
|
-
}
|
|
93
|
-
var tok = javascript.token(stream, state.jsState);
|
|
94
|
-
if (stream.eol()) state.javaScriptLine = false;
|
|
95
|
-
return tok || true
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
function javaScriptArguments(stream, state) {
|
|
99
|
-
if (state.javaScriptArguments) {
|
|
100
|
-
if (state.javaScriptArgumentsDepth === 0 && stream.peek() !== '(') {
|
|
101
|
-
state.javaScriptArguments = false;
|
|
102
|
-
return
|
|
103
|
-
}
|
|
104
|
-
if (stream.peek() === '(') {
|
|
105
|
-
state.javaScriptArgumentsDepth++;
|
|
106
|
-
} else if (stream.peek() === ')') {
|
|
107
|
-
state.javaScriptArgumentsDepth--;
|
|
108
|
-
}
|
|
109
|
-
if (state.javaScriptArgumentsDepth === 0) {
|
|
110
|
-
state.javaScriptArguments = false;
|
|
111
|
-
return
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
var tok = javascript.token(stream, state.jsState);
|
|
115
|
-
return tok || true
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function yieldStatement(stream) {
|
|
120
|
-
if (stream.match(/^yield\b/)) {
|
|
121
|
-
return 'keyword'
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
function doctype(stream) {
|
|
126
|
-
if (stream.match(/^(?:doctype) *([^\n]+)?/)) return 'meta'
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
function interpolation(stream, state) {
|
|
130
|
-
if (stream.match('#{')) {
|
|
131
|
-
state.isInterpolating = true;
|
|
132
|
-
state.interpolationNesting = 0;
|
|
133
|
-
return 'punctuation'
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
function interpolationContinued(stream, state) {
|
|
138
|
-
if (state.isInterpolating) {
|
|
139
|
-
if (stream.peek() === '}') {
|
|
140
|
-
state.interpolationNesting--;
|
|
141
|
-
if (state.interpolationNesting < 0) {
|
|
142
|
-
stream.next();
|
|
143
|
-
state.isInterpolating = false;
|
|
144
|
-
return 'punctuation'
|
|
145
|
-
}
|
|
146
|
-
} else if (stream.peek() === '{') {
|
|
147
|
-
state.interpolationNesting++;
|
|
148
|
-
}
|
|
149
|
-
return javascript.token(stream, state.jsState) || true
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function caseStatement(stream, state) {
|
|
154
|
-
if (stream.match(/^case\b/)) {
|
|
155
|
-
state.javaScriptLine = true;
|
|
156
|
-
return 'keyword'
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function when(stream, state) {
|
|
161
|
-
if (stream.match(/^when\b/)) {
|
|
162
|
-
state.javaScriptLine = true;
|
|
163
|
-
state.javaScriptLineExcludesColon = true;
|
|
164
|
-
return 'keyword'
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
function defaultStatement(stream) {
|
|
169
|
-
if (stream.match(/^default\b/)) {
|
|
170
|
-
return 'keyword'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
function extendsStatement(stream, state) {
|
|
175
|
-
if (stream.match(/^extends?\b/)) {
|
|
176
|
-
state.restOfLine = 'string';
|
|
177
|
-
return 'keyword'
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function append(stream, state) {
|
|
182
|
-
if (stream.match(/^append\b/)) {
|
|
183
|
-
state.restOfLine = 'variable';
|
|
184
|
-
return 'keyword'
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
function prepend(stream, state) {
|
|
188
|
-
if (stream.match(/^prepend\b/)) {
|
|
189
|
-
state.restOfLine = 'variable';
|
|
190
|
-
return 'keyword'
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
function block(stream, state) {
|
|
194
|
-
if (stream.match(/^block\b *(?:(prepend|append)\b)?/)) {
|
|
195
|
-
state.restOfLine = 'variable';
|
|
196
|
-
return 'keyword'
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
function include(stream, state) {
|
|
201
|
-
if (stream.match(/^include\b/)) {
|
|
202
|
-
state.restOfLine = 'string';
|
|
203
|
-
return 'keyword'
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function includeFiltered(stream, state) {
|
|
208
|
-
if (stream.match(/^include:([a-zA-Z0-9\-]+)/, false) && stream.match('include')) {
|
|
209
|
-
state.isIncludeFiltered = true;
|
|
210
|
-
return 'keyword'
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
function includeFilteredContinued(stream, state) {
|
|
215
|
-
if (state.isIncludeFiltered) {
|
|
216
|
-
var tok = filter(stream, state);
|
|
217
|
-
state.isIncludeFiltered = false;
|
|
218
|
-
state.restOfLine = 'string';
|
|
219
|
-
return tok
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
function mixin(stream, state) {
|
|
224
|
-
if (stream.match(/^mixin\b/)) {
|
|
225
|
-
state.javaScriptLine = true;
|
|
226
|
-
return 'keyword'
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
function call(stream, state) {
|
|
231
|
-
if (stream.match(/^\+([-\w]+)/)) {
|
|
232
|
-
if (!stream.match(/^\( *[-\w]+ *=/, false)) {
|
|
233
|
-
state.javaScriptArguments = true;
|
|
234
|
-
state.javaScriptArgumentsDepth = 0;
|
|
235
|
-
}
|
|
236
|
-
return 'variable'
|
|
237
|
-
}
|
|
238
|
-
if (stream.match('+#{', false)) {
|
|
239
|
-
stream.next();
|
|
240
|
-
state.mixinCallAfter = true;
|
|
241
|
-
return interpolation(stream, state)
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
function callArguments(stream, state) {
|
|
245
|
-
if (state.mixinCallAfter) {
|
|
246
|
-
state.mixinCallAfter = false;
|
|
247
|
-
if (!stream.match(/^\( *[-\w]+ *=/, false)) {
|
|
248
|
-
state.javaScriptArguments = true;
|
|
249
|
-
state.javaScriptArgumentsDepth = 0;
|
|
250
|
-
}
|
|
251
|
-
return true
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function conditional(stream, state) {
|
|
256
|
-
if (stream.match(/^(if|unless|else if|else)\b/)) {
|
|
257
|
-
state.javaScriptLine = true;
|
|
258
|
-
return 'keyword'
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
|
|
262
|
-
function each(stream, state) {
|
|
263
|
-
if (stream.match(/^(- *)?(each|for)\b/)) {
|
|
264
|
-
state.isEach = true;
|
|
265
|
-
return 'keyword'
|
|
266
|
-
}
|
|
267
|
-
}
|
|
268
|
-
function eachContinued(stream, state) {
|
|
269
|
-
if (state.isEach) {
|
|
270
|
-
if (stream.match(/^ in\b/)) {
|
|
271
|
-
state.javaScriptLine = true;
|
|
272
|
-
state.isEach = false;
|
|
273
|
-
return 'keyword'
|
|
274
|
-
} else if (stream.sol() || stream.eol()) {
|
|
275
|
-
state.isEach = false;
|
|
276
|
-
} else if (stream.next()) {
|
|
277
|
-
while (!stream.match(/^ in\b/, false) && stream.next()) {}
|
|
278
|
-
return 'variable'
|
|
279
|
-
}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
function whileStatement(stream, state) {
|
|
284
|
-
if (stream.match(/^while\b/)) {
|
|
285
|
-
state.javaScriptLine = true;
|
|
286
|
-
return 'keyword'
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
function tag(stream, state) {
|
|
291
|
-
var captures;
|
|
292
|
-
if (captures = stream.match(/^(\w(?:[-:\w]*\w)?)\/?/)) {
|
|
293
|
-
state.lastTag = captures[1].toLowerCase();
|
|
294
|
-
return 'tag'
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
function filter(stream, state) {
|
|
299
|
-
if (stream.match(/^:([\w\-]+)/)) {
|
|
300
|
-
setStringMode(stream, state);
|
|
301
|
-
return 'atom'
|
|
302
|
-
}
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
function code(stream, state) {
|
|
306
|
-
if (stream.match(/^(!?=|-)/)) {
|
|
307
|
-
state.javaScriptLine = true;
|
|
308
|
-
return 'punctuation'
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
function id(stream) {
|
|
313
|
-
if (stream.match(/^#([\w-]+)/)) {
|
|
314
|
-
return 'builtin'
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
function className(stream) {
|
|
319
|
-
if (stream.match(/^\.([\w-]+)/)) {
|
|
320
|
-
return 'className'
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function attrs(stream, state) {
|
|
325
|
-
if (stream.peek() == '(') {
|
|
326
|
-
stream.next();
|
|
327
|
-
state.isAttrs = true;
|
|
328
|
-
state.attrsNest = [];
|
|
329
|
-
state.inAttributeName = true;
|
|
330
|
-
state.attrValue = '';
|
|
331
|
-
state.attributeIsType = false;
|
|
332
|
-
return 'punctuation'
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function attrsContinued(stream, state) {
|
|
337
|
-
if (state.isAttrs) {
|
|
338
|
-
if (ATTRS_NEST[stream.peek()]) {
|
|
339
|
-
state.attrsNest.push(ATTRS_NEST[stream.peek()]);
|
|
340
|
-
}
|
|
341
|
-
if (state.attrsNest[state.attrsNest.length - 1] === stream.peek()) {
|
|
342
|
-
state.attrsNest.pop();
|
|
343
|
-
} else if (stream.eat(')')) {
|
|
344
|
-
state.isAttrs = false;
|
|
345
|
-
return 'punctuation'
|
|
346
|
-
}
|
|
347
|
-
if (state.inAttributeName && stream.match(/^[^=,\)!]+/)) {
|
|
348
|
-
if (stream.peek() === '=' || stream.peek() === '!') {
|
|
349
|
-
state.inAttributeName = false;
|
|
350
|
-
state.jsState = javascript.startState(2);
|
|
351
|
-
if (state.lastTag === 'script' && stream.current().trim().toLowerCase() === 'type') {
|
|
352
|
-
state.attributeIsType = true;
|
|
353
|
-
} else {
|
|
354
|
-
state.attributeIsType = false;
|
|
355
|
-
}
|
|
356
|
-
}
|
|
357
|
-
return 'attribute'
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
var tok = javascript.token(stream, state.jsState);
|
|
361
|
-
if (state.attrsNest.length === 0 && (tok === 'string' || tok === 'variable' || tok === 'keyword')) {
|
|
362
|
-
try {
|
|
363
|
-
Function('', 'var x ' + state.attrValue.replace(/,\s*$/, '').replace(/^!/, ''));
|
|
364
|
-
state.inAttributeName = true;
|
|
365
|
-
state.attrValue = '';
|
|
366
|
-
stream.backUp(stream.current().length);
|
|
367
|
-
return attrsContinued(stream, state)
|
|
368
|
-
} catch (ex) {
|
|
369
|
-
//not the end of an attribute
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
state.attrValue += stream.current();
|
|
373
|
-
return tok || true
|
|
374
|
-
}
|
|
375
|
-
}
|
|
376
|
-
|
|
377
|
-
function attributesBlock(stream, state) {
|
|
378
|
-
if (stream.match(/^&attributes\b/)) {
|
|
379
|
-
state.javaScriptArguments = true;
|
|
380
|
-
state.javaScriptArgumentsDepth = 0;
|
|
381
|
-
return 'keyword'
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function indent(stream) {
|
|
386
|
-
if (stream.sol() && stream.eatSpace()) {
|
|
387
|
-
return 'indent'
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
function comment(stream, state) {
|
|
392
|
-
if (stream.match(/^ *\/\/(-)?([^\n]*)/)) {
|
|
393
|
-
state.indentOf = stream.indentation();
|
|
394
|
-
state.indentToken = 'comment';
|
|
395
|
-
return 'comment'
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
function colon(stream) {
|
|
400
|
-
if (stream.match(/^: */)) {
|
|
401
|
-
return 'colon'
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function text(stream, state) {
|
|
406
|
-
if (stream.match(/^(?:\| ?| )([^\n]+)/)) {
|
|
407
|
-
return 'string'
|
|
408
|
-
}
|
|
409
|
-
if (stream.match(/^(<[^\n]*)/, false)) {
|
|
410
|
-
// html string
|
|
411
|
-
setStringMode(stream, state);
|
|
412
|
-
stream.skipToEnd();
|
|
413
|
-
return state.indentToken
|
|
414
|
-
}
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
function dot(stream, state) {
|
|
418
|
-
if (stream.eat('.')) {
|
|
419
|
-
setStringMode(stream, state);
|
|
420
|
-
return 'dot'
|
|
421
|
-
}
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
function fail(stream) {
|
|
425
|
-
stream.next();
|
|
426
|
-
return null
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
function setStringMode(stream, state) {
|
|
431
|
-
state.indentOf = stream.indentation();
|
|
432
|
-
state.indentToken = 'string';
|
|
433
|
-
}
|
|
434
|
-
function restOfLine(stream, state) {
|
|
435
|
-
if (stream.sol()) {
|
|
436
|
-
// if restOfLine was set at end of line, ignore it
|
|
437
|
-
state.restOfLine = '';
|
|
438
|
-
}
|
|
439
|
-
if (state.restOfLine) {
|
|
440
|
-
stream.skipToEnd();
|
|
441
|
-
var tok = state.restOfLine;
|
|
442
|
-
state.restOfLine = '';
|
|
443
|
-
return tok
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
function startState(indentUnit) {
|
|
449
|
-
return new State(indentUnit)
|
|
450
|
-
}
|
|
451
|
-
function copyState(state) {
|
|
452
|
-
return state.copy()
|
|
453
|
-
}
|
|
454
|
-
function nextToken(stream, state) {
|
|
455
|
-
var tok = restOfLine(stream, state)
|
|
456
|
-
|| interpolationContinued(stream, state)
|
|
457
|
-
|| includeFilteredContinued(stream, state)
|
|
458
|
-
|| eachContinued(stream, state)
|
|
459
|
-
|| attrsContinued(stream, state)
|
|
460
|
-
|| javaScript(stream, state)
|
|
461
|
-
|| javaScriptArguments(stream, state)
|
|
462
|
-
|| callArguments(stream, state)
|
|
463
|
-
|
|
464
|
-
|| yieldStatement(stream)
|
|
465
|
-
|| doctype(stream)
|
|
466
|
-
|| interpolation(stream, state)
|
|
467
|
-
|| caseStatement(stream, state)
|
|
468
|
-
|| when(stream, state)
|
|
469
|
-
|| defaultStatement(stream)
|
|
470
|
-
|| extendsStatement(stream, state)
|
|
471
|
-
|| append(stream, state)
|
|
472
|
-
|| prepend(stream, state)
|
|
473
|
-
|| block(stream, state)
|
|
474
|
-
|| include(stream, state)
|
|
475
|
-
|| includeFiltered(stream, state)
|
|
476
|
-
|| mixin(stream, state)
|
|
477
|
-
|| call(stream, state)
|
|
478
|
-
|| conditional(stream, state)
|
|
479
|
-
|| each(stream, state)
|
|
480
|
-
|| whileStatement(stream, state)
|
|
481
|
-
|| tag(stream, state)
|
|
482
|
-
|| filter(stream, state)
|
|
483
|
-
|| code(stream, state)
|
|
484
|
-
|| id(stream)
|
|
485
|
-
|| className(stream)
|
|
486
|
-
|| attrs(stream, state)
|
|
487
|
-
|| attributesBlock(stream, state)
|
|
488
|
-
|| indent(stream)
|
|
489
|
-
|| text(stream, state)
|
|
490
|
-
|| comment(stream, state)
|
|
491
|
-
|| colon(stream)
|
|
492
|
-
|| dot(stream, state)
|
|
493
|
-
|| fail(stream);
|
|
494
|
-
|
|
495
|
-
return tok === true ? null : tok
|
|
496
|
-
}
|
|
497
|
-
|
|
498
|
-
const pug = {
|
|
499
|
-
startState: startState,
|
|
500
|
-
copyState: copyState,
|
|
501
|
-
token: nextToken
|
|
502
|
-
};
|
|
503
|
-
|
|
504
|
-
export { pug };
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
// Stores the words from the define method
|
|
2
|
-
var words = {};
|
|
3
|
-
// Taken, mostly, from the Puppet official variable standards regex
|
|
4
|
-
var variable_regex = /({)?([a-z][a-z0-9_]*)?((::[a-z][a-z0-9_]*)*::)?[a-zA-Z0-9_]+(})?/;
|
|
5
|
-
|
|
6
|
-
// Takes a string of words separated by spaces and adds them as
|
|
7
|
-
// keys with the value of the first argument 'style'
|
|
8
|
-
function define(style, string) {
|
|
9
|
-
var split = string.split(' ');
|
|
10
|
-
for (var i = 0; i < split.length; i++) {
|
|
11
|
-
words[split[i]] = style;
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
// Takes commonly known puppet types/words and classifies them to a style
|
|
16
|
-
define('keyword', 'class define site node include import inherits');
|
|
17
|
-
define('keyword', 'case if else in and elsif default or');
|
|
18
|
-
define('atom', 'false true running present absent file directory undef');
|
|
19
|
-
define('builtin', 'action augeas burst chain computer cron destination dport exec ' +
|
|
20
|
-
'file filebucket group host icmp iniface interface jump k5login limit log_level ' +
|
|
21
|
-
'log_prefix macauthorization mailalias maillist mcx mount nagios_command ' +
|
|
22
|
-
'nagios_contact nagios_contactgroup nagios_host nagios_hostdependency ' +
|
|
23
|
-
'nagios_hostescalation nagios_hostextinfo nagios_hostgroup nagios_service ' +
|
|
24
|
-
'nagios_servicedependency nagios_serviceescalation nagios_serviceextinfo ' +
|
|
25
|
-
'nagios_servicegroup nagios_timeperiod name notify outiface package proto reject ' +
|
|
26
|
-
'resources router schedule scheduled_task selboolean selmodule service source ' +
|
|
27
|
-
'sport ssh_authorized_key sshkey stage state table tidy todest toports tosource ' +
|
|
28
|
-
'user vlan yumrepo zfs zone zpool');
|
|
29
|
-
|
|
30
|
-
// After finding a start of a string ('|") this function attempts to find the end;
|
|
31
|
-
// If a variable is encountered along the way, we display it differently when it
|
|
32
|
-
// is encapsulated in a double-quoted string.
|
|
33
|
-
function tokenString(stream, state) {
|
|
34
|
-
var current, prev, found_var = false;
|
|
35
|
-
while (!stream.eol() && (current = stream.next()) != state.pending) {
|
|
36
|
-
if (current === '$' && prev != '\\' && state.pending == '"') {
|
|
37
|
-
found_var = true;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
prev = current;
|
|
41
|
-
}
|
|
42
|
-
if (found_var) {
|
|
43
|
-
stream.backUp(1);
|
|
44
|
-
}
|
|
45
|
-
if (current == state.pending) {
|
|
46
|
-
state.continueString = false;
|
|
47
|
-
} else {
|
|
48
|
-
state.continueString = true;
|
|
49
|
-
}
|
|
50
|
-
return "string";
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Main function
|
|
54
|
-
function tokenize(stream, state) {
|
|
55
|
-
// Matches one whole word
|
|
56
|
-
var word = stream.match(/[\w]+/, false);
|
|
57
|
-
// Matches attributes (i.e. ensure => present ; 'ensure' would be matched)
|
|
58
|
-
var attribute = stream.match(/(\s+)?\w+\s+=>.*/, false);
|
|
59
|
-
// Matches non-builtin resource declarations
|
|
60
|
-
// (i.e. "apache::vhost {" or "mycustomclasss {" would be matched)
|
|
61
|
-
var resource = stream.match(/(\s+)?[\w:_]+(\s+)?{/, false);
|
|
62
|
-
// Matches virtual and exported resources (i.e. @@user { ; and the like)
|
|
63
|
-
var special_resource = stream.match(/(\s+)?[@]{1,2}[\w:_]+(\s+)?{/, false);
|
|
64
|
-
|
|
65
|
-
// Finally advance the stream
|
|
66
|
-
var ch = stream.next();
|
|
67
|
-
|
|
68
|
-
// Have we found a variable?
|
|
69
|
-
if (ch === '$') {
|
|
70
|
-
if (stream.match(variable_regex)) {
|
|
71
|
-
// If so, and its in a string, assign it a different color
|
|
72
|
-
return state.continueString ? 'variableName.special' : 'variable';
|
|
73
|
-
}
|
|
74
|
-
// Otherwise return an invalid variable
|
|
75
|
-
return "error";
|
|
76
|
-
}
|
|
77
|
-
// Should we still be looking for the end of a string?
|
|
78
|
-
if (state.continueString) {
|
|
79
|
-
// If so, go through the loop again
|
|
80
|
-
stream.backUp(1);
|
|
81
|
-
return tokenString(stream, state);
|
|
82
|
-
}
|
|
83
|
-
// Are we in a definition (class, node, define)?
|
|
84
|
-
if (state.inDefinition) {
|
|
85
|
-
// If so, return def (i.e. for 'class myclass {' ; 'myclass' would be matched)
|
|
86
|
-
if (stream.match(/(\s+)?[\w:_]+(\s+)?/)) {
|
|
87
|
-
return 'def';
|
|
88
|
-
}
|
|
89
|
-
// Match the rest it the next time around
|
|
90
|
-
stream.match(/\s+{/);
|
|
91
|
-
state.inDefinition = false;
|
|
92
|
-
}
|
|
93
|
-
// Are we in an 'include' statement?
|
|
94
|
-
if (state.inInclude) {
|
|
95
|
-
// Match and return the included class
|
|
96
|
-
stream.match(/(\s+)?\S+(\s+)?/);
|
|
97
|
-
state.inInclude = false;
|
|
98
|
-
return 'def';
|
|
99
|
-
}
|
|
100
|
-
// Do we just have a function on our hands?
|
|
101
|
-
// In 'ensure_resource("myclass")', 'ensure_resource' is matched
|
|
102
|
-
if (stream.match(/(\s+)?\w+\(/)) {
|
|
103
|
-
stream.backUp(1);
|
|
104
|
-
return 'def';
|
|
105
|
-
}
|
|
106
|
-
// Have we matched the prior attribute regex?
|
|
107
|
-
if (attribute) {
|
|
108
|
-
stream.match(/(\s+)?\w+/);
|
|
109
|
-
return 'tag';
|
|
110
|
-
}
|
|
111
|
-
// Do we have Puppet specific words?
|
|
112
|
-
if (word && words.hasOwnProperty(word)) {
|
|
113
|
-
// Negates the initial next()
|
|
114
|
-
stream.backUp(1);
|
|
115
|
-
// rs move the stream
|
|
116
|
-
stream.match(/[\w]+/);
|
|
117
|
-
// We want to process these words differently
|
|
118
|
-
// do to the importance they have in Puppet
|
|
119
|
-
if (stream.match(/\s+\S+\s+{/, false)) {
|
|
120
|
-
state.inDefinition = true;
|
|
121
|
-
}
|
|
122
|
-
if (word == 'include') {
|
|
123
|
-
state.inInclude = true;
|
|
124
|
-
}
|
|
125
|
-
// Returns their value as state in the prior define methods
|
|
126
|
-
return words[word];
|
|
127
|
-
}
|
|
128
|
-
// Is there a match on a reference?
|
|
129
|
-
if (/(^|\s+)[A-Z][\w:_]+/.test(word)) {
|
|
130
|
-
// Negate the next()
|
|
131
|
-
stream.backUp(1);
|
|
132
|
-
// Match the full reference
|
|
133
|
-
stream.match(/(^|\s+)[A-Z][\w:_]+/);
|
|
134
|
-
return 'def';
|
|
135
|
-
}
|
|
136
|
-
// Have we matched the prior resource regex?
|
|
137
|
-
if (resource) {
|
|
138
|
-
stream.match(/(\s+)?[\w:_]+/);
|
|
139
|
-
return 'def';
|
|
140
|
-
}
|
|
141
|
-
// Have we matched the prior special_resource regex?
|
|
142
|
-
if (special_resource) {
|
|
143
|
-
stream.match(/(\s+)?[@]{1,2}/);
|
|
144
|
-
return 'atom';
|
|
145
|
-
}
|
|
146
|
-
// Match all the comments. All of them.
|
|
147
|
-
if (ch == "#") {
|
|
148
|
-
stream.skipToEnd();
|
|
149
|
-
return "comment";
|
|
150
|
-
}
|
|
151
|
-
// Have we found a string?
|
|
152
|
-
if (ch == "'" || ch == '"') {
|
|
153
|
-
// Store the type (single or double)
|
|
154
|
-
state.pending = ch;
|
|
155
|
-
// Perform the looping function to find the end
|
|
156
|
-
return tokenString(stream, state);
|
|
157
|
-
}
|
|
158
|
-
// Match all the brackets
|
|
159
|
-
if (ch == '{' || ch == '}') {
|
|
160
|
-
return 'bracket';
|
|
161
|
-
}
|
|
162
|
-
// Match characters that we are going to assume
|
|
163
|
-
// are trying to be regex
|
|
164
|
-
if (ch == '/') {
|
|
165
|
-
stream.match(/^[^\/]*\//);
|
|
166
|
-
return 'string.special';
|
|
167
|
-
}
|
|
168
|
-
// Match all the numbers
|
|
169
|
-
if (ch.match(/[0-9]/)) {
|
|
170
|
-
stream.eatWhile(/[0-9]+/);
|
|
171
|
-
return 'number';
|
|
172
|
-
}
|
|
173
|
-
// Match the '=' and '=>' operators
|
|
174
|
-
if (ch == '=') {
|
|
175
|
-
if (stream.peek() == '>') {
|
|
176
|
-
stream.next();
|
|
177
|
-
}
|
|
178
|
-
return "operator";
|
|
179
|
-
}
|
|
180
|
-
// Keep advancing through all the rest
|
|
181
|
-
stream.eatWhile(/[\w-]/);
|
|
182
|
-
// Return a blank line for everything else
|
|
183
|
-
return null;
|
|
184
|
-
}
|
|
185
|
-
// Start it all
|
|
186
|
-
const puppet = {
|
|
187
|
-
name: "puppet",
|
|
188
|
-
|
|
189
|
-
startState: function () {
|
|
190
|
-
var state = {};
|
|
191
|
-
state.inDefinition = false;
|
|
192
|
-
state.inInclude = false;
|
|
193
|
-
state.continueString = false;
|
|
194
|
-
state.pending = false;
|
|
195
|
-
return state;
|
|
196
|
-
},
|
|
197
|
-
token: function (stream, state) {
|
|
198
|
-
// Strip the spaces, but regex will account for them eitherway
|
|
199
|
-
if (stream.eatSpace()) return null;
|
|
200
|
-
// Go through the main process
|
|
201
|
-
return tokenize(stream, state);
|
|
202
|
-
}
|
|
203
|
-
};
|
|
204
|
-
|
|
205
|
-
export { puppet };
|