@harmoniclabs/monaco-editor 0.52.0
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/.azure-pipelines/publish-nightly.yml +90 -0
- package/.azure-pipelines/publish-stable.yml +89 -0
- package/.devcontainer/devcontainer.json +8 -0
- package/.gitattributes +1 -0
- package/.github/ISSUE_TEMPLATE/1_bug_report.yaml +57 -0
- package/.github/ISSUE_TEMPLATE/2_feature_request.yaml +38 -0
- package/.github/ISSUE_TEMPLATE/3_other.md +4 -0
- package/.github/ISSUE_TEMPLATE/config.yml +5 -0
- package/.github/publish-failure-issue-template.md +7 -0
- package/.github/workflows/ci.yml +76 -0
- package/.github/workflows/website.yml +66 -0
- package/.husky/pre-commit +4 -0
- package/.mocharc.json +4 -0
- package/.nvmrc +1 -0
- package/.prettierignore +17 -0
- package/.prettierrc +8 -0
- package/.vscode/launch.json +68 -0
- package/.vscode/settings.json +16 -0
- package/.vscode/tasks.json +30 -0
- package/CHANGELOG.md +1655 -0
- package/CONTRIBUTING.md +125 -0
- package/LICENSE.txt +21 -0
- package/MAINTAINING.md +55 -0
- package/README.md +122 -0
- package/SECURITY.md +41 -0
- package/ThirdPartyNotices.txt +392 -0
- package/build/build-languages.ts +212 -0
- package/build/build-monaco-editor.ts +463 -0
- package/build/check-samples.ts +53 -0
- package/build/fillers/vscode-nls.ts +46 -0
- package/build/fs.ts +80 -0
- package/build/importTypescript.ts +192 -0
- package/build/npm/installAll.ts +44 -0
- package/build/npm/removeAll.ts +20 -0
- package/build/postinstall.ts +23 -0
- package/build/releaseMetadata.ts +280 -0
- package/build/simpleserver.ts +69 -0
- package/build/tsconfig.json +8 -0
- package/build/utils.ts +291 -0
- package/docs/code-structure.dio.svg +275 -0
- package/docs/debugging-core.gif +0 -0
- package/docs/debugging-languages.gif +0 -0
- package/docs/integrate-amd.md +28 -0
- package/docs/integrate-esm.md +229 -0
- package/docs/launch config.png +0 -0
- package/docs/out-folders.dio.svg +347 -0
- package/editor.code-workspace +13 -0
- package/gulpfile.js +9 -0
- package/package.json +80 -0
- package/samples/README.md +36 -0
- package/samples/browser-amd-diff-editor/index.html +62 -0
- package/samples/browser-amd-diff-editor/modified.txt +74 -0
- package/samples/browser-amd-diff-editor/original.txt +61 -0
- package/samples/browser-amd-editor/index.html +24 -0
- package/samples/browser-amd-iframe/index.html +70 -0
- package/samples/browser-amd-iframe/inner.html +34 -0
- package/samples/browser-amd-localized/index.html +30 -0
- package/samples/browser-amd-monarch/index.html +105 -0
- package/samples/browser-amd-requirejs/index.html +26 -0
- package/samples/browser-amd-shadow-dom/index.html +50 -0
- package/samples/browser-amd-shared-model/index.html +29 -0
- package/samples/browser-amd-trusted-types/index.html +42 -0
- package/samples/browser-esm-esbuild/build.js +96 -0
- package/samples/browser-esm-esbuild/index.html +18 -0
- package/samples/browser-esm-esbuild/index.js +24 -0
- package/samples/browser-esm-esbuild/package.json +6 -0
- package/samples/browser-esm-parcel/index.html +19 -0
- package/samples/browser-esm-parcel/package-lock.json +3953 -0
- package/samples/browser-esm-parcel/package.json +10 -0
- package/samples/browser-esm-parcel/src/index.html +11 -0
- package/samples/browser-esm-parcel/src/index.js +29 -0
- package/samples/browser-esm-vite-react/index.html +12 -0
- package/samples/browser-esm-vite-react/package-lock.json +2341 -0
- package/samples/browser-esm-vite-react/package.json +20 -0
- package/samples/browser-esm-vite-react/src/components/Editor.module.css +4 -0
- package/samples/browser-esm-vite-react/src/components/Editor.tsx +25 -0
- package/samples/browser-esm-vite-react/src/main.tsx +11 -0
- package/samples/browser-esm-vite-react/src/userWorker.ts +27 -0
- package/samples/browser-esm-vite-react/src/vite-env.d.ts +1 -0
- package/samples/browser-esm-vite-react/tsconfig.json +11 -0
- package/samples/browser-esm-vite-react/vite.config.ts +7 -0
- package/samples/browser-esm-webpack/index.html +20 -0
- package/samples/browser-esm-webpack/index.js +24 -0
- package/samples/browser-esm-webpack/package.json +6 -0
- package/samples/browser-esm-webpack/webpack.config.js +30 -0
- package/samples/browser-esm-webpack-monaco-plugin/index.html +20 -0
- package/samples/browser-esm-webpack-monaco-plugin/index.js +16 -0
- package/samples/browser-esm-webpack-monaco-plugin/package.json +6 -0
- package/samples/browser-esm-webpack-monaco-plugin/webpack.config.js +28 -0
- package/samples/browser-esm-webpack-small/generate-imports.js +140 -0
- package/samples/browser-esm-webpack-small/index.html +26 -0
- package/samples/browser-esm-webpack-small/index.js +168 -0
- package/samples/browser-esm-webpack-small/package.json +7 -0
- package/samples/browser-esm-webpack-small/webpack.config.js +35 -0
- package/samples/browser-esm-webpack-typescript/package.json +7 -0
- package/samples/browser-esm-webpack-typescript/src/index.css +5 -0
- package/samples/browser-esm-webpack-typescript/src/index.ts +26 -0
- package/samples/browser-esm-webpack-typescript/tsconfig.json +16 -0
- package/samples/browser-esm-webpack-typescript/webpack.config.js +44 -0
- package/samples/browser-esm-webpack-typescript-react/package-lock.json +6183 -0
- package/samples/browser-esm-webpack-typescript-react/package.json +21 -0
- package/samples/browser-esm-webpack-typescript-react/src/components/Editor.tsx +38 -0
- package/samples/browser-esm-webpack-typescript-react/src/index.css +5 -0
- package/samples/browser-esm-webpack-typescript-react/src/index.html +10 -0
- package/samples/browser-esm-webpack-typescript-react/src/index.tsx +12 -0
- package/samples/browser-esm-webpack-typescript-react/tsconfig.json +18 -0
- package/samples/browser-esm-webpack-typescript-react/webpack.config.js +59 -0
- package/samples/browser-script-editor/index.html +28 -0
- package/samples/electron-amd/electron-index.html +37 -0
- package/samples/electron-amd/index.html +18 -0
- package/samples/electron-amd/main.js +32 -0
- package/samples/electron-amd/package.json +7 -0
- package/samples/electron-amd-nodeIntegration/electron-index.html +46 -0
- package/samples/electron-amd-nodeIntegration/index.html +18 -0
- package/samples/electron-amd-nodeIntegration/main.js +37 -0
- package/samples/electron-amd-nodeIntegration/package.json +7 -0
- package/samples/electron-esm-webpack/index.js +24 -0
- package/samples/electron-esm-webpack/main.js +32 -0
- package/samples/electron-esm-webpack/package.json +8 -0
- package/samples/electron-esm-webpack/webpack.config.js +29 -0
- package/samples/nwjs-amd/index.html +48 -0
- package/samples/nwjs-amd-v2/index.html +57 -0
- package/samples/package-lock.json +7808 -0
- package/samples/package.json +32 -0
- package/scripts/ci/env.ts +15 -0
- package/scripts/ci/monaco-editor-core-prepare.ts +81 -0
- package/scripts/ci/monaco-editor-core.sh +34 -0
- package/scripts/ci/monaco-editor-prepare.ts +75 -0
- package/scripts/ci/monaco-editor.sh +29 -0
- package/scripts/lib/index.ts +95 -0
- package/src/basic-languages/_.contribution.ts +80 -0
- package/src/basic-languages/abap/abap.contribution.ts +24 -0
- package/src/basic-languages/abap/abap.test.ts +360 -0
- package/src/basic-languages/abap/abap.ts +1390 -0
- package/src/basic-languages/apex/apex.contribution.ts +25 -0
- package/src/basic-languages/apex/apex.test.ts +700 -0
- package/src/basic-languages/apex/apex.ts +355 -0
- package/src/basic-languages/azcli/azcli.contribution.ts +24 -0
- package/src/basic-languages/azcli/azcli.test.ts +172 -0
- package/src/basic-languages/azcli/azcli.ts +77 -0
- package/src/basic-languages/bat/bat.contribution.ts +24 -0
- package/src/basic-languages/bat/bat.test.ts +397 -0
- package/src/basic-languages/bat/bat.ts +121 -0
- package/src/basic-languages/bicep/bicep.contribution.ts +24 -0
- package/src/basic-languages/bicep/bicep.test.ts +1063 -0
- package/src/basic-languages/bicep/bicep.ts +129 -0
- package/src/basic-languages/cameligo/cameligo.contribution.ts +24 -0
- package/src/basic-languages/cameligo/cameligo.test.ts +144 -0
- package/src/basic-languages/cameligo/cameligo.ts +193 -0
- package/src/basic-languages/clojure/clojure.contribution.ts +24 -0
- package/src/basic-languages/clojure/clojure.test.ts +943 -0
- package/src/basic-languages/clojure/clojure.ts +792 -0
- package/src/basic-languages/coffee/coffee.contribution.ts +25 -0
- package/src/basic-languages/coffee/coffee.test.ts +2363 -0
- package/src/basic-languages/coffee/coffee.ts +258 -0
- package/src/basic-languages/cpp/cpp.contribution.ts +38 -0
- package/src/basic-languages/cpp/cpp.test.ts +979 -0
- package/src/basic-languages/cpp/cpp.ts +416 -0
- package/src/basic-languages/csharp/csharp.contribution.ts +24 -0
- package/src/basic-languages/csharp/csharp.test.ts +976 -0
- package/src/basic-languages/csharp/csharp.ts +352 -0
- package/src/basic-languages/csp/csp.contribution.ts +24 -0
- package/src/basic-languages/csp/csp.test.ts +8 -0
- package/src/basic-languages/csp/csp.ts +58 -0
- package/src/basic-languages/css/css.contribution.ts +25 -0
- package/src/basic-languages/css/css.test.ts +591 -0
- package/src/basic-languages/css/css.ts +215 -0
- package/src/basic-languages/cypher/cypher.contribution.ts +24 -0
- package/src/basic-languages/cypher/cypher.test.ts +327 -0
- package/src/basic-languages/cypher/cypher.ts +274 -0
- package/src/basic-languages/dart/dart.contribution.ts +25 -0
- package/src/basic-languages/dart/dart.test.ts +558 -0
- package/src/basic-languages/dart/dart.ts +305 -0
- package/src/basic-languages/dockerfile/dockerfile.contribution.ts +25 -0
- package/src/basic-languages/dockerfile/dockerfile.test.ts +238 -0
- package/src/basic-languages/dockerfile/dockerfile.ts +145 -0
- package/src/basic-languages/ecl/ecl.contribution.ts +24 -0
- package/src/basic-languages/ecl/ecl.test.ts +8 -0
- package/src/basic-languages/ecl/ecl.ts +481 -0
- package/src/basic-languages/elixir/elixir.contribution.ts +24 -0
- package/src/basic-languages/elixir/elixir.test.ts +447 -0
- package/src/basic-languages/elixir/elixir.ts +656 -0
- package/src/basic-languages/flow9/flow9.contribution.ts +24 -0
- package/src/basic-languages/flow9/flow9.test.ts +148 -0
- package/src/basic-languages/flow9/flow9.ts +160 -0
- package/src/basic-languages/freemarker2/freemarker2-angle-bracket.test.ts +3099 -0
- package/src/basic-languages/freemarker2/freemarker2-angle-dollar.test.ts +3099 -0
- package/src/basic-languages/freemarker2/freemarker2-auto-bracket.test.ts +5358 -0
- package/src/basic-languages/freemarker2/freemarker2-auto-dollar.test.ts +5361 -0
- package/src/basic-languages/freemarker2/freemarker2-bracket-bracket.test.ts +3086 -0
- package/src/basic-languages/freemarker2/freemarker2-bracket-dollar.test.ts +3086 -0
- package/src/basic-languages/freemarker2/freemarker2.contribution.ts +111 -0
- package/src/basic-languages/freemarker2/freemarker2.ts +1230 -0
- package/src/basic-languages/fsharp/fsharp.contribution.ts +24 -0
- package/src/basic-languages/fsharp/fsharp.test.ts +491 -0
- package/src/basic-languages/fsharp/fsharp.ts +237 -0
- package/src/basic-languages/go/go.contribution.ts +24 -0
- package/src/basic-languages/go/go.test.ts +1492 -0
- package/src/basic-languages/go/go.ts +238 -0
- package/src/basic-languages/graphql/graphql.contribution.ts +25 -0
- package/src/basic-languages/graphql/graphql.test.ts +138 -0
- package/src/basic-languages/graphql/graphql.ts +174 -0
- package/src/basic-languages/handlebars/handlebars.contribution.ts +25 -0
- package/src/basic-languages/handlebars/handlebars.test.ts +354 -0
- package/src/basic-languages/handlebars/handlebars.ts +432 -0
- package/src/basic-languages/hcl/hcl.contribution.ts +24 -0
- package/src/basic-languages/hcl/hcl.test.ts +1228 -0
- package/src/basic-languages/hcl/hcl.ts +189 -0
- package/src/basic-languages/html/html.contribution.ts +25 -0
- package/src/basic-languages/html/html.test.ts +743 -0
- package/src/basic-languages/html/html.ts +355 -0
- package/src/basic-languages/ini/ini.contribution.ts +25 -0
- package/src/basic-languages/ini/ini.ts +82 -0
- package/src/basic-languages/java/java.contribution.ts +25 -0
- package/src/basic-languages/java/java.test.ts +878 -0
- package/src/basic-languages/java/java.ts +252 -0
- package/src/basic-languages/javascript/javascript.contribution.ts +27 -0
- package/src/basic-languages/javascript/javascript.test.ts +924 -0
- package/src/basic-languages/javascript/javascript.ts +77 -0
- package/src/basic-languages/julia/julia.contribution.ts +24 -0
- package/src/basic-languages/julia/julia.test.ts +38 -0
- package/src/basic-languages/julia/julia.ts +550 -0
- package/src/basic-languages/kotlin/kotlin.contribution.ts +25 -0
- package/src/basic-languages/kotlin/kotlin.test.ts +753 -0
- package/src/basic-languages/kotlin/kotlin.ts +273 -0
- package/src/basic-languages/less/less.contribution.ts +25 -0
- package/src/basic-languages/less/less.test.ts +1560 -0
- package/src/basic-languages/less/less.ts +198 -0
- package/src/basic-languages/lexon/lexon.contribution.ts +24 -0
- package/src/basic-languages/lexon/lexon.test.ts +145 -0
- package/src/basic-languages/lexon/lexon.ts +179 -0
- package/src/basic-languages/liquid/liquid.contribution.ts +25 -0
- package/src/basic-languages/liquid/liquid.test.ts +209 -0
- package/src/basic-languages/liquid/liquid.ts +251 -0
- package/src/basic-languages/lua/lua.contribution.ts +24 -0
- package/src/basic-languages/lua/lua.test.ts +86 -0
- package/src/basic-languages/lua/lua.ts +178 -0
- package/src/basic-languages/m3/m3.contribution.ts +24 -0
- package/src/basic-languages/m3/m3.test.ts +119 -0
- package/src/basic-languages/m3/m3.ts +226 -0
- package/src/basic-languages/markdown/markdown.contribution.ts +24 -0
- package/src/basic-languages/markdown/markdown.test.ts +95 -0
- package/src/basic-languages/markdown/markdown.ts +256 -0
- package/src/basic-languages/mdx/mdx.contribution.ts +24 -0
- package/src/basic-languages/mdx/mdx.test.ts +171 -0
- package/src/basic-languages/mdx/mdx.ts +163 -0
- package/src/basic-languages/mips/mips.contribution.ts +25 -0
- package/src/basic-languages/mips/mips.test.ts +239 -0
- package/src/basic-languages/mips/mips.ts +223 -0
- package/src/basic-languages/monaco.contribution.ts +87 -0
- package/src/basic-languages/msdax/msdax.contribution.ts +24 -0
- package/src/basic-languages/msdax/msdax.test.ts +444 -0
- package/src/basic-languages/msdax/msdax.ts +382 -0
- package/src/basic-languages/mysql/keywords.js +32 -0
- package/src/basic-languages/mysql/keywords.mysql.txt +750 -0
- package/src/basic-languages/mysql/mysql.contribution.ts +24 -0
- package/src/basic-languages/mysql/mysql.test.ts +561 -0
- package/src/basic-languages/mysql/mysql.ts +885 -0
- package/src/basic-languages/objective-c/objective-c.contribution.ts +24 -0
- package/src/basic-languages/objective-c/objective-c.test.ts +368 -0
- package/src/basic-languages/objective-c/objective-c.ts +219 -0
- package/src/basic-languages/pascal/pascal.contribution.ts +25 -0
- package/src/basic-languages/pascal/pascal.test.ts +151 -0
- package/src/basic-languages/pascal/pascal.ts +270 -0
- package/src/basic-languages/pascaligo/pascaligo.contribution.ts +24 -0
- package/src/basic-languages/pascaligo/pascaligo.test.ts +143 -0
- package/src/basic-languages/pascaligo/pascaligo.ts +183 -0
- package/src/basic-languages/pebble/pebble.contribution.ts +24 -0
- package/src/basic-languages/pebble/pebble.test.ts +178 -0
- package/src/basic-languages/pebble/pebble.ts +457 -0
- package/src/basic-languages/perl/perl.contribution.ts +24 -0
- package/src/basic-languages/perl/perl.test.ts +475 -0
- package/src/basic-languages/perl/perl.ts +664 -0
- package/src/basic-languages/pgsql/keywords.js +30 -0
- package/src/basic-languages/pgsql/keywords.postgresql.txt +827 -0
- package/src/basic-languages/pgsql/pgsql.contribution.ts +24 -0
- package/src/basic-languages/pgsql/pgsql.test.ts +595 -0
- package/src/basic-languages/pgsql/pgsql.ts +858 -0
- package/src/basic-languages/php/php.contribution.ts +25 -0
- package/src/basic-languages/php/php.test.ts +2409 -0
- package/src/basic-languages/php/php.ts +636 -0
- package/src/basic-languages/pla/pla.contribution.ts +23 -0
- package/src/basic-languages/pla/pla.test.ts +598 -0
- package/src/basic-languages/pla/pla.ts +157 -0
- package/src/basic-languages/postiats/postiats.contribution.ts +24 -0
- package/src/basic-languages/postiats/postiats.test.ts +1050 -0
- package/src/basic-languages/postiats/postiats.ts +748 -0
- package/src/basic-languages/powerquery/powerquery.contribution.ts +24 -0
- package/src/basic-languages/powerquery/powerquery.test.ts +416 -0
- package/src/basic-languages/powerquery/powerquery.ts +917 -0
- package/src/basic-languages/powershell/powershell.contribution.ts +24 -0
- package/src/basic-languages/powershell/powershell.test.ts +884 -0
- package/src/basic-languages/powershell/powershell.ts +263 -0
- package/src/basic-languages/protobuf/protobuf.contribution.ts +24 -0
- package/src/basic-languages/protobuf/protobuf.test.ts +2073 -0
- package/src/basic-languages/protobuf/protobuf.ts +463 -0
- package/src/basic-languages/pug/pug.contribution.ts +24 -0
- package/src/basic-languages/pug/pug.test.ts +473 -0
- package/src/basic-languages/pug/pug.ts +434 -0
- package/src/basic-languages/python/python.contribution.ts +25 -0
- package/src/basic-languages/python/python.test.ts +257 -0
- package/src/basic-languages/python/python.ts +296 -0
- package/src/basic-languages/qsharp/qsharp.contribution.ts +24 -0
- package/src/basic-languages/qsharp/qsharp.test.ts +186 -0
- package/src/basic-languages/qsharp/qsharp.ts +325 -0
- package/src/basic-languages/r/r.contribution.ts +24 -0
- package/src/basic-languages/r/r.test.ts +600 -0
- package/src/basic-languages/r/r.ts +263 -0
- package/src/basic-languages/razor/razor.contribution.ts +25 -0
- package/src/basic-languages/razor/razor.test.ts +175 -0
- package/src/basic-languages/razor/razor.ts +571 -0
- package/src/basic-languages/redis/redis.contribution.ts +24 -0
- package/src/basic-languages/redis/redis.test.ts +306 -0
- package/src/basic-languages/redis/redis.ts +309 -0
- package/src/basic-languages/redshift/redshift.contribution.ts +24 -0
- package/src/basic-languages/redshift/redshift.test.ts +595 -0
- package/src/basic-languages/redshift/redshift.ts +815 -0
- package/src/basic-languages/restructuredtext/restructuredtext.contribution.ts +24 -0
- package/src/basic-languages/restructuredtext/restructuredtext.test.ts +454 -0
- package/src/basic-languages/restructuredtext/restructuredtext.ts +198 -0
- package/src/basic-languages/ruby/ruby.contribution.ts +25 -0
- package/src/basic-languages/ruby/ruby.test.ts +158 -0
- package/src/basic-languages/ruby/ruby.ts +590 -0
- package/src/basic-languages/rust/rust.contribution.ts +24 -0
- package/src/basic-languages/rust/rust.test.ts +208 -0
- package/src/basic-languages/rust/rust.ts +361 -0
- package/src/basic-languages/sb/sb.contribution.ts +24 -0
- package/src/basic-languages/sb/sb.test.ts +320 -0
- package/src/basic-languages/sb/sb.ts +134 -0
- package/src/basic-languages/scala/scala.contribution.ts +25 -0
- package/src/basic-languages/scala/scala.test.ts +727 -0
- package/src/basic-languages/scala/scala.ts +413 -0
- package/src/basic-languages/scheme/scheme.contribution.ts +24 -0
- package/src/basic-languages/scheme/scheme.test.ts +89 -0
- package/src/basic-languages/scheme/scheme.ts +128 -0
- package/src/basic-languages/scss/scss.contribution.ts +25 -0
- package/src/basic-languages/scss/scss.test.ts +2422 -0
- package/src/basic-languages/scss/scss.ts +284 -0
- package/src/basic-languages/shell/shell.contribution.ts +24 -0
- package/src/basic-languages/shell/shell.test.ts +345 -0
- package/src/basic-languages/shell/shell.ts +246 -0
- package/src/basic-languages/solidity/solidity.contribution.ts +24 -0
- package/src/basic-languages/solidity/solidity.test.ts +272 -0
- package/src/basic-languages/solidity/solidity.ts +1388 -0
- package/src/basic-languages/sophia/sophia.contribution.ts +24 -0
- package/src/basic-languages/sophia/sophia.test.ts +302 -0
- package/src/basic-languages/sophia/sophia.ts +220 -0
- package/src/basic-languages/sparql/sparql.contribution.ts +24 -0
- package/src/basic-languages/sparql/sparql.test.ts +187 -0
- package/src/basic-languages/sparql/sparql.ts +219 -0
- package/src/basic-languages/sql/keywords.js +612 -0
- package/src/basic-languages/sql/sql.contribution.ts +24 -0
- package/src/basic-languages/sql/sql.test.ts +692 -0
- package/src/basic-languages/sql/sql.ts +860 -0
- package/src/basic-languages/st/st.contribution.ts +24 -0
- package/src/basic-languages/st/st.test.ts +139 -0
- package/src/basic-languages/st/st.ts +441 -0
- package/src/basic-languages/swift/swift.contribution.ts +25 -0
- package/src/basic-languages/swift/swift.test.ts +254 -0
- package/src/basic-languages/swift/swift.ts +335 -0
- package/src/basic-languages/systemverilog/systemverilog.contribution.ts +39 -0
- package/src/basic-languages/systemverilog/systemverilog.test.ts +1267 -0
- package/src/basic-languages/systemverilog/systemverilog.ts +606 -0
- package/src/basic-languages/tcl/tcl.contribution.ts +24 -0
- package/src/basic-languages/tcl/tcl.test.ts +107 -0
- package/src/basic-languages/tcl/tcl.ts +259 -0
- package/src/basic-languages/test/testRunner.ts +63 -0
- package/src/basic-languages/twig/twig.contribution.ts +25 -0
- package/src/basic-languages/twig/twig.test.ts +1047 -0
- package/src/basic-languages/twig/twig.ts +417 -0
- package/src/basic-languages/typescript/typescript.contribution.ts +25 -0
- package/src/basic-languages/typescript/typescript.test.ts +973 -0
- package/src/basic-languages/typescript/typescript.ts +364 -0
- package/src/basic-languages/typespec/typespec.contribution.ts +24 -0
- package/src/basic-languages/typespec/typespec.test.ts +500 -0
- package/src/basic-languages/typespec/typespec.ts +130 -0
- package/src/basic-languages/vb/vb.contribution.ts +24 -0
- package/src/basic-languages/vb/vb.test.ts +598 -0
- package/src/basic-languages/vb/vb.ts +394 -0
- package/src/basic-languages/wgsl/wgsl.contribution.ts +24 -0
- package/src/basic-languages/wgsl/wgsl.test.ts +3915 -0
- package/src/basic-languages/wgsl/wgsl.ts +485 -0
- package/src/basic-languages/xml/xml.contribution.ts +44 -0
- package/src/basic-languages/xml/xml.test.ts +706 -0
- package/src/basic-languages/xml/xml.ts +106 -0
- package/src/basic-languages/yaml/yaml.contribution.ts +25 -0
- package/src/basic-languages/yaml/yaml.test.ts +670 -0
- package/src/basic-languages/yaml/yaml.ts +236 -0
- package/src/fillers/editor.api.d.ts +4 -0
- package/src/fillers/monaco-editor-core-amd.ts +11 -0
- package/src/fillers/monaco-editor-core.ts +6 -0
- package/src/language/common/lspLanguageFeatures.ts +1027 -0
- package/src/language/css/css.worker.ts +14 -0
- package/src/language/css/cssMode.ts +145 -0
- package/src/language/css/cssWorker.ts +239 -0
- package/src/language/css/monaco.contribution.ts +362 -0
- package/src/language/css/workerManager.ts +90 -0
- package/src/language/html/html.worker.ts +14 -0
- package/src/language/html/htmlMode.ts +171 -0
- package/src/language/html/htmlWorker.ts +164 -0
- package/src/language/html/monaco.contribution.ts +329 -0
- package/src/language/html/workerManager.ts +90 -0
- package/src/language/json/json.worker.ts +14 -0
- package/src/language/json/jsonMode.ts +185 -0
- package/src/language/json/jsonWorker.ts +235 -0
- package/src/language/json/monaco.contribution.ts +372 -0
- package/src/language/json/tokenization.ts +273 -0
- package/src/language/json/workerManager.ts +91 -0
- package/src/language/typescript/languageFeatures.ts +1269 -0
- package/src/language/typescript/lib/editor.worker.d.ts +8 -0
- package/src/language/typescript/lib/lib.index.ts +97 -0
- package/src/language/typescript/lib/lib.ts +97 -0
- package/src/language/typescript/lib/typescriptServices.d.ts +11717 -0
- package/src/language/typescript/lib/typescriptServices.js +190876 -0
- package/src/language/typescript/lib/typescriptServicesMetadata.ts +5 -0
- package/src/language/typescript/monaco.contribution.ts +815 -0
- package/src/language/typescript/ts.worker.ts +19 -0
- package/src/language/typescript/tsMode.ts +176 -0
- package/src/language/typescript/tsWorker.ts +525 -0
- package/src/language/typescript/workerManager.ts +101 -0
- package/src/nls-fix.js +39 -0
- package/src/tsconfig.json +14 -0
- package/test/manual/cross-origin.html +26 -0
- package/test/manual/dev-setup.js +218 -0
- package/test/manual/diff.html +20 -0
- package/test/manual/diff.js +451 -0
- package/test/manual/iframe-inner.html +29 -0
- package/test/manual/iframe.html +23 -0
- package/test/manual/index.css +14 -0
- package/test/manual/index.html +44 -0
- package/test/manual/index.js +421 -0
- package/test/manual/mouse-fixed.html +31 -0
- package/test/manual/mouse-scrollable-body.html +286 -0
- package/test/manual/mouse-scrollable-element.html +204 -0
- package/test/manual/samples/run-editor-failing-js.txt +44 -0
- package/test/manual/samples/run-editor-intellisense-js.txt +33 -0
- package/test/manual/samples/run-editor-jquery-min-js.txt +30 -0
- package/test/manual/samples/run-editor-korean.txt +10 -0
- package/test/manual/samples/run-editor-sample-big-css.txt +1 -0
- package/test/manual/samples/run-editor-sample-bom-cs.txt +493 -0
- package/test/manual/samples/run-editor-sample-cr-ps1.txt +12 -0
- package/test/manual/samples/run-editor-sample-dynamic.txt +50 -0
- package/test/manual/samples/run-editor-sample-f12-css.txt +31764 -0
- package/test/manual/samples/run-editor-sample-html.txt +23 -0
- package/test/manual/samples/run-editor-sample-js.txt +222 -0
- package/test/manual/samples/run-editor-sample-msn-js.txt +1 -0
- package/test/manual/samples.js +287 -0
- package/test/manual/shadow-dom.html +56 -0
- package/test/manual/transform.html +29 -0
- package/test/manual/typescript/custom-worker.html +210 -0
- package/test/manual/typescript/custom-worker.js +59 -0
- package/test/manual/typescript/index.html +179 -0
- package/test/smoke/amd/index.html +21 -0
- package/test/smoke/common.js +11 -0
- package/test/smoke/esbuild/index.html +11 -0
- package/test/smoke/esbuild/index.js +26 -0
- package/test/smoke/package-esbuild.ts +60 -0
- package/test/smoke/package-vite.ts +19 -0
- package/test/smoke/package-webpack.ts +56 -0
- package/test/smoke/parcel/index.html +11 -0
- package/test/smoke/parcel/index.js +41 -0
- package/test/smoke/parcel/package.json +6 -0
- package/test/smoke/runner.js +94 -0
- package/test/smoke/smoke.test.js +215 -0
- package/test/smoke/vite/index.html +10 -0
- package/test/smoke/vite/index.js +31 -0
- package/test/smoke/webpack/index.html +10 -0
- package/test/smoke/webpack/index.js +4 -0
- package/test/unit/all.js +70 -0
- package/test/unit/setup.js +34 -0
- package/webpack-plugin/LICENSE +21 -0
- package/webpack-plugin/README.md +116 -0
- package/webpack-plugin/package-lock.json +3132 -0
- package/webpack-plugin/package.json +45 -0
- package/webpack-plugin/tsconfig.json +11 -0
- package/website/.prettierrc.json +6 -0
- package/website/index/samples/sample.mdx.txt +92 -0
- package/website/package.json +60 -0
- package/website/scripts/check-playground-samples-js.ts +58 -0
- package/website/src/monaco-loader.ts +111 -0
- package/website/src/runner/debug.ts +75 -0
- package/website/src/runner/index.ts +104 -0
- package/website/src/runner/style.scss +35 -0
- package/website/src/shared.ts +37 -0
- package/website/src/tsconfig.json +19 -0
- package/website/src/types.d.ts +13 -0
- package/website/src/website/bootstrap.scss +6 -0
- package/website/src/website/code-oss.svg +1 -0
- package/website/src/website/components/Loader.tsx +40 -0
- package/website/src/website/components/Nav.tsx +75 -0
- package/website/src/website/components/Page.tsx +11 -0
- package/website/src/website/components/Radio.tsx +23 -0
- package/website/src/website/components/Select.tsx +75 -0
- package/website/src/website/components/TextBox.tsx +21 -0
- package/website/src/website/components/bootstrap.tsx +32 -0
- package/website/src/website/components/monaco/MonacoEditor.tsx +275 -0
- package/website/src/website/components/monaco/MonacoLoader.tsx +39 -0
- package/website/src/website/data/diff-sample/modified.txt +212 -0
- package/website/src/website/data/diff-sample/original.txt +215 -0
- package/website/src/website/data/home-samples/sample.abap.txt +29 -0
- package/website/src/website/data/home-samples/sample.aes.txt +38 -0
- package/website/src/website/data/home-samples/sample.apex.txt +7 -0
- package/website/src/website/data/home-samples/sample.azcli.txt +5 -0
- package/website/src/website/data/home-samples/sample.bat.txt +13 -0
- package/website/src/website/data/home-samples/sample.bicep.txt +29 -0
- package/website/src/website/data/home-samples/sample.c.txt +3463 -0
- package/website/src/website/data/home-samples/sample.cameligo.txt +17 -0
- package/website/src/website/data/home-samples/sample.clojure.txt +54 -0
- package/website/src/website/data/home-samples/sample.coffeescript.txt +28 -0
- package/website/src/website/data/home-samples/sample.cpp.txt +246 -0
- package/website/src/website/data/home-samples/sample.csharp.txt +38 -0
- package/website/src/website/data/home-samples/sample.csp.txt +1 -0
- package/website/src/website/data/home-samples/sample.css.txt +828 -0
- package/website/src/website/data/home-samples/sample.cypher.txt +3 -0
- package/website/src/website/data/home-samples/sample.dart.txt +45 -0
- package/website/src/website/data/home-samples/sample.dockerfile.txt +32 -0
- package/website/src/website/data/home-samples/sample.ecl.txt +7 -0
- package/website/src/website/data/home-samples/sample.elixir.txt +80 -0
- package/website/src/website/data/home-samples/sample.flow9.txt +14 -0
- package/website/src/website/data/home-samples/sample.freemarker2.tag-angle.interpolation-bracket.txt +61 -0
- package/website/src/website/data/home-samples/sample.freemarker2.tag-angle.interpolation-dollar.txt +61 -0
- package/website/src/website/data/home-samples/sample.freemarker2.tag-auto.interpolation-bracket.txt +65 -0
- package/website/src/website/data/home-samples/sample.freemarker2.tag-auto.interpolation-dollar.txt +65 -0
- package/website/src/website/data/home-samples/sample.freemarker2.tag-bracket.interpolation-bracket.txt +61 -0
- package/website/src/website/data/home-samples/sample.freemarker2.tag-bracket.interpolation-dollar.txt +61 -0
- package/website/src/website/data/home-samples/sample.freemarker2.txt +61 -0
- package/website/src/website/data/home-samples/sample.fsharp.txt +8 -0
- package/website/src/website/data/home-samples/sample.go.txt +111 -0
- package/website/src/website/data/home-samples/sample.graphql.txt +263 -0
- package/website/src/website/data/home-samples/sample.handlebars.txt +31 -0
- package/website/src/website/data/home-samples/sample.hcl.txt +48 -0
- package/website/src/website/data/home-samples/sample.html.txt +100 -0
- package/website/src/website/data/home-samples/sample.ini.txt +15 -0
- package/website/src/website/data/home-samples/sample.java.txt +54 -0
- package/website/src/website/data/home-samples/sample.javascript.txt +214 -0
- package/website/src/website/data/home-samples/sample.json.txt +68 -0
- package/website/src/website/data/home-samples/sample.julia.txt +23 -0
- package/website/src/website/data/home-samples/sample.kotlin.txt +28 -0
- package/website/src/website/data/home-samples/sample.less.txt +46 -0
- package/website/src/website/data/home-samples/sample.lex.txt +21 -0
- package/website/src/website/data/home-samples/sample.lexon.txt +17 -0
- package/website/src/website/data/home-samples/sample.liquid.txt +16 -0
- package/website/src/website/data/home-samples/sample.lua.txt +12 -0
- package/website/src/website/data/home-samples/sample.m3.txt +5 -0
- package/website/src/website/data/home-samples/sample.markdown.txt +104 -0
- package/website/src/website/data/home-samples/sample.mdx.txt +91 -0
- package/website/src/website/data/home-samples/sample.mips.txt +13 -0
- package/website/src/website/data/home-samples/sample.msdax.txt +1 -0
- package/website/src/website/data/home-samples/sample.mysql.txt +8 -0
- package/website/src/website/data/home-samples/sample.objective-c.txt +52 -0
- package/website/src/website/data/home-samples/sample.pascal.txt +28 -0
- package/website/src/website/data/home-samples/sample.pascaligo.txt +20 -0
- package/website/src/website/data/home-samples/sample.pebble.txt +54 -0
- package/website/src/website/data/home-samples/sample.perl.txt +18 -0
- package/website/src/website/data/home-samples/sample.pgsql.txt +8 -0
- package/website/src/website/data/home-samples/sample.php.txt +82 -0
- package/website/src/website/data/home-samples/sample.pla.txt +4 -0
- package/website/src/website/data/home-samples/sample.plaintext.txt +9 -0
- package/website/src/website/data/home-samples/sample.postiats.txt +64 -0
- package/website/src/website/data/home-samples/sample.powerquery.txt +12 -0
- package/website/src/website/data/home-samples/sample.powershell.txt +30 -0
- package/website/src/website/data/home-samples/sample.proto.txt +11 -0
- package/website/src/website/data/home-samples/sample.pug.txt +18 -0
- package/website/src/website/data/home-samples/sample.python.txt +13 -0
- package/website/src/website/data/home-samples/sample.qsharp.txt +45 -0
- package/website/src/website/data/home-samples/sample.r.txt +41 -0
- package/website/src/website/data/home-samples/sample.razor.txt +46 -0
- package/website/src/website/data/home-samples/sample.redis.txt +4 -0
- package/website/src/website/data/home-samples/sample.redshift.txt +9 -0
- package/website/src/website/data/home-samples/sample.restructuredtext.txt +26 -0
- package/website/src/website/data/home-samples/sample.ruby.txt +21 -0
- package/website/src/website/data/home-samples/sample.rust.txt +29 -0
- package/website/src/website/data/home-samples/sample.sb.txt +10 -0
- package/website/src/website/data/home-samples/sample.scala.txt +53 -0
- package/website/src/website/data/home-samples/sample.scheme.txt +105 -0
- package/website/src/website/data/home-samples/sample.scss.txt +37 -0
- package/website/src/website/data/home-samples/sample.shell.txt +42 -0
- package/website/src/website/data/home-samples/sample.sol.txt +139 -0
- package/website/src/website/data/home-samples/sample.sparql.txt +7 -0
- package/website/src/website/data/home-samples/sample.sql.txt +52 -0
- package/website/src/website/data/home-samples/sample.st.txt +34 -0
- package/website/src/website/data/home-samples/sample.swift.txt +50 -0
- package/website/src/website/data/home-samples/sample.systemverilog.txt +28 -0
- package/website/src/website/data/home-samples/sample.tcl.txt +18 -0
- package/website/src/website/data/home-samples/sample.twig.txt +12 -0
- package/website/src/website/data/home-samples/sample.typescript.txt +124 -0
- package/website/src/website/data/home-samples/sample.typespec.txt +71 -0
- package/website/src/website/data/home-samples/sample.vb.txt +59 -0
- package/website/src/website/data/home-samples/sample.verilog.txt +35 -0
- package/website/src/website/data/home-samples/sample.wgsl.txt +48 -0
- package/website/src/website/data/home-samples/sample.xml.txt +14 -0
- package/website/src/website/data/home-samples/sample.yaml.txt +14 -0
- package/website/src/website/data/playground-samples/all.js +196 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/chapter.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/hello-diff-world/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/hello-diff-world/sample.html +1 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/hello-diff-world/sample.js +20 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/hello-diff-world/sample.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/inline-diff-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/inline-diff-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/inline-diff-example/sample.js +23 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/inline-diff-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/multi-line-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/multi-line-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/multi-line-example/sample.js +20 -0
- package/website/src/website/data/playground-samples/creating-the-diffeditor/multi-line-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-editor/chapter.json +4 -0
- package/website/src/website/data/playground-samples/creating-the-editor/editor-basic-options/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-editor/editor-basic-options/sample.html +1 -0
- package/website/src/website/data/playground-samples/creating-the-editor/editor-basic-options/sample.js +19 -0
- package/website/src/website/data/playground-samples/creating-the-editor/editor-basic-options/sample.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hard-wrapping/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hard-wrapping/sample.html +1 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hard-wrapping/sample.js +13 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hard-wrapping/sample.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hello-world/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hello-world/sample.html +1 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hello-world/sample.js +10 -0
- package/website/src/website/data/playground-samples/creating-the-editor/hello-world/sample.json +4 -0
- package/website/src/website/data/playground-samples/creating-the-editor/syntax-highlighting-for-html-elements/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-editor/syntax-highlighting-for-html-elements/sample.html +35 -0
- package/website/src/website/data/playground-samples/creating-the-editor/syntax-highlighting-for-html-elements/sample.js +4 -0
- package/website/src/website/data/playground-samples/creating-the-editor/syntax-highlighting-for-html-elements/sample.json +3 -0
- package/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.css +0 -0
- package/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.html +8 -0
- package/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.js +35 -0
- package/website/src/website/data/playground-samples/creating-the-editor/web-component/sample.json +4 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/chapter.json +3 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/exposed-colors/sample.css +0 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/exposed-colors/sample.html +1 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/exposed-colors/sample.js +150 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/exposed-colors/sample.json +3 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/scrollbars/sample.css +13 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/scrollbars/sample.html +1 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/scrollbars/sample.js +32 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/scrollbars/sample.json +3 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/tokens-and-colors/sample.css +0 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/tokens-and-colors/sample.html +1 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/tokens-and-colors/sample.js +40 -0
- package/website/src/website/data/playground-samples/customizing-the-appearence/tokens-and-colors/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/chapter.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/codelens-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/codelens-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/codelens-provider-example/sample.js +39 -0
- package/website/src/website/data/playground-samples/extending-language-services/codelens-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/color-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/color-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/color-provider-example/sample.js +71 -0
- package/website/src/website/data/playground-samples/extending-language-services/color-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/completion-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/completion-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/completion-provider-example/sample.js +69 -0
- package/website/src/website/data/playground-samples/extending-language-services/completion-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-javascript-defaults/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-javascript-defaults/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-javascript-defaults/sample.js +46 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-javascript-defaults/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-json-defaults/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-json-defaults/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-json-defaults/sample.js +42 -0
- package/website/src/website/data/playground-samples/extending-language-services/configure-json-defaults/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/custom-languages/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/custom-languages/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/custom-languages/sample.js +137 -0
- package/website/src/website/data/playground-samples/extending-language-services/custom-languages/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/folding-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/folding-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/folding-provider-example/sample.js +74 -0
- package/website/src/website/data/playground-samples/extending-language-services/folding-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/hover-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/hover-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/hover-provider-example/sample.js +62 -0
- package/website/src/website/data/playground-samples/extending-language-services/hover-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/inlay-hints-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/inlay-hints-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/inlay-hints-provider-example/sample.js +47 -0
- package/website/src/website/data/playground-samples/extending-language-services/inlay-hints-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/model-markers-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/model-markers-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/model-markers-example/sample.js +50 -0
- package/website/src/website/data/playground-samples/extending-language-services/model-markers-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/semantic-tokens-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/semantic-tokens-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/semantic-tokens-provider-example/sample.js +168 -0
- package/website/src/website/data/playground-samples/extending-language-services/semantic-tokens-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/extending-language-services/symbols-provider-example/sample.css +0 -0
- package/website/src/website/data/playground-samples/extending-language-services/symbols-provider-example/sample.html +1 -0
- package/website/src/website/data/playground-samples/extending-language-services/symbols-provider-example/sample.js +480 -0
- package/website/src/website/data/playground-samples/extending-language-services/symbols-provider-example/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-command-to-an-editor-instance/sample.css +0 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-command-to-an-editor-instance/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-command-to-an-editor-instance/sample.js +43 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-command-to-an-editor-instance/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-keybinding-to-an-existing-command/sample.css +0 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-keybinding-to-an-existing-command/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-keybinding-to-an-existing-command/sample.js +49 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-a-keybinding-to-an-existing-command/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.css +0 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.js +52 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/adding-an-action-to-an-editor-instance/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/chapter.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/customizing-the-line-numbers/sample.css +0 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/customizing-the-line-numbers/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/customizing-the-line-numbers/sample.js +37 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/customizing-the-line-numbers/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/line-and-inline-decorations/sample.css +13 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/line-and-inline-decorations/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/line-and-inline-decorations/sample.js +30 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/line-and-inline-decorations/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-key-events/sample.css +0 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-key-events/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-key-events/sample.js +11 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-key-events/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-mouse-events/sample.css +6 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-mouse-events/sample.html +5 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-mouse-events/sample.js +114 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/listening-to-mouse-events/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/rendering-glyphs-in-the-margin/sample.css +7 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/rendering-glyphs-in-the-margin/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/rendering-glyphs-in-the-margin/sample.js +30 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/rendering-glyphs-in-the-margin/sample.json +3 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/revealing-a-position/sample.css +0 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/revealing-a-position/sample.html +1 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/revealing-a-position/sample.js +41 -0
- package/website/src/website/data/playground-samples/interacting-with-the-editor/revealing-a-position/sample.json +3 -0
- package/website/src/website/index.tsx +10 -0
- package/website/src/website/monaco-loader-chunk.ts +15 -0
- package/website/src/website/monacoEditorVersion.ts +8 -0
- package/website/src/website/pages/App.tsx +21 -0
- package/website/src/website/pages/DocsPage.tsx +103 -0
- package/website/src/website/pages/MonarchPage.tsx +16 -0
- package/website/src/website/pages/home/Home.tsx +249 -0
- package/website/src/website/pages/playground/BisectModel.ts +161 -0
- package/website/src/website/pages/playground/LocationModel.ts +216 -0
- package/website/src/website/pages/playground/PlaygroundModel.ts +355 -0
- package/website/src/website/pages/playground/PlaygroundPage.tsx +31 -0
- package/website/src/website/pages/playground/PlaygroundPageContent.tsx +587 -0
- package/website/src/website/pages/playground/Preview.tsx +129 -0
- package/website/src/website/pages/playground/SettingsDialog.tsx +412 -0
- package/website/src/website/pages/playground/SettingsModel.ts +198 -0
- package/website/src/website/pages/playground/Source.ts +107 -0
- package/website/src/website/pages/playground/getNpmVersionsSync.ts +450 -0
- package/website/src/website/pages/playground/playgroundExamples.tsx +88 -0
- package/website/src/website/pages/playground/utils.ts +28 -0
- package/website/src/website/pages/routes.ts +28 -0
- package/website/src/website/style.scss +96 -0
- package/website/src/website/utils/Debouncer.ts +28 -0
- package/website/src/website/utils/ObservableHistory.ts +89 -0
- package/website/src/website/utils/ObservablePromise.ts +49 -0
- package/website/src/website/utils/hotComponent.tsx +49 -0
- package/website/src/website/utils/lzmaCompressor.ts +39 -0
- package/website/src/website/utils/ref.ts +39 -0
- package/website/src/website/utils/types.d.ts +28 -0
- package/website/src/website/utils/utils.ts +58 -0
- package/website/static/monarch/monarch-34px.png +0 -0
- package/website/static/monarch/monarch.css +297 -0
- package/website/static/monarch/monarch.js +178 -0
- package/website/static/monarch-static.html +5345 -0
- package/website/tsconfig.json +16 -0
- package/website/tslint.json +6 -0
- package/website/typedoc/tsconfig.json +8 -0
- package/website/typedoc/typedoc.json +11 -0
- package/website/vscode-web-editors.tgz +0 -0
- package/website/webpack.config.ts +151 -0
- package/website/yarn.lock +3612 -0
|
@@ -0,0 +1,1230 @@
|
|
|
1
|
+
/*---------------------------------------------------------------------------------------------
|
|
2
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
+
*--------------------------------------------------------------------------------------------*/
|
|
5
|
+
|
|
6
|
+
import { languages } from '../../fillers/monaco-editor-core';
|
|
7
|
+
|
|
8
|
+
// Difficulty: "Black hole!"
|
|
9
|
+
/*
|
|
10
|
+
* The grammar for FreeMarker 2.x. We intentionally limit to FreeMarker 2 as the
|
|
11
|
+
* next release FreeMarker 3 is a breaking change that will change the syntax,
|
|
12
|
+
* see:
|
|
13
|
+
*
|
|
14
|
+
* https://cwiki.apache.org/confluence/display/FREEMARKER/FreeMarker+3
|
|
15
|
+
*
|
|
16
|
+
* FreeMarker does not just have one grammar, it has 6 (!) different syntaxes.
|
|
17
|
+
*
|
|
18
|
+
* - 3 possibilities for the tag syntax: angle, bracket, auto
|
|
19
|
+
* - 2 possibilities for the interpolation syntax: dollar, bracket
|
|
20
|
+
*
|
|
21
|
+
* These can be combined, resulting in 3*2=6 syntaxes. There's another tag
|
|
22
|
+
* syntax, but that one is legacy and therefore ignored by this tokenizer.
|
|
23
|
+
*
|
|
24
|
+
* - Angle tag syntax is like `<#if true>...</#if>`
|
|
25
|
+
* - Bracket tag syntax is like `[#if true]...[/#if]`
|
|
26
|
+
* - Auto tag syntax inspects the first directive and uses that.
|
|
27
|
+
*
|
|
28
|
+
* Dollar interpolation syntax is like `${1+2}`, bracket syntax like `[=1+2]`.
|
|
29
|
+
*
|
|
30
|
+
* To prevent duplicate code, there are factory functions that take a syntax
|
|
31
|
+
* mode and dynamically create the tokenizer for that mode. This does not affect
|
|
32
|
+
* performance since the tokenizer is created only once.
|
|
33
|
+
*
|
|
34
|
+
* Auto mode is implemented via parser states. Each parser state exists three
|
|
35
|
+
* times, one for each tag syntax mode (e.g. `default.auto`, `default.angle`,
|
|
36
|
+
* `default.bracket`). Auto mode starts in `default.auto` and switches to
|
|
37
|
+
* `default.angle` or `default.bracket` when it encounters the first directive.
|
|
38
|
+
*
|
|
39
|
+
* FreeMarker allows expressions within strings ("a${1+2}b"), but these are
|
|
40
|
+
* impossible to tokenize. String interpolation is not implemented via a mode
|
|
41
|
+
* change when encountering `${`. Rather, FreeMarker tokenizes the string as a
|
|
42
|
+
* literal string first. Then, during the AST build phase, it creates a new
|
|
43
|
+
* parses and parses the unescaped string content.
|
|
44
|
+
*
|
|
45
|
+
* This is adapted from the official JavaCC grammar for FreeMarker:
|
|
46
|
+
* https://github.com/apache/freemarker/blob/2.3-gae/src/main/javacc/FTL.jj
|
|
47
|
+
*
|
|
48
|
+
* Taken from the above file, a short rundown of the basic parser states:
|
|
49
|
+
*
|
|
50
|
+
* > The lexer portion defines 5 lexical states:
|
|
51
|
+
* > DEFAULT, FM_EXPRESSION, IN_PAREN, NO_PARSE, and EXPRESSION_COMMENT.
|
|
52
|
+
* > The DEFAULT state is when you are parsing
|
|
53
|
+
* > text but are not inside a FreeMarker expression.
|
|
54
|
+
* > FM_EXPRESSION is the state you are in
|
|
55
|
+
* > when the parser wants a FreeMarker expression.
|
|
56
|
+
* > IN_PAREN is almost identical really. The difference
|
|
57
|
+
* > is that you are in this state when you are within
|
|
58
|
+
* > FreeMarker expression and also within (...).
|
|
59
|
+
* > This is a necessary subtlety because the
|
|
60
|
+
* > ">" and ">=" symbols can only be used
|
|
61
|
+
* > within parentheses because otherwise, it would
|
|
62
|
+
* > be ambiguous with the end of a directive.
|
|
63
|
+
* > So, for example, you enter the FM_EXPRESSION state
|
|
64
|
+
* > right after a ${ and leave it after the matching }.
|
|
65
|
+
* > Or, you enter the FM_EXPRESSION state right after
|
|
66
|
+
* > an "<if" and then, when you hit the matching ">"
|
|
67
|
+
* > that ends the if directive,
|
|
68
|
+
* > you go back to DEFAULT lexical state.
|
|
69
|
+
* > If, within the FM_EXPRESSION state, you enter a
|
|
70
|
+
* > parenthetical expression, you enter the IN_PAREN
|
|
71
|
+
* > state.
|
|
72
|
+
* > Note that whitespace is ignored in the
|
|
73
|
+
* > FM_EXPRESSION and IN_PAREN states
|
|
74
|
+
* > but is passed through to the parser as PCDATA in the DEFAULT state.
|
|
75
|
+
* > NO_PARSE and EXPRESSION_COMMENT are extremely simple
|
|
76
|
+
* > lexical states. NO_PARSE is when you are in a comment
|
|
77
|
+
* > block and EXPRESSION_COMMENT is when you are in a comment
|
|
78
|
+
* > that is within an FTL expression.
|
|
79
|
+
*
|
|
80
|
+
* It should be noted that there are another parser state not mentioned in the
|
|
81
|
+
* above excerpt: NO_DIRECTIVE is used as the initial starting state when
|
|
82
|
+
* parsing the contents of a string literal, which is allowed to contain
|
|
83
|
+
* interpolations, but no directives. However, note that FreeMarker first
|
|
84
|
+
* tokenizes a string literal as-is, then during the parsing stage, it takes the
|
|
85
|
+
* (unescaped) content of the string literal, and tokenizes + parses that
|
|
86
|
+
* content with a new child parser.
|
|
87
|
+
*/
|
|
88
|
+
|
|
89
|
+
const EMPTY_ELEMENTS = [
|
|
90
|
+
'assign',
|
|
91
|
+
'flush',
|
|
92
|
+
'ftl',
|
|
93
|
+
'return',
|
|
94
|
+
'global',
|
|
95
|
+
'import',
|
|
96
|
+
'include',
|
|
97
|
+
'break',
|
|
98
|
+
'continue',
|
|
99
|
+
'local',
|
|
100
|
+
'nested',
|
|
101
|
+
'nt',
|
|
102
|
+
'setting',
|
|
103
|
+
'stop',
|
|
104
|
+
't',
|
|
105
|
+
'lt',
|
|
106
|
+
'rt',
|
|
107
|
+
'fallback'
|
|
108
|
+
];
|
|
109
|
+
|
|
110
|
+
const BLOCK_ELEMENTS = [
|
|
111
|
+
'attempt',
|
|
112
|
+
'autoesc',
|
|
113
|
+
'autoEsc',
|
|
114
|
+
'compress',
|
|
115
|
+
'comment',
|
|
116
|
+
'escape',
|
|
117
|
+
'noescape',
|
|
118
|
+
'function',
|
|
119
|
+
'if',
|
|
120
|
+
'list',
|
|
121
|
+
'items',
|
|
122
|
+
'sep',
|
|
123
|
+
'macro',
|
|
124
|
+
'noparse',
|
|
125
|
+
'noParse',
|
|
126
|
+
'noautoesc',
|
|
127
|
+
'noAutoEsc',
|
|
128
|
+
'outputformat',
|
|
129
|
+
'switch',
|
|
130
|
+
'visit',
|
|
131
|
+
'recurse'
|
|
132
|
+
];
|
|
133
|
+
|
|
134
|
+
interface TagSyntax {
|
|
135
|
+
close: string; // must be escaped for RegExp!
|
|
136
|
+
id: 'angle' | 'bracket' | 'auto';
|
|
137
|
+
open: string; //must be escaped for RegExp!
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
interface InterpolationSyntax {
|
|
141
|
+
close: string; // must be escaped for RegExp!
|
|
142
|
+
id: 'dollar' | 'bracket';
|
|
143
|
+
open1: string; //must be escaped for RegExp!
|
|
144
|
+
open2: string; // must be escaped for RegExp!
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
const TagSyntaxAngle: TagSyntax = {
|
|
148
|
+
close: '>',
|
|
149
|
+
id: 'angle',
|
|
150
|
+
open: '<'
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const TagSyntaxBracket: TagSyntax = {
|
|
154
|
+
close: '\\]',
|
|
155
|
+
id: 'bracket',
|
|
156
|
+
open: '\\['
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
const TagSyntaxAuto: TagSyntax = {
|
|
160
|
+
close: '[>\\]]',
|
|
161
|
+
id: 'auto',
|
|
162
|
+
open: '[<\\[]'
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
const InterpolationSyntaxDollar: InterpolationSyntax = {
|
|
166
|
+
close: '\\}',
|
|
167
|
+
id: 'dollar',
|
|
168
|
+
open1: '\\$',
|
|
169
|
+
open2: '\\{'
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const InterpolationSyntaxBracket: InterpolationSyntax = {
|
|
173
|
+
close: '\\]',
|
|
174
|
+
id: 'bracket',
|
|
175
|
+
open1: '\\[',
|
|
176
|
+
open2: '='
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
function createLangConfiguration(ts: TagSyntax): languages.LanguageConfiguration {
|
|
180
|
+
return {
|
|
181
|
+
brackets: [
|
|
182
|
+
['<', '>'],
|
|
183
|
+
['[', ']'],
|
|
184
|
+
['(', ')'],
|
|
185
|
+
['{', '}']
|
|
186
|
+
],
|
|
187
|
+
comments: {
|
|
188
|
+
blockComment: [`${ts.open}--`, `--${ts.close}`]
|
|
189
|
+
},
|
|
190
|
+
autoCloseBefore: '\n\r\t }]),.:;=',
|
|
191
|
+
autoClosingPairs: [
|
|
192
|
+
{ open: '{', close: '}' },
|
|
193
|
+
{ open: '[', close: ']' },
|
|
194
|
+
{ open: '(', close: ')' },
|
|
195
|
+
{ open: '"', close: '"', notIn: ['string'] },
|
|
196
|
+
{ open: "'", close: "'", notIn: ['string'] }
|
|
197
|
+
],
|
|
198
|
+
surroundingPairs: [
|
|
199
|
+
{ open: '"', close: '"' },
|
|
200
|
+
{ open: "'", close: "'" },
|
|
201
|
+
{ open: '{', close: '}' },
|
|
202
|
+
{ open: '[', close: ']' },
|
|
203
|
+
{ open: '(', close: ')' },
|
|
204
|
+
{ open: '<', close: '>' }
|
|
205
|
+
],
|
|
206
|
+
folding: {
|
|
207
|
+
markers: {
|
|
208
|
+
start: new RegExp(
|
|
209
|
+
`${ts.open}#(?:${BLOCK_ELEMENTS.join('|')})([^/${ts.close}]*(?!/)${ts.close})[^${
|
|
210
|
+
ts.open
|
|
211
|
+
}]*$`
|
|
212
|
+
),
|
|
213
|
+
end: new RegExp(`${ts.open}/#(?:${BLOCK_ELEMENTS.join('|')})[\\r\\n\\t ]*>`)
|
|
214
|
+
}
|
|
215
|
+
},
|
|
216
|
+
onEnterRules: [
|
|
217
|
+
{
|
|
218
|
+
beforeText: new RegExp(
|
|
219
|
+
`${ts.open}#(?!(?:${EMPTY_ELEMENTS.join('|')}))([a-zA-Z_]+)([^/${ts.close}]*(?!/)${
|
|
220
|
+
ts.close
|
|
221
|
+
})[^${ts.open}]*$`
|
|
222
|
+
),
|
|
223
|
+
afterText: new RegExp(`^${ts.open}/#([a-zA-Z_]+)[\\r\\n\\t ]*${ts.close}$`),
|
|
224
|
+
action: {
|
|
225
|
+
indentAction: languages.IndentAction.IndentOutdent
|
|
226
|
+
}
|
|
227
|
+
},
|
|
228
|
+
{
|
|
229
|
+
beforeText: new RegExp(
|
|
230
|
+
`${ts.open}#(?!(?:${EMPTY_ELEMENTS.join('|')}))([a-zA-Z_]+)([^/${ts.close}]*(?!/)${
|
|
231
|
+
ts.close
|
|
232
|
+
})[^${ts.open}]*$`
|
|
233
|
+
),
|
|
234
|
+
action: { indentAction: languages.IndentAction.Indent }
|
|
235
|
+
}
|
|
236
|
+
]
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function createLangConfigurationAuto(): languages.LanguageConfiguration {
|
|
241
|
+
return {
|
|
242
|
+
// Cannot set block comment delimiter in auto mode...
|
|
243
|
+
// It depends on the content and the cursor position of the file...
|
|
244
|
+
|
|
245
|
+
brackets: [
|
|
246
|
+
['<', '>'],
|
|
247
|
+
['[', ']'],
|
|
248
|
+
['(', ')'],
|
|
249
|
+
['{', '}']
|
|
250
|
+
],
|
|
251
|
+
|
|
252
|
+
autoCloseBefore: '\n\r\t }]),.:;=',
|
|
253
|
+
|
|
254
|
+
autoClosingPairs: [
|
|
255
|
+
{ open: '{', close: '}' },
|
|
256
|
+
{ open: '[', close: ']' },
|
|
257
|
+
{ open: '(', close: ')' },
|
|
258
|
+
{ open: '"', close: '"', notIn: ['string'] },
|
|
259
|
+
{ open: "'", close: "'", notIn: ['string'] }
|
|
260
|
+
],
|
|
261
|
+
|
|
262
|
+
surroundingPairs: [
|
|
263
|
+
{ open: '"', close: '"' },
|
|
264
|
+
{ open: "'", close: "'" },
|
|
265
|
+
{ open: '{', close: '}' },
|
|
266
|
+
{ open: '[', close: ']' },
|
|
267
|
+
{ open: '(', close: ')' },
|
|
268
|
+
{ open: '<', close: '>' }
|
|
269
|
+
],
|
|
270
|
+
|
|
271
|
+
folding: {
|
|
272
|
+
markers: {
|
|
273
|
+
start: new RegExp(`[<\\[]#(?:${BLOCK_ELEMENTS.join('|')})([^/>\\]]*(?!/)[>\\]])[^<\\[]*$`),
|
|
274
|
+
end: new RegExp(`[<\\[]/#(?:${BLOCK_ELEMENTS.join('|')})[\\r\\n\\t ]*>`)
|
|
275
|
+
}
|
|
276
|
+
},
|
|
277
|
+
onEnterRules: [
|
|
278
|
+
{
|
|
279
|
+
beforeText: new RegExp(
|
|
280
|
+
`[<\\[]#(?!(?:${EMPTY_ELEMENTS.join('|')}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`
|
|
281
|
+
),
|
|
282
|
+
afterText: new RegExp(`^[<\\[]/#([a-zA-Z_]+)[\\r\\n\\t ]*[>\\]]$`),
|
|
283
|
+
action: {
|
|
284
|
+
indentAction: languages.IndentAction.IndentOutdent
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
{
|
|
288
|
+
beforeText: new RegExp(
|
|
289
|
+
`[<\\[]#(?!(?:${EMPTY_ELEMENTS.join('|')}))([a-zA-Z_]+)([^/>\\]]*(?!/)[>\\]])[^[<\\[]]*$`
|
|
290
|
+
),
|
|
291
|
+
action: { indentAction: languages.IndentAction.Indent }
|
|
292
|
+
}
|
|
293
|
+
]
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
function createMonarchLanguage(ts: TagSyntax, is: InterpolationSyntax): languages.IMonarchLanguage {
|
|
298
|
+
// For generating dynamic states with the ID, used for auto mode
|
|
299
|
+
// where we switch once we have detected the mode.
|
|
300
|
+
const id = `_${ts.id}_${is.id}`;
|
|
301
|
+
const s = (name: string): string => name.replace(/__id__/g, id);
|
|
302
|
+
const r = (regexp: RegExp): RegExp => {
|
|
303
|
+
const source = regexp.source.replace(/__id__/g, id);
|
|
304
|
+
return new RegExp(source, regexp.flags);
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
return {
|
|
308
|
+
// Settings
|
|
309
|
+
|
|
310
|
+
unicode: true,
|
|
311
|
+
|
|
312
|
+
includeLF: false,
|
|
313
|
+
|
|
314
|
+
start: s('default__id__'),
|
|
315
|
+
|
|
316
|
+
ignoreCase: false,
|
|
317
|
+
|
|
318
|
+
defaultToken: 'invalid',
|
|
319
|
+
|
|
320
|
+
tokenPostfix: `.freemarker2`,
|
|
321
|
+
|
|
322
|
+
brackets: [
|
|
323
|
+
{ open: '{', close: '}', token: 'delimiter.curly' },
|
|
324
|
+
{ open: '[', close: ']', token: 'delimiter.square' },
|
|
325
|
+
{ open: '(', close: ')', token: 'delimiter.parenthesis' },
|
|
326
|
+
{ open: '<', close: '>', token: 'delimiter.angle' }
|
|
327
|
+
],
|
|
328
|
+
|
|
329
|
+
// Dynamic RegExp
|
|
330
|
+
|
|
331
|
+
[s('open__id__')]: new RegExp(ts.open),
|
|
332
|
+
[s('close__id__')]: new RegExp(ts.close),
|
|
333
|
+
[s('iOpen1__id__')]: new RegExp(is.open1),
|
|
334
|
+
[s('iOpen2__id__')]: new RegExp(is.open2),
|
|
335
|
+
[s('iClose__id__')]: new RegExp(is.close),
|
|
336
|
+
|
|
337
|
+
// <#START_TAG : "<" | "<#" | "[#">
|
|
338
|
+
// <#END_TAG : "</" | "</#" | "[/#">
|
|
339
|
+
[s('startTag__id__')]: r(/(@open__id__)(#)/),
|
|
340
|
+
[s('endTag__id__')]: r(/(@open__id__)(\/#)/),
|
|
341
|
+
[s('startOrEndTag__id__')]: r(/(@open__id__)(\/?#)/),
|
|
342
|
+
|
|
343
|
+
// <#CLOSE_TAG1 : (<BLANK>)* (">" | "]")>
|
|
344
|
+
[s('closeTag1__id__')]: r(/((?:@blank)*)(@close__id__)/),
|
|
345
|
+
|
|
346
|
+
// <#CLOSE_TAG2 : (<BLANK>)* ("/")? (">" | "]")>
|
|
347
|
+
[s('closeTag2__id__')]: r(/((?:@blank)*\/?)(@close__id__)/),
|
|
348
|
+
|
|
349
|
+
// Static RegExp
|
|
350
|
+
|
|
351
|
+
// <#BLANK : " " | "\t" | "\n" | "\r">
|
|
352
|
+
blank: /[ \t\n\r]/,
|
|
353
|
+
|
|
354
|
+
// <FALSE : "false">
|
|
355
|
+
// <TRUE : "true">
|
|
356
|
+
// <IN : "in">
|
|
357
|
+
// <AS : "as">
|
|
358
|
+
// <USING : "using">
|
|
359
|
+
keywords: ['false', 'true', 'in', 'as', 'using'],
|
|
360
|
+
|
|
361
|
+
// Directive names that cannot have an expression parameters and cannot be self-closing
|
|
362
|
+
// E.g. <#if id==2> ... </#if>
|
|
363
|
+
directiveStartCloseTag1:
|
|
364
|
+
/attempt|recover|sep|auto[eE]sc|no(?:autoe|AutoE)sc|compress|default|no[eE]scape|comment|no[pP]arse/,
|
|
365
|
+
|
|
366
|
+
// Directive names that cannot have an expression parameter and can be self-closing
|
|
367
|
+
// E.g. <#if> ... <#else> ... </#if>
|
|
368
|
+
// E.g. <#if> ... <#else /></#if>
|
|
369
|
+
directiveStartCloseTag2:
|
|
370
|
+
/else|break|continue|return|stop|flush|t|lt|rt|nt|nested|recurse|fallback|ftl/,
|
|
371
|
+
|
|
372
|
+
// Directive names that can have an expression parameter and cannot be self-closing
|
|
373
|
+
// E.g. <#if id==2> ... </#if>
|
|
374
|
+
directiveStartBlank:
|
|
375
|
+
/if|else[iI]f|list|for[eE]ach|switch|case|assign|global|local|include|import|function|macro|transform|visit|stop|return|call|setting|output[fF]ormat|nested|recurse|escape|ftl|items/,
|
|
376
|
+
|
|
377
|
+
// Directive names that can have an end tag
|
|
378
|
+
// E.g. </#if>
|
|
379
|
+
directiveEndCloseTag1:
|
|
380
|
+
/if|list|items|sep|recover|attempt|for[eE]ach|local|global|assign|function|macro|output[fF]ormat|auto[eE]sc|no(?:autoe|AutoE)sc|compress|transform|switch|escape|no[eE]scape/,
|
|
381
|
+
|
|
382
|
+
// <#ESCAPED_CHAR :
|
|
383
|
+
// "\\"
|
|
384
|
+
// (
|
|
385
|
+
// ("n" | "t" | "r" | "f" | "b" | "g" | "l" | "a" | "\\" | "'" | "\"" | "{" | "=")
|
|
386
|
+
// |
|
|
387
|
+
// ("x" ["0"-"9", "A"-"F", "a"-"f"])
|
|
388
|
+
// )
|
|
389
|
+
// >
|
|
390
|
+
// Note: While the JavaCC tokenizer rule only specifies one hex digit,
|
|
391
|
+
// FreeMarker actually interprets up to 4 hex digits.
|
|
392
|
+
escapedChar: /\\(?:[ntrfbgla\\'"\{=]|(?:x[0-9A-Fa-f]{1,4}))/,
|
|
393
|
+
|
|
394
|
+
// <#ASCII_DIGIT: ["0" - "9"]>
|
|
395
|
+
asciiDigit: /[0-9]/,
|
|
396
|
+
|
|
397
|
+
// <INTEGER : (["0"-"9"])+>
|
|
398
|
+
integer: /[0-9]+/,
|
|
399
|
+
|
|
400
|
+
// <#NON_ESCAPED_ID_START_CHAR:
|
|
401
|
+
// [
|
|
402
|
+
// // This was generated on JDK 1.8.0_20 Win64 with src/main/misc/identifierChars/IdentifierCharGenerator.java
|
|
403
|
+
// ...
|
|
404
|
+
// ]
|
|
405
|
+
nonEscapedIdStartChar:
|
|
406
|
+
/[\$@-Z_a-z\u00AA\u00B5\u00BA\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u1FFF\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183-\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2-\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3006\u3031-\u3035\u303B-\u303C\u3040-\u318F\u31A0-\u31BA\u31F0-\u31FF\u3300-\u337F\u3400-\u4DB5\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA697\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA78E\uA790-\uA793\uA7A0-\uA7AA\uA7F8-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA80-\uAAAF\uAAB1\uAAB5-\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uABC0-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40-\uFB41\uFB43-\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]/,
|
|
407
|
+
|
|
408
|
+
// <#ESCAPED_ID_CHAR: "\\" ("-" | "." | ":" | "#")>
|
|
409
|
+
escapedIdChar: /\\[\-\.:#]/,
|
|
410
|
+
|
|
411
|
+
// <#ID_START_CHAR: <NON_ESCAPED_ID_START_CHAR>|<ESCAPED_ID_CHAR>>
|
|
412
|
+
idStartChar: /(?:@nonEscapedIdStartChar)|(?:@escapedIdChar)/,
|
|
413
|
+
|
|
414
|
+
// <ID: <ID_START_CHAR> (<ID_START_CHAR>|<ASCII_DIGIT>)*>
|
|
415
|
+
id: /(?:@idStartChar)(?:(?:@idStartChar)|(?:@asciiDigit))*/,
|
|
416
|
+
|
|
417
|
+
// Certain keywords / operators are allowed to index hashes
|
|
418
|
+
//
|
|
419
|
+
// Expression DotVariable(Expression exp) :
|
|
420
|
+
// {
|
|
421
|
+
// Token t;
|
|
422
|
+
// }
|
|
423
|
+
// {
|
|
424
|
+
// <DOT>
|
|
425
|
+
// (
|
|
426
|
+
// t = <ID> | t = <TIMES> | t = <DOUBLE_STAR>
|
|
427
|
+
// |
|
|
428
|
+
// (
|
|
429
|
+
// t = <LESS_THAN>
|
|
430
|
+
// |
|
|
431
|
+
// t = <LESS_THAN_EQUALS>
|
|
432
|
+
// |
|
|
433
|
+
// t = <ESCAPED_GT>
|
|
434
|
+
// |
|
|
435
|
+
// t = <ESCAPED_GTE>
|
|
436
|
+
// |
|
|
437
|
+
// t = <FALSE>
|
|
438
|
+
// |
|
|
439
|
+
// t = <TRUE>
|
|
440
|
+
// |
|
|
441
|
+
// t = <IN>
|
|
442
|
+
// |
|
|
443
|
+
// t = <AS>
|
|
444
|
+
// |
|
|
445
|
+
// t = <USING>
|
|
446
|
+
// )
|
|
447
|
+
// {
|
|
448
|
+
// if (!Character.isLetter(t.image.charAt(0))) {
|
|
449
|
+
// throw new ParseException(t.image + " is not a valid identifier.", template, t);
|
|
450
|
+
// }
|
|
451
|
+
// }
|
|
452
|
+
// )
|
|
453
|
+
// {
|
|
454
|
+
// notListLiteral(exp, "hash");
|
|
455
|
+
// notStringLiteral(exp, "hash");
|
|
456
|
+
// notBooleanLiteral(exp, "hash");
|
|
457
|
+
// Dot dot = new Dot(exp, t.image);
|
|
458
|
+
// dot.setLocation(template, exp, t);
|
|
459
|
+
// return dot;
|
|
460
|
+
// }
|
|
461
|
+
// }
|
|
462
|
+
specialHashKeys: /\*\*|\*|false|true|in|as|using/,
|
|
463
|
+
|
|
464
|
+
// <DOUBLE_EQUALS : "==">
|
|
465
|
+
// <EQUALS : "=">
|
|
466
|
+
// <NOT_EQUALS : "!=">
|
|
467
|
+
// <PLUS_EQUALS : "+=">
|
|
468
|
+
// <MINUS_EQUALS : "-=">
|
|
469
|
+
// <TIMES_EQUALS : "*=">
|
|
470
|
+
// <DIV_EQUALS : "/=">
|
|
471
|
+
// <MOD_EQUALS : "%=">
|
|
472
|
+
// <PLUS_PLUS : "++">
|
|
473
|
+
// <MINUS_MINUS : "--">
|
|
474
|
+
// <LESS_THAN_EQUALS : "lte" | "\\lte" | "<=" | "<=">
|
|
475
|
+
// <LESS_THAN : "lt" | "\\lt" | "<" | "<">
|
|
476
|
+
// <ESCAPED_GTE : "gte" | "\\gte" | ">=">
|
|
477
|
+
// <ESCAPED_GT: "gt" | "\\gt" | ">">
|
|
478
|
+
// <DOUBLE_STAR : "**">
|
|
479
|
+
// <PLUS : "+">
|
|
480
|
+
// <MINUS : "-">
|
|
481
|
+
// <TIMES : "*">
|
|
482
|
+
// <PERCENT : "%">
|
|
483
|
+
// <AND : "&" | "&&" | "&&" | "\\and" >
|
|
484
|
+
// <OR : "|" | "||">
|
|
485
|
+
// <EXCLAM : "!">
|
|
486
|
+
// <COMMA : ",">
|
|
487
|
+
// <SEMICOLON : ";">
|
|
488
|
+
// <COLON : ":">
|
|
489
|
+
// <ELLIPSIS : "...">
|
|
490
|
+
// <DOT_DOT_ASTERISK : "..*" >
|
|
491
|
+
// <DOT_DOT_LESS : "..<" | "..!" >
|
|
492
|
+
// <DOT_DOT : "..">
|
|
493
|
+
// <EXISTS : "??">
|
|
494
|
+
// <BUILT_IN : "?">
|
|
495
|
+
// <LAMBDA_ARROW : "->" | "->">
|
|
496
|
+
namedSymbols:
|
|
497
|
+
/<=|>=|\\lte|\\lt|<|\\gte|\\gt|>|&&|\\and|->|->|==|!=|\+=|-=|\*=|\/=|%=|\+\+|--|<=|&&|\|\||:|\.\.\.|\.\.\*|\.\.<|\.\.!|\?\?|=|<|\+|-|\*|\/|%|\||\.\.|\?|!|&|\.|,|;/,
|
|
498
|
+
arrows: ['->', '->'],
|
|
499
|
+
delimiters: [';', ':', ',', '.'],
|
|
500
|
+
stringOperators: ['lte', 'lt', 'gte', 'gt'],
|
|
501
|
+
|
|
502
|
+
noParseTags: ['noparse', 'noParse', 'comment'],
|
|
503
|
+
|
|
504
|
+
tokenizer: {
|
|
505
|
+
// Parser states
|
|
506
|
+
|
|
507
|
+
// Plain text
|
|
508
|
+
[s('default__id__')]: [
|
|
509
|
+
{ include: s('@directive_token__id__') },
|
|
510
|
+
{ include: s('@interpolation_and_text_token__id__') }
|
|
511
|
+
],
|
|
512
|
+
|
|
513
|
+
// A FreeMarker expression inside a directive, e.g. <#if 2<3>
|
|
514
|
+
[s('fmExpression__id__.directive')]: [
|
|
515
|
+
{ include: s('@blank_and_expression_comment_token__id__') },
|
|
516
|
+
{ include: s('@directive_end_token__id__') },
|
|
517
|
+
{ include: s('@expression_token__id__') }
|
|
518
|
+
],
|
|
519
|
+
|
|
520
|
+
// A FreeMarker expression inside an interpolation, e.g. ${2+3}
|
|
521
|
+
[s('fmExpression__id__.interpolation')]: [
|
|
522
|
+
{ include: s('@blank_and_expression_comment_token__id__') },
|
|
523
|
+
{ include: s('@expression_token__id__') },
|
|
524
|
+
{ include: s('@greater_operators_token__id__') }
|
|
525
|
+
],
|
|
526
|
+
|
|
527
|
+
// In an expression and inside a not-yet closed parenthesis / bracket
|
|
528
|
+
[s('inParen__id__.plain')]: [
|
|
529
|
+
{ include: s('@blank_and_expression_comment_token__id__') },
|
|
530
|
+
{ include: s('@directive_end_token__id__') },
|
|
531
|
+
{ include: s('@expression_token__id__') }
|
|
532
|
+
],
|
|
533
|
+
[s('inParen__id__.gt')]: [
|
|
534
|
+
{ include: s('@blank_and_expression_comment_token__id__') },
|
|
535
|
+
{ include: s('@expression_token__id__') },
|
|
536
|
+
{ include: s('@greater_operators_token__id__') }
|
|
537
|
+
],
|
|
538
|
+
|
|
539
|
+
// Expression for the unified call, e.g. <@createMacro() ... >
|
|
540
|
+
[s('noSpaceExpression__id__')]: [
|
|
541
|
+
{ include: s('@no_space_expression_end_token__id__') },
|
|
542
|
+
{ include: s('@directive_end_token__id__') },
|
|
543
|
+
{ include: s('@expression_token__id__') }
|
|
544
|
+
],
|
|
545
|
+
|
|
546
|
+
// For the function of a unified call. Special case for when the
|
|
547
|
+
// expression is a simple identifier.
|
|
548
|
+
// <@join [1,2] ",">
|
|
549
|
+
// <@null!join [1,2] ",">
|
|
550
|
+
[s('unifiedCall__id__')]: [{ include: s('@unified_call_token__id__') }],
|
|
551
|
+
|
|
552
|
+
// For singly and doubly quoted string (that may contain interpolations)
|
|
553
|
+
[s('singleString__id__')]: [{ include: s('@string_single_token__id__') }],
|
|
554
|
+
[s('doubleString__id__')]: [{ include: s('@string_double_token__id__') }],
|
|
555
|
+
|
|
556
|
+
// For singly and doubly quoted string (that may not contain interpolations)
|
|
557
|
+
[s('rawSingleString__id__')]: [{ include: s('@string_single_raw_token__id__') }],
|
|
558
|
+
[s('rawDoubleString__id__')]: [{ include: s('@string_double_raw_token__id__') }],
|
|
559
|
+
|
|
560
|
+
// For a comment in an expression
|
|
561
|
+
// ${ 1 + <#-- comment --> 2}
|
|
562
|
+
[s('expressionComment__id__')]: [{ include: s('@expression_comment_token__id__') }],
|
|
563
|
+
|
|
564
|
+
// For <#noparse> ... </#noparse>
|
|
565
|
+
// For <#noParse> ... </#noParse>
|
|
566
|
+
// For <#comment> ... </#comment>
|
|
567
|
+
[s('noParse__id__')]: [{ include: s('@no_parse_token__id__') }],
|
|
568
|
+
|
|
569
|
+
// For <#-- ... -->
|
|
570
|
+
[s('terseComment__id__')]: [{ include: s('@terse_comment_token__id__') }],
|
|
571
|
+
|
|
572
|
+
// Common rules
|
|
573
|
+
|
|
574
|
+
[s('directive_token__id__')]: [
|
|
575
|
+
// <ATTEMPT : <START_TAG> "attempt" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
576
|
+
// <RECOVER : <START_TAG> "recover" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
577
|
+
// <SEP : <START_TAG> "sep" <CLOSE_TAG1>>
|
|
578
|
+
// <AUTOESC : <START_TAG> "auto" ("e"|"E") "sc" <CLOSE_TAG1>> {
|
|
579
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT);
|
|
580
|
+
// }
|
|
581
|
+
// <NOAUTOESC : <START_TAG> "no" ("autoe"|"AutoE") "sc" <CLOSE_TAG1>> {
|
|
582
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
|
|
583
|
+
// }
|
|
584
|
+
// <COMPRESS : <START_TAG> "compress" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
585
|
+
// <DEFAUL : <START_TAG> "default" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
586
|
+
// <NOESCAPE : <START_TAG> "no" ("e" | "E") "scape" <CLOSE_TAG1>> {
|
|
587
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
|
|
588
|
+
// }
|
|
589
|
+
//
|
|
590
|
+
// <COMMENT : <START_TAG> "comment" <CLOSE_TAG1>> {
|
|
591
|
+
// handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); noparseTag = "comment";
|
|
592
|
+
// }
|
|
593
|
+
// <NOPARSE: <START_TAG> "no" ("p" | "P") "arse" <CLOSE_TAG1>> {
|
|
594
|
+
// int tagNamingConvention = getTagNamingConvention(matchedToken, 2);
|
|
595
|
+
// handleTagSyntaxAndSwitch(matchedToken, tagNamingConvention, NO_PARSE);
|
|
596
|
+
// noparseTag = tagNamingConvention == Configuration.CAMEL_CASE_NAMING_CONVENTION ? "noParse" : "noparse";
|
|
597
|
+
// }
|
|
598
|
+
[
|
|
599
|
+
r(/(?:@startTag__id__)(@directiveStartCloseTag1)(?:@closeTag1__id__)/),
|
|
600
|
+
ts.id === 'auto'
|
|
601
|
+
? {
|
|
602
|
+
cases: {
|
|
603
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
604
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
: [
|
|
608
|
+
{ token: '@brackets.directive' },
|
|
609
|
+
{ token: 'delimiter.directive' },
|
|
610
|
+
{
|
|
611
|
+
cases: {
|
|
612
|
+
'@noParseTags': { token: 'tag', next: s('@noParse__id__.$3') },
|
|
613
|
+
'@default': { token: 'tag' }
|
|
614
|
+
}
|
|
615
|
+
},
|
|
616
|
+
{ token: 'delimiter.directive' },
|
|
617
|
+
{ token: '@brackets.directive' }
|
|
618
|
+
]
|
|
619
|
+
],
|
|
620
|
+
|
|
621
|
+
// <ELSE : <START_TAG> "else" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
622
|
+
// <BREAK : <START_TAG> "break" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
623
|
+
// <CONTINUE : <START_TAG> "continue" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
624
|
+
// <SIMPLE_RETURN : <START_TAG> "return" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
625
|
+
// <HALT : <START_TAG> "stop" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
626
|
+
// <FLUSH : <START_TAG> "flush" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
627
|
+
// <TRIM : <START_TAG> "t" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
628
|
+
// <LTRIM : <START_TAG> "lt" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
629
|
+
// <RTRIM : <START_TAG> "rt" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
630
|
+
// <NOTRIM : <START_TAG> "nt" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
631
|
+
// <SIMPLE_NESTED : <START_TAG> "nested" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
632
|
+
// <SIMPLE_RECURSE : <START_TAG> "recurse" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
633
|
+
// <FALLBACK : <START_TAG> "fallback" <CLOSE_TAG2>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
634
|
+
// <TRIVIAL_FTL_HEADER : ("<#ftl" | "[#ftl") ("/")? (">" | "]")> { ftlHeader(matchedToken); }
|
|
635
|
+
[
|
|
636
|
+
r(/(?:@startTag__id__)(@directiveStartCloseTag2)(?:@closeTag2__id__)/),
|
|
637
|
+
ts.id === 'auto'
|
|
638
|
+
? {
|
|
639
|
+
cases: {
|
|
640
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
641
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
: [
|
|
645
|
+
{ token: '@brackets.directive' },
|
|
646
|
+
{ token: 'delimiter.directive' },
|
|
647
|
+
{ token: 'tag' },
|
|
648
|
+
{ token: 'delimiter.directive' },
|
|
649
|
+
{ token: '@brackets.directive' }
|
|
650
|
+
]
|
|
651
|
+
],
|
|
652
|
+
|
|
653
|
+
// <IF : <START_TAG> "if" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
654
|
+
// <ELSE_IF : <START_TAG> "else" ("i" | "I") "f" <BLANK>> {
|
|
655
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), FM_EXPRESSION);
|
|
656
|
+
// }
|
|
657
|
+
// <LIST : <START_TAG> "list" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
658
|
+
// <FOREACH : <START_TAG> "for" ("e" | "E") "ach" <BLANK>> {
|
|
659
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), FM_EXPRESSION);
|
|
660
|
+
// }
|
|
661
|
+
// <SWITCH : <START_TAG> "switch" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
662
|
+
// <CASE : <START_TAG> "case" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
663
|
+
// <ASSIGN : <START_TAG> "assign" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
664
|
+
// <GLOBALASSIGN : <START_TAG> "global" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
665
|
+
// <LOCALASSIGN : <START_TAG> "local" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
666
|
+
// <_INCLUDE : <START_TAG> "include" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
667
|
+
// <IMPORT : <START_TAG> "import" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
668
|
+
// <FUNCTION : <START_TAG> "function" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
669
|
+
// <MACRO : <START_TAG> "macro" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
670
|
+
// <TRANSFORM : <START_TAG> "transform" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
671
|
+
// <VISIT : <START_TAG> "visit" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
672
|
+
// <STOP : <START_TAG> "stop" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
673
|
+
// <RETURN : <START_TAG> "return" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
674
|
+
// <CALL : <START_TAG> "call" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
675
|
+
// <SETTING : <START_TAG> "setting" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
676
|
+
// <OUTPUTFORMAT : <START_TAG> "output" ("f"|"F") "ormat" <BLANK>> {
|
|
677
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), FM_EXPRESSION);
|
|
678
|
+
// }
|
|
679
|
+
// <NESTED : <START_TAG> "nested" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
680
|
+
// <RECURSE : <START_TAG> "recurse" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
681
|
+
// <ESCAPE : <START_TAG> "escape" <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
682
|
+
//
|
|
683
|
+
// Note: FreeMarker grammar appears to treat the FTL header as a special case,
|
|
684
|
+
// in order to remove new lines after the header (?), but since we only need
|
|
685
|
+
// to tokenize for highlighting, we can include this directive here.
|
|
686
|
+
// <FTL_HEADER : ("<#ftl" | "[#ftl") <BLANK>> { ftlHeader(matchedToken); }
|
|
687
|
+
//
|
|
688
|
+
// Note: FreeMarker grammar appears to treat the items directive as a special case for
|
|
689
|
+
// the AST parsing process, but since we only need to tokenize, we can include this
|
|
690
|
+
// directive here.
|
|
691
|
+
// <ITEMS : <START_TAG> "items" (<BLANK>)+ <AS> <BLANK>> { handleTagSyntaxAndSwitch(matchedToken, FM_EXPRESSION); }
|
|
692
|
+
[
|
|
693
|
+
r(/(?:@startTag__id__)(@directiveStartBlank)(@blank)/),
|
|
694
|
+
ts.id === 'auto'
|
|
695
|
+
? {
|
|
696
|
+
cases: {
|
|
697
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
698
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
: [
|
|
702
|
+
{ token: '@brackets.directive' },
|
|
703
|
+
{ token: 'delimiter.directive' },
|
|
704
|
+
{ token: 'tag' },
|
|
705
|
+
{ token: '', next: s('@fmExpression__id__.directive') }
|
|
706
|
+
]
|
|
707
|
+
],
|
|
708
|
+
|
|
709
|
+
// <END_IF : <END_TAG> "if" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
710
|
+
// <END_LIST : <END_TAG> "list" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
711
|
+
// <END_SEP : <END_TAG> "sep" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
712
|
+
// <END_RECOVER : <END_TAG> "recover" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
713
|
+
// <END_ATTEMPT : <END_TAG> "attempt" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
714
|
+
// <END_FOREACH : <END_TAG> "for" ("e" | "E") "ach" <CLOSE_TAG1>> {
|
|
715
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 3), DEFAULT);
|
|
716
|
+
// }
|
|
717
|
+
// <END_LOCAL : <END_TAG> "local" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
718
|
+
// <END_GLOBAL : <END_TAG> "global" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
719
|
+
// <END_ASSIGN : <END_TAG> "assign" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
720
|
+
// <END_FUNCTION : <END_TAG> "function" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
721
|
+
// <END_MACRO : <END_TAG> "macro" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
722
|
+
// <END_OUTPUTFORMAT : <END_TAG> "output" ("f" | "F") "ormat" <CLOSE_TAG1>> {
|
|
723
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 6), DEFAULT);
|
|
724
|
+
// }
|
|
725
|
+
// <END_AUTOESC : <END_TAG> "auto" ("e" | "E") "sc" <CLOSE_TAG1>> {
|
|
726
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 4), DEFAULT);
|
|
727
|
+
// }
|
|
728
|
+
// <END_NOAUTOESC : <END_TAG> "no" ("autoe"|"AutoE") "sc" <CLOSE_TAG1>> {
|
|
729
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
|
|
730
|
+
// }
|
|
731
|
+
// <END_COMPRESS : <END_TAG> "compress" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
732
|
+
// <END_TRANSFORM : <END_TAG> "transform" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
733
|
+
// <END_SWITCH : <END_TAG> "switch" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
734
|
+
// <END_ESCAPE : <END_TAG> "escape" <CLOSE_TAG1>> { handleTagSyntaxAndSwitch(matchedToken, DEFAULT); }
|
|
735
|
+
// <END_NOESCAPE : <END_TAG> "no" ("e" | "E") "scape" <CLOSE_TAG1>> {
|
|
736
|
+
// handleTagSyntaxAndSwitch(matchedToken, getTagNamingConvention(matchedToken, 2), DEFAULT);
|
|
737
|
+
// }
|
|
738
|
+
[
|
|
739
|
+
r(/(?:@endTag__id__)(@directiveEndCloseTag1)(?:@closeTag1__id__)/),
|
|
740
|
+
ts.id === 'auto'
|
|
741
|
+
? {
|
|
742
|
+
cases: {
|
|
743
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
744
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
: [
|
|
748
|
+
{ token: '@brackets.directive' },
|
|
749
|
+
{ token: 'delimiter.directive' },
|
|
750
|
+
{ token: 'tag' },
|
|
751
|
+
{ token: 'delimiter.directive' },
|
|
752
|
+
{ token: '@brackets.directive' }
|
|
753
|
+
]
|
|
754
|
+
],
|
|
755
|
+
|
|
756
|
+
// <UNIFIED_CALL : "<@" | "[@" > { unifiedCall(matchedToken); }
|
|
757
|
+
[
|
|
758
|
+
r(/(@open__id__)(@)/),
|
|
759
|
+
ts.id === 'auto'
|
|
760
|
+
? {
|
|
761
|
+
cases: {
|
|
762
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
763
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
764
|
+
}
|
|
765
|
+
}
|
|
766
|
+
: [
|
|
767
|
+
{ token: '@brackets.directive' },
|
|
768
|
+
{ token: 'delimiter.directive', next: s('@unifiedCall__id__') }
|
|
769
|
+
]
|
|
770
|
+
],
|
|
771
|
+
|
|
772
|
+
// <UNIFIED_CALL_END : ("<" | "[") "/@" ((<ID>) ("."<ID>)*)? <CLOSE_TAG1>> { unifiedCallEnd(matchedToken); }
|
|
773
|
+
[
|
|
774
|
+
r(/(@open__id__)(\/@)((?:(?:@id)(?:\.(?:@id))*)?)(?:@closeTag1__id__)/),
|
|
775
|
+
[
|
|
776
|
+
{ token: '@brackets.directive' },
|
|
777
|
+
{ token: 'delimiter.directive' },
|
|
778
|
+
{ token: 'tag' },
|
|
779
|
+
{ token: 'delimiter.directive' },
|
|
780
|
+
{ token: '@brackets.directive' }
|
|
781
|
+
]
|
|
782
|
+
],
|
|
783
|
+
|
|
784
|
+
// <TERSE_COMMENT : ("<" | "[") "#--" > { noparseTag = "-->"; handleTagSyntaxAndSwitch(matchedToken, NO_PARSE); }
|
|
785
|
+
[
|
|
786
|
+
r(/(@open__id__)#--/),
|
|
787
|
+
ts.id === 'auto'
|
|
788
|
+
? {
|
|
789
|
+
cases: {
|
|
790
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
791
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
792
|
+
}
|
|
793
|
+
}
|
|
794
|
+
: { token: 'comment', next: s('@terseComment__id__') }
|
|
795
|
+
],
|
|
796
|
+
|
|
797
|
+
// <UNKNOWN_DIRECTIVE : ("[#" | "[/#" | "<#" | "</#") (["a"-"z", "A"-"Z", "_"])+>
|
|
798
|
+
[
|
|
799
|
+
r(/(?:@startOrEndTag__id__)([a-zA-Z_]+)/),
|
|
800
|
+
ts.id === 'auto'
|
|
801
|
+
? {
|
|
802
|
+
cases: {
|
|
803
|
+
'$1==<': { token: '@rematch', switchTo: `@default_angle_${is.id}` },
|
|
804
|
+
'$1==[': { token: '@rematch', switchTo: `@default_bracket_${is.id}` }
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
: [
|
|
808
|
+
{ token: '@brackets.directive' },
|
|
809
|
+
{ token: 'delimiter.directive' },
|
|
810
|
+
{ token: 'tag.invalid', next: s('@fmExpression__id__.directive') }
|
|
811
|
+
]
|
|
812
|
+
]
|
|
813
|
+
],
|
|
814
|
+
|
|
815
|
+
// <DEFAULT, NO_DIRECTIVE> TOKEN :
|
|
816
|
+
[s('interpolation_and_text_token__id__')]: [
|
|
817
|
+
// <DOLLAR_INTERPOLATION_OPENING : "${"> { startInterpolation(matchedToken); }
|
|
818
|
+
// <SQUARE_BRACKET_INTERPOLATION_OPENING : "[="> { startInterpolation(matchedToken); }
|
|
819
|
+
[
|
|
820
|
+
r(/(@iOpen1__id__)(@iOpen2__id__)/),
|
|
821
|
+
[
|
|
822
|
+
{ token: is.id === 'bracket' ? '@brackets.interpolation' : 'delimiter.interpolation' },
|
|
823
|
+
{
|
|
824
|
+
token: is.id === 'bracket' ? 'delimiter.interpolation' : '@brackets.interpolation',
|
|
825
|
+
next: s('@fmExpression__id__.interpolation')
|
|
826
|
+
}
|
|
827
|
+
]
|
|
828
|
+
],
|
|
829
|
+
|
|
830
|
+
// <STATIC_TEXT_FALSE_ALARM : "$" | "#" | "<" | "[" | "{"> // to handle a lone dollar sign or "<" or "# or <@ with whitespace after"
|
|
831
|
+
// <STATIC_TEXT_WS : ("\n" | "\r" | "\t" | " ")+>
|
|
832
|
+
// <STATIC_TEXT_NON_WS : (~["$", "<", "#", "[", "{", "\n", "\r", "\t", " "])+>
|
|
833
|
+
[/[\$#<\[\{]|(?:@blank)+|[^\$<#\[\{\n\r\t ]+/, { token: 'source' }]
|
|
834
|
+
],
|
|
835
|
+
|
|
836
|
+
// <STRING_LITERAL :
|
|
837
|
+
// (
|
|
838
|
+
// "\""
|
|
839
|
+
// ((~["\"", "\\"]) | <ESCAPED_CHAR>)*
|
|
840
|
+
// "\""
|
|
841
|
+
// )
|
|
842
|
+
// |
|
|
843
|
+
// (
|
|
844
|
+
// "'"
|
|
845
|
+
// ((~["'", "\\"]) | <ESCAPED_CHAR>)*
|
|
846
|
+
// "'"
|
|
847
|
+
// )
|
|
848
|
+
// >
|
|
849
|
+
[s('string_single_token__id__')]: [
|
|
850
|
+
[/[^'\\]/, { token: 'string' }],
|
|
851
|
+
[/@escapedChar/, { token: 'string.escape' }],
|
|
852
|
+
[/'/, { token: 'string', next: '@pop' }]
|
|
853
|
+
],
|
|
854
|
+
[s('string_double_token__id__')]: [
|
|
855
|
+
[/[^"\\]/, { token: 'string' }],
|
|
856
|
+
[/@escapedChar/, { token: 'string.escape' }],
|
|
857
|
+
[/"/, { token: 'string', next: '@pop' }]
|
|
858
|
+
],
|
|
859
|
+
|
|
860
|
+
// <RAW_STRING : "r" (("\"" (~["\""])* "\"") | ("'" (~["'"])* "'"))>
|
|
861
|
+
[s('string_single_raw_token__id__')]: [
|
|
862
|
+
[/[^']+/, { token: 'string.raw' }],
|
|
863
|
+
[/'/, { token: 'string.raw', next: '@pop' }]
|
|
864
|
+
],
|
|
865
|
+
[s('string_double_raw_token__id__')]: [
|
|
866
|
+
[/[^"]+/, { token: 'string.raw' }],
|
|
867
|
+
[/"/, { token: 'string.raw', next: '@pop' }]
|
|
868
|
+
],
|
|
869
|
+
|
|
870
|
+
// <FM_EXPRESSION, IN_PAREN, NO_SPACE_EXPRESSION, NAMED_PARAMETER_EXPRESSION> TOKEN :
|
|
871
|
+
[s('expression_token__id__')]: [
|
|
872
|
+
// Strings
|
|
873
|
+
[
|
|
874
|
+
/(r?)(['"])/,
|
|
875
|
+
{
|
|
876
|
+
cases: {
|
|
877
|
+
"r'": [
|
|
878
|
+
{ token: 'keyword' },
|
|
879
|
+
{ token: 'string.raw', next: s('@rawSingleString__id__') }
|
|
880
|
+
],
|
|
881
|
+
'r"': [
|
|
882
|
+
{ token: 'keyword' },
|
|
883
|
+
{ token: 'string.raw', next: s('@rawDoubleString__id__') }
|
|
884
|
+
],
|
|
885
|
+
"'": [{ token: 'source' }, { token: 'string', next: s('@singleString__id__') }],
|
|
886
|
+
'"': [{ token: 'source' }, { token: 'string', next: s('@doubleString__id__') }]
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
],
|
|
890
|
+
|
|
891
|
+
// Numbers
|
|
892
|
+
// <INTEGER : (["0"-"9"])+>
|
|
893
|
+
// <DECIMAL : <INTEGER> "." <INTEGER>>
|
|
894
|
+
[
|
|
895
|
+
/(?:@integer)(?:\.(?:@integer))?/,
|
|
896
|
+
{
|
|
897
|
+
cases: {
|
|
898
|
+
'(?:@integer)': { token: 'number' },
|
|
899
|
+
'@default': { token: 'number.float' }
|
|
900
|
+
}
|
|
901
|
+
}
|
|
902
|
+
],
|
|
903
|
+
|
|
904
|
+
// Special hash keys that must not be treated as identifiers
|
|
905
|
+
// after a period, e.g. a.** is accessing the key "**" of a
|
|
906
|
+
[
|
|
907
|
+
/(\.)(@blank*)(@specialHashKeys)/,
|
|
908
|
+
[{ token: 'delimiter' }, { token: '' }, { token: 'identifier' }]
|
|
909
|
+
],
|
|
910
|
+
|
|
911
|
+
// Symbols / operators
|
|
912
|
+
[
|
|
913
|
+
/(?:@namedSymbols)/,
|
|
914
|
+
{
|
|
915
|
+
cases: {
|
|
916
|
+
'@arrows': { token: 'meta.arrow' },
|
|
917
|
+
'@delimiters': { token: 'delimiter' },
|
|
918
|
+
'@default': { token: 'operators' }
|
|
919
|
+
}
|
|
920
|
+
}
|
|
921
|
+
],
|
|
922
|
+
|
|
923
|
+
// Identifiers
|
|
924
|
+
[
|
|
925
|
+
/@id/,
|
|
926
|
+
{
|
|
927
|
+
cases: {
|
|
928
|
+
'@keywords': { token: 'keyword.$0' },
|
|
929
|
+
'@stringOperators': { token: 'operators' },
|
|
930
|
+
'@default': { token: 'identifier' }
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
],
|
|
934
|
+
|
|
935
|
+
// <OPEN_BRACKET : "[">
|
|
936
|
+
// <CLOSE_BRACKET : "]">
|
|
937
|
+
// <OPEN_PAREN : "(">
|
|
938
|
+
// <CLOSE_PAREN : ")">
|
|
939
|
+
// <OPENING_CURLY_BRACKET : "{">
|
|
940
|
+
// <CLOSING_CURLY_BRACKET : "}">
|
|
941
|
+
[
|
|
942
|
+
/[\[\]\(\)\{\}]/,
|
|
943
|
+
{
|
|
944
|
+
cases: {
|
|
945
|
+
'\\[': {
|
|
946
|
+
cases: {
|
|
947
|
+
'$S2==gt': { token: '@brackets', next: s('@inParen__id__.gt') },
|
|
948
|
+
'@default': { token: '@brackets', next: s('@inParen__id__.plain') }
|
|
949
|
+
}
|
|
950
|
+
},
|
|
951
|
+
'\\]': {
|
|
952
|
+
cases: {
|
|
953
|
+
...(is.id === 'bracket'
|
|
954
|
+
? {
|
|
955
|
+
'$S2==interpolation': { token: '@brackets.interpolation', next: '@popall' }
|
|
956
|
+
}
|
|
957
|
+
: {}),
|
|
958
|
+
// This cannot happen while in auto mode, since this applies only to an
|
|
959
|
+
// fmExpression inside a directive. But once we encounter the start of a
|
|
960
|
+
// directive, we can establish the tag syntax mode.
|
|
961
|
+
...(ts.id === 'bracket'
|
|
962
|
+
? {
|
|
963
|
+
'$S2==directive': { token: '@brackets.directive', next: '@popall' }
|
|
964
|
+
}
|
|
965
|
+
: {}),
|
|
966
|
+
// Ignore mismatched paren
|
|
967
|
+
[s('$S1==inParen__id__')]: { token: '@brackets', next: '@pop' },
|
|
968
|
+
'@default': { token: '@brackets' }
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
'\\(': { token: '@brackets', next: s('@inParen__id__.gt') },
|
|
972
|
+
'\\)': {
|
|
973
|
+
cases: {
|
|
974
|
+
[s('$S1==inParen__id__')]: { token: '@brackets', next: '@pop' },
|
|
975
|
+
'@default': { token: '@brackets' }
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
'\\{': {
|
|
979
|
+
cases: {
|
|
980
|
+
'$S2==gt': { token: '@brackets', next: s('@inParen__id__.gt') },
|
|
981
|
+
'@default': { token: '@brackets', next: s('@inParen__id__.plain') }
|
|
982
|
+
}
|
|
983
|
+
},
|
|
984
|
+
'\\}': {
|
|
985
|
+
cases: {
|
|
986
|
+
...(is.id === 'bracket'
|
|
987
|
+
? {}
|
|
988
|
+
: {
|
|
989
|
+
'$S2==interpolation': { token: '@brackets.interpolation', next: '@popall' }
|
|
990
|
+
}),
|
|
991
|
+
// Ignore mismatched paren
|
|
992
|
+
[s('$S1==inParen__id__')]: { token: '@brackets', next: '@pop' },
|
|
993
|
+
'@default': { token: '@brackets' }
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
],
|
|
999
|
+
|
|
1000
|
+
// <OPEN_MISPLACED_INTERPOLATION : "${" | "#{" | "[=">
|
|
1001
|
+
[/\$\{/, { token: 'delimiter.invalid' }]
|
|
1002
|
+
],
|
|
1003
|
+
|
|
1004
|
+
// <FM_EXPRESSION, IN_PAREN, NAMED_PARAMETER_EXPRESSION> SKIP :
|
|
1005
|
+
[s('blank_and_expression_comment_token__id__')]: [
|
|
1006
|
+
// < ( " " | "\t" | "\n" | "\r" )+ >
|
|
1007
|
+
[/(?:@blank)+/, { token: '' }],
|
|
1008
|
+
|
|
1009
|
+
// < ("<" | "[") ("#" | "!") "--"> : EXPRESSION_COMMENT
|
|
1010
|
+
[/[<\[][#!]--/, { token: 'comment', next: s('@expressionComment__id__') }]
|
|
1011
|
+
],
|
|
1012
|
+
|
|
1013
|
+
// <FM_EXPRESSION, NO_SPACE_EXPRESSION, NAMED_PARAMETER_EXPRESSION> TOKEN :
|
|
1014
|
+
[s('directive_end_token__id__')]: [
|
|
1015
|
+
// <DIRECTIVE_END : ">">
|
|
1016
|
+
// {
|
|
1017
|
+
// if (inFTLHeader) {
|
|
1018
|
+
// eatNewline();
|
|
1019
|
+
// inFTLHeader = false;
|
|
1020
|
+
// }
|
|
1021
|
+
// if (squBracTagSyntax || postInterpolationLexState != -1 /* We are in an interpolation */) {
|
|
1022
|
+
// matchedToken.kind = NATURAL_GT;
|
|
1023
|
+
// } else {
|
|
1024
|
+
// SwitchTo(DEFAULT);
|
|
1025
|
+
// }
|
|
1026
|
+
// }
|
|
1027
|
+
// This cannot happen while in auto mode, since this applies only to an
|
|
1028
|
+
// fmExpression inside a directive. But once we encounter the start of a
|
|
1029
|
+
// directive, we can establish the tag syntax mode.
|
|
1030
|
+
[
|
|
1031
|
+
/>/,
|
|
1032
|
+
ts.id === 'bracket'
|
|
1033
|
+
? { token: 'operators' }
|
|
1034
|
+
: { token: '@brackets.directive', next: '@popall' }
|
|
1035
|
+
],
|
|
1036
|
+
|
|
1037
|
+
// <EMPTY_DIRECTIVE_END : "/>" | "/]">
|
|
1038
|
+
// It is a syntax error to end a tag with the wrong close token
|
|
1039
|
+
// Let's indicate that to the user by not closing the tag
|
|
1040
|
+
[
|
|
1041
|
+
r(/(\/)(@close__id__)/),
|
|
1042
|
+
[{ token: 'delimiter.directive' }, { token: '@brackets.directive', next: '@popall' }]
|
|
1043
|
+
]
|
|
1044
|
+
],
|
|
1045
|
+
|
|
1046
|
+
// <IN_PAREN> TOKEN :
|
|
1047
|
+
[s('greater_operators_token__id__')]: [
|
|
1048
|
+
// <NATURAL_GT : ">">
|
|
1049
|
+
[/>/, { token: 'operators' }],
|
|
1050
|
+
|
|
1051
|
+
// <NATURAL_GTE : ">=">
|
|
1052
|
+
[/>=/, { token: 'operators' }]
|
|
1053
|
+
],
|
|
1054
|
+
|
|
1055
|
+
// <NO_SPACE_EXPRESSION> TOKEN :
|
|
1056
|
+
[s('no_space_expression_end_token__id__')]: [
|
|
1057
|
+
// <TERMINATING_WHITESPACE : (["\n", "\r", "\t", " "])+> : FM_EXPRESSION
|
|
1058
|
+
[/(?:@blank)+/, { token: '', switchTo: s('@fmExpression__id__.directive') }]
|
|
1059
|
+
],
|
|
1060
|
+
|
|
1061
|
+
[s('unified_call_token__id__')]: [
|
|
1062
|
+
// Special case for a call where the expression is just an ID
|
|
1063
|
+
// <UNIFIED_CALL> <ID> <BLANK>+
|
|
1064
|
+
[
|
|
1065
|
+
/(@id)((?:@blank)+)/,
|
|
1066
|
+
[{ token: 'tag' }, { token: '', next: s('@fmExpression__id__.directive') }]
|
|
1067
|
+
],
|
|
1068
|
+
[
|
|
1069
|
+
r(/(@id)(\/?)(@close__id__)/),
|
|
1070
|
+
[
|
|
1071
|
+
{ token: 'tag' },
|
|
1072
|
+
{ token: 'delimiter.directive' },
|
|
1073
|
+
{ token: '@brackets.directive', next: '@popall' }
|
|
1074
|
+
]
|
|
1075
|
+
],
|
|
1076
|
+
[/./, { token: '@rematch', next: s('@noSpaceExpression__id__') }]
|
|
1077
|
+
],
|
|
1078
|
+
|
|
1079
|
+
// <NO_PARSE> TOKEN :
|
|
1080
|
+
[s('no_parse_token__id__')]: [
|
|
1081
|
+
// <MAYBE_END :
|
|
1082
|
+
// ("<" | "[")
|
|
1083
|
+
// "/"
|
|
1084
|
+
// ("#")?
|
|
1085
|
+
// (["a"-"z", "A"-"Z"])+
|
|
1086
|
+
// ( " " | "\t" | "\n" | "\r" )*
|
|
1087
|
+
// (">" | "]")
|
|
1088
|
+
// >
|
|
1089
|
+
[
|
|
1090
|
+
r(/(@open__id__)(\/#?)([a-zA-Z]+)((?:@blank)*)(@close__id__)/),
|
|
1091
|
+
{
|
|
1092
|
+
cases: {
|
|
1093
|
+
'$S2==$3': [
|
|
1094
|
+
{ token: '@brackets.directive' },
|
|
1095
|
+
{ token: 'delimiter.directive' },
|
|
1096
|
+
{ token: 'tag' },
|
|
1097
|
+
{ token: '' },
|
|
1098
|
+
{ token: '@brackets.directive', next: '@popall' }
|
|
1099
|
+
],
|
|
1100
|
+
'$S2==comment': [
|
|
1101
|
+
{ token: 'comment' },
|
|
1102
|
+
{ token: 'comment' },
|
|
1103
|
+
{ token: 'comment' },
|
|
1104
|
+
{ token: 'comment' },
|
|
1105
|
+
{ token: 'comment' }
|
|
1106
|
+
],
|
|
1107
|
+
'@default': [
|
|
1108
|
+
{ token: 'source' },
|
|
1109
|
+
{ token: 'source' },
|
|
1110
|
+
{ token: 'source' },
|
|
1111
|
+
{ token: 'source' },
|
|
1112
|
+
{ token: 'source' }
|
|
1113
|
+
]
|
|
1114
|
+
}
|
|
1115
|
+
}
|
|
1116
|
+
],
|
|
1117
|
+
|
|
1118
|
+
// <KEEP_GOING : (~["<", "[", "-"])+>
|
|
1119
|
+
// <LONE_LESS_THAN_OR_DASH : ["<", "[", "-"]>
|
|
1120
|
+
[
|
|
1121
|
+
/[^<\[\-]+|[<\[\-]/,
|
|
1122
|
+
{
|
|
1123
|
+
cases: {
|
|
1124
|
+
'$S2==comment': { token: 'comment' },
|
|
1125
|
+
'@default': { token: 'source' }
|
|
1126
|
+
}
|
|
1127
|
+
}
|
|
1128
|
+
]
|
|
1129
|
+
],
|
|
1130
|
+
|
|
1131
|
+
// <EXPRESSION_COMMENT> SKIP:
|
|
1132
|
+
[s('expression_comment_token__id__')]: [
|
|
1133
|
+
// < "-->" | "--]">
|
|
1134
|
+
[
|
|
1135
|
+
/--[>\]]/,
|
|
1136
|
+
{
|
|
1137
|
+
token: 'comment',
|
|
1138
|
+
next: '@pop'
|
|
1139
|
+
}
|
|
1140
|
+
],
|
|
1141
|
+
|
|
1142
|
+
// < (~["-", ">", "]"])+ >
|
|
1143
|
+
// < ">">
|
|
1144
|
+
// < "]">
|
|
1145
|
+
// < "-">
|
|
1146
|
+
[/[^\->\]]+|[>\]\-]/, { token: 'comment' }]
|
|
1147
|
+
],
|
|
1148
|
+
|
|
1149
|
+
[s('terse_comment_token__id__')]: [
|
|
1150
|
+
// <TERSE_COMMENT_END : "-->" | "--]">
|
|
1151
|
+
[r(/--(?:@close__id__)/), { token: 'comment', next: '@popall' }],
|
|
1152
|
+
|
|
1153
|
+
// <KEEP_GOING : (~["<", "[", "-"])+>
|
|
1154
|
+
// <LONE_LESS_THAN_OR_DASH : ["<", "[", "-"]>
|
|
1155
|
+
[/[^<\[\-]+|[<\[\-]/, { token: 'comment' }]
|
|
1156
|
+
]
|
|
1157
|
+
}
|
|
1158
|
+
};
|
|
1159
|
+
}
|
|
1160
|
+
|
|
1161
|
+
function createMonarchLanguageAuto(is: InterpolationSyntax): languages.IMonarchLanguage {
|
|
1162
|
+
const angle = createMonarchLanguage(TagSyntaxAngle, is);
|
|
1163
|
+
const bracket = createMonarchLanguage(TagSyntaxBracket, is);
|
|
1164
|
+
const auto = createMonarchLanguage(TagSyntaxAuto, is);
|
|
1165
|
+
|
|
1166
|
+
return {
|
|
1167
|
+
// Angle and bracket syntax mode
|
|
1168
|
+
// We switch to one of these once we have determined the mode
|
|
1169
|
+
...angle,
|
|
1170
|
+
...bracket,
|
|
1171
|
+
...auto,
|
|
1172
|
+
|
|
1173
|
+
// Settings
|
|
1174
|
+
|
|
1175
|
+
unicode: true,
|
|
1176
|
+
|
|
1177
|
+
includeLF: false,
|
|
1178
|
+
|
|
1179
|
+
start: `default_auto_${is.id}`,
|
|
1180
|
+
|
|
1181
|
+
ignoreCase: false,
|
|
1182
|
+
|
|
1183
|
+
defaultToken: 'invalid',
|
|
1184
|
+
|
|
1185
|
+
tokenPostfix: `.freemarker2`,
|
|
1186
|
+
|
|
1187
|
+
brackets: [
|
|
1188
|
+
{ open: '{', close: '}', token: 'delimiter.curly' },
|
|
1189
|
+
{ open: '[', close: ']', token: 'delimiter.square' },
|
|
1190
|
+
{ open: '(', close: ')', token: 'delimiter.parenthesis' },
|
|
1191
|
+
{ open: '<', close: '>', token: 'delimiter.angle' }
|
|
1192
|
+
],
|
|
1193
|
+
|
|
1194
|
+
tokenizer: {
|
|
1195
|
+
...angle.tokenizer,
|
|
1196
|
+
...bracket.tokenizer,
|
|
1197
|
+
...auto.tokenizer
|
|
1198
|
+
}
|
|
1199
|
+
};
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
export const TagAngleInterpolationDollar = {
|
|
1203
|
+
conf: createLangConfiguration(TagSyntaxAngle),
|
|
1204
|
+
language: createMonarchLanguage(TagSyntaxAngle, InterpolationSyntaxDollar)
|
|
1205
|
+
};
|
|
1206
|
+
|
|
1207
|
+
export const TagBracketInterpolationDollar = {
|
|
1208
|
+
conf: createLangConfiguration(TagSyntaxBracket),
|
|
1209
|
+
language: createMonarchLanguage(TagSyntaxBracket, InterpolationSyntaxDollar)
|
|
1210
|
+
};
|
|
1211
|
+
|
|
1212
|
+
export const TagAngleInterpolationBracket = {
|
|
1213
|
+
conf: createLangConfiguration(TagSyntaxAngle),
|
|
1214
|
+
language: createMonarchLanguage(TagSyntaxAngle, InterpolationSyntaxBracket)
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
export const TagBracketInterpolationBracket = {
|
|
1218
|
+
conf: createLangConfiguration(TagSyntaxBracket),
|
|
1219
|
+
language: createMonarchLanguage(TagSyntaxBracket, InterpolationSyntaxBracket)
|
|
1220
|
+
};
|
|
1221
|
+
|
|
1222
|
+
export const TagAutoInterpolationDollar = {
|
|
1223
|
+
conf: createLangConfigurationAuto(),
|
|
1224
|
+
language: createMonarchLanguageAuto(InterpolationSyntaxDollar)
|
|
1225
|
+
};
|
|
1226
|
+
|
|
1227
|
+
export const TagAutoInterpolationBracket = {
|
|
1228
|
+
conf: createLangConfigurationAuto(),
|
|
1229
|
+
language: createMonarchLanguageAuto(InterpolationSyntaxBracket)
|
|
1230
|
+
};
|