@openui5/sap.ui.codeeditor 1.94.0 → 1.97.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/.reuse/dep5 +12 -12
- package/THIRDPARTY.txt +21 -17
- package/package.json +2 -2
- package/src/sap/ui/codeeditor/.library +6 -6
- package/src/sap/ui/codeeditor/CodeEditor.js +41 -15
- package/src/sap/ui/codeeditor/js/ace/ace.js +1705 -1669
- package/src/sap/ui/codeeditor/js/ace/css/ace.css +1025 -0
- package/src/sap/ui/codeeditor/js/ace/css/ambiance-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/ambiance-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/chrome-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/clouds-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/clouds_midnight-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/cobalt-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/crimson_editor-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/dawn-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/dracula-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/dreamweaver-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/eclipse-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/github-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gob-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/gruvbox-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/idle_fingers-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/iplastic-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/iplastic-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/kr_theme-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-10.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-11.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-12.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-13.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-14.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-15.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-16.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-2.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-3.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-4.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-5.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-6.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-7.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-8.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/main-9.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/merbivore-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/merbivore_soft-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/mono_industrial-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/monokai-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/one_dark-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/pastel_on_dark-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/solarized_dark-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/solarized_light-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/sqlserver-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/terminal-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/textmate-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/ambiance.css +168 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/chaos.css +146 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/chrome.css +119 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/clouds.css +87 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/clouds_midnight.css +88 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/cobalt.css +104 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/crimson_editor.css +110 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/dawn.css +100 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/dracula.css +119 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/dreamweaver.css +134 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/eclipse.css +88 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/github.css +95 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/gob.css +103 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/gruvbox.css +73 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/idle_fingers.css +88 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/iplastic.css +113 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/katzenmilch.css +113 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/kr_theme.css +96 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/kuroir.css +52 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore.css +87 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/merbivore_soft.css +88 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/mono_industrial.css +99 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/monokai.css +97 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/nord_dark.css +85 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/one_dark.css +123 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/pastel_on_dark.css +100 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_dark.css +80 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/solarized_light.css +83 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/sqlserver.css +129 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/terminal.css +105 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/textmate.css +119 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow.css +100 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night.css +100 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_blue.css +98 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_bright.css +113 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/tomorrow_night_eighties.css +100 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/twilight.css +100 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/vibrant_ink.css +86 -0
- package/src/sap/ui/codeeditor/js/ace/css/theme/xcode.css +80 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_blue-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_bright-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/tomorrow_night_eighties-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/twilight-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/vibrant_ink-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/css/xcode-1.png +0 -0
- package/src/sap/ui/codeeditor/js/ace/ext-beautify.js +17 -10
- package/src/sap/ui/codeeditor/js/ace/ext-code_lens.js +238 -0
- package/src/sap/ui/codeeditor/js/ace/ext-elastic_tabstops_lite.js +1 -1
- package/src/sap/ui/codeeditor/js/ace/ext-emmet.js +343 -238
- package/src/sap/ui/codeeditor/js/ace/ext-hardwrap.js +85 -0
- package/src/sap/ui/codeeditor/js/ace/ext-keybinding_menu.js +26 -11
- package/src/sap/ui/codeeditor/js/ace/ext-language_tools.js +435 -272
- package/src/sap/ui/codeeditor/js/ace/ext-linking.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/ext-modelist.js +22 -11
- package/src/sap/ui/codeeditor/js/ace/ext-options.js +85 -35
- package/src/sap/ui/codeeditor/js/ace/ext-prompt.js +510 -299
- package/src/sap/ui/codeeditor/js/ace/ext-rtl.js +1 -3
- package/src/sap/ui/codeeditor/js/ace/ext-searchbox.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/ext-settings_menu.js +89 -39
- package/src/sap/ui/codeeditor/js/ace/ext-spellcheck.js +1 -2
- package/src/sap/ui/codeeditor/js/ace/ext-split.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/ext-static_highlight.js +3 -229
- package/src/sap/ui/codeeditor/js/ace/ext-statusbar.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/ext-textarea.js +3 -563
- package/src/sap/ui/codeeditor/js/ace/ext-themelist.js +4 -2
- package/src/sap/ui/codeeditor/js/ace/ext-whitespace.js +1 -1
- package/src/sap/ui/codeeditor/js/ace/keybinding-emacs.js +29 -30
- package/src/sap/ui/codeeditor/js/ace/keybinding-sublime.js +2 -5
- package/src/sap/ui/codeeditor/js/ace/keybinding-vim.js +718 -184
- package/src/sap/ui/codeeditor/js/ace/keybinding-vscode.js +262 -0
- package/src/sap/ui/codeeditor/js/ace/mode-abap.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-abc.js +6 -3
- package/src/sap/ui/codeeditor/js/ace/mode-actionscript.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-ada.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-alda.js +311 -0
- package/src/sap/ui/codeeditor/js/ace/mode-apache_conf.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-apex.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-applescript.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-aql.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-asciidoc.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-asl.js +21 -20
- package/src/sap/ui/codeeditor/js/ace/mode-assembly_x86.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-autohotkey.js +6 -4
- package/src/sap/ui/codeeditor/js/ace/mode-batchfile.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-c9search.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-c_cpp.js +7 -6
- package/src/sap/ui/codeeditor/js/ace/mode-cirru.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-clojure.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-cobol.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-coffee.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/mode-coldfusion.js +22 -19
- package/src/sap/ui/codeeditor/js/ace/mode-crystal.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-csharp.js +6 -6
- package/src/sap/ui/codeeditor/js/ace/mode-csound_document.js +178 -61
- package/src/sap/ui/codeeditor/js/ace/mode-csound_orchestra.js +162 -51
- package/src/sap/ui/codeeditor/js/ace/mode-csound_score.js +34 -25
- package/src/sap/ui/codeeditor/js/ace/mode-csp.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-css.js +7 -6
- package/src/sap/ui/codeeditor/js/ace/mode-curly.js +22 -19
- package/src/sap/ui/codeeditor/js/ace/mode-d.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-dart.js +10 -8
- package/src/sap/ui/codeeditor/js/ace/mode-diff.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-django.js +22 -18
- package/src/sap/ui/codeeditor/js/ace/mode-dockerfile.js +6 -5
- package/src/sap/ui/codeeditor/js/ace/mode-dot.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-drools.js +7 -6
- package/src/sap/ui/codeeditor/js/ace/mode-edifact.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-eiffel.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-ejs.js +692 -184
- package/src/sap/ui/codeeditor/js/ace/mode-elixir.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-elm.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-erlang.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-forth.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-fortran.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-fsharp.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-fsl.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-ftl.js +7 -7
- package/src/sap/ui/codeeditor/js/ace/mode-gcode.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-gherkin.js +2 -4
- package/src/sap/ui/codeeditor/js/ace/mode-gitignore.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-glsl.js +9 -8
- package/src/sap/ui/codeeditor/js/ace/mode-gobstones.js +259 -99
- package/src/sap/ui/codeeditor/js/ace/mode-golang.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-graphqlschema.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-groovy.js +8 -7
- package/src/sap/ui/codeeditor/js/ace/mode-haml.js +428 -113
- package/src/sap/ui/codeeditor/js/ace/mode-handlebars.js +23 -20
- package/src/sap/ui/codeeditor/js/ace/mode-haskell.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-haskell_cabal.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-haxe.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-hjson.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-html.js +20 -17
- package/src/sap/ui/codeeditor/js/ace/mode-html_elixir.js +25 -22
- package/src/sap/ui/codeeditor/js/ace/mode-html_ruby.js +693 -185
- package/src/sap/ui/codeeditor/js/ace/mode-ini.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-io.js +5 -10
- package/src/sap/ui/codeeditor/js/ace/mode-jack.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-jade.js +13 -13
- package/src/sap/ui/codeeditor/js/ace/mode-java.js +11 -9
- package/src/sap/ui/codeeditor/js/ace/mode-javascript.js +6 -5
- package/src/sap/ui/codeeditor/js/ace/mode-json.js +7 -4
- package/src/sap/ui/codeeditor/js/ace/mode-json5.js +360 -0
- package/src/sap/ui/codeeditor/js/ace/mode-jsoniq.js +6 -5
- package/src/sap/ui/codeeditor/js/ace/mode-jsp.js +12 -11
- package/src/sap/ui/codeeditor/js/ace/mode-jssm.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-jsx.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-julia.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-kotlin.js +5 -3
- package/src/sap/ui/codeeditor/js/ace/mode-latex.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-latte.js +2708 -0
- package/src/sap/ui/codeeditor/js/ace/mode-less.js +7 -7
- package/src/sap/ui/codeeditor/js/ace/mode-liquid.js +24 -20
- package/src/sap/ui/codeeditor/js/ace/mode-lisp.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-livescript.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-logiql.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-logtalk.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-lsl.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/mode-lua.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-luapage.js +26 -22
- package/src/sap/ui/codeeditor/js/ace/mode-lucene.js +78 -10
- package/src/sap/ui/codeeditor/js/ace/mode-makefile.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/mode-markdown.js +30 -24
- package/src/sap/ui/codeeditor/js/ace/mode-mask.js +12 -12
- package/src/sap/ui/codeeditor/js/ace/mode-matlab.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-maze.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-mediawiki.js +592 -0
- package/src/sap/ui/codeeditor/js/ace/mode-mel.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/{mode-mipsassembler.js → mode-mips.js} +99 -31
- package/src/sap/ui/codeeditor/js/ace/mode-mixal.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-mushcode.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-mysql.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-nginx.js +13 -12
- package/src/sap/ui/codeeditor/js/ace/mode-nim.js +10 -9
- package/src/sap/ui/codeeditor/js/ace/mode-nix.js +9 -8
- package/src/sap/ui/codeeditor/js/ace/mode-nsis.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-nunjucks.js +2698 -0
- package/src/sap/ui/codeeditor/js/ace/mode-objectivec.js +6 -6
- package/src/sap/ui/codeeditor/js/ace/mode-ocaml.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-pascal.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-perl.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/mode-pgsql.js +9 -9
- package/src/sap/ui/codeeditor/js/ace/mode-php.js +513 -302
- package/src/sap/ui/codeeditor/js/ace/mode-php_laravel_blade.js +515 -304
- package/src/sap/ui/codeeditor/js/ace/mode-pig.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-plain_text.js +1 -1
- package/src/sap/ui/codeeditor/js/ace/mode-powershell.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-praat.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-prisma.js +489 -0
- package/src/sap/ui/codeeditor/js/ace/mode-prolog.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-properties.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-protobuf.js +9 -8
- package/src/sap/ui/codeeditor/js/ace/mode-puppet.js +12 -13
- package/src/sap/ui/codeeditor/js/ace/mode-python.js +6 -5
- package/src/sap/ui/codeeditor/js/ace/mode-qml.js +381 -0
- package/src/sap/ui/codeeditor/js/ace/mode-r.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/{mode-perl6.js → mode-raku.js} +13 -13
- package/src/sap/ui/codeeditor/js/ace/mode-razor.js +25 -21
- package/src/sap/ui/codeeditor/js/ace/mode-rdoc.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-red.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-redshift.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-rhtml.js +24 -21
- package/src/sap/ui/codeeditor/js/ace/mode-rst.js +3 -2
- package/src/sap/ui/codeeditor/js/ace/mode-ruby.js +672 -167
- package/src/sap/ui/codeeditor/js/ace/mode-rust.js +9 -8
- package/src/sap/ui/codeeditor/js/ace/mode-sass.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-scad.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/mode-scala.js +8 -7
- package/src/sap/ui/codeeditor/js/ace/mode-scheme.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-scrypt.js +364 -0
- package/src/sap/ui/codeeditor/js/ace/mode-scss.js +7 -7
- package/src/sap/ui/codeeditor/js/ace/mode-sh.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-sjs.js +8 -7
- package/src/sap/ui/codeeditor/js/ace/mode-slim.js +745 -146
- package/src/sap/ui/codeeditor/js/ace/mode-smarty.js +22 -19
- package/src/sap/ui/codeeditor/js/ace/mode-smithy.js +507 -0
- package/src/sap/ui/codeeditor/js/ace/mode-snippets.js +3 -2
- package/src/sap/ui/codeeditor/js/ace/mode-soy_template.js +22 -19
- package/src/sap/ui/codeeditor/js/ace/mode-space.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-sparql.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-sql.js +163 -2
- package/src/sap/ui/codeeditor/js/ace/mode-sqlserver.js +7 -6
- package/src/sap/ui/codeeditor/js/ace/mode-stylus.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-svg.js +13 -12
- package/src/sap/ui/codeeditor/js/ace/mode-swift.js +10 -4
- package/src/sap/ui/codeeditor/js/ace/mode-tcl.js +8 -4
- package/src/sap/ui/codeeditor/js/ace/mode-terraform.js +18 -15
- package/src/sap/ui/codeeditor/js/ace/mode-tex.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-textile.js +4 -3
- package/src/sap/ui/codeeditor/js/ace/mode-toml.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-tsx.js +9 -8
- package/src/sap/ui/codeeditor/js/ace/mode-turtle.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/mode-twig.js +22 -19
- package/src/sap/ui/codeeditor/js/ace/mode-typescript.js +8 -7
- package/src/sap/ui/codeeditor/js/ace/mode-vala.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/mode-vbscript.js +445 -16
- package/src/sap/ui/codeeditor/js/ace/mode-velocity.js +24 -20
- package/src/sap/ui/codeeditor/js/ace/mode-verilog.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/mode-vhdl.js +7 -8
- package/src/sap/ui/codeeditor/js/ace/mode-visualforce.js +22 -19
- package/src/sap/ui/codeeditor/js/ace/mode-wollok.js +9 -7
- package/src/sap/ui/codeeditor/js/ace/mode-xml.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-xquery.js +6 -5
- package/src/sap/ui/codeeditor/js/ace/mode-yaml.js +4 -4
- package/src/sap/ui/codeeditor/js/ace/mode-zeek.js +539 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/abap.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/abc.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/actionscript.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/ada.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/alda.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/apache_conf.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/apex.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/applescript.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/aql.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/asciidoc.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/asl.js +1 -6
- package/src/sap/ui/codeeditor/js/ace/snippets/assembly_x86.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/autohotkey.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/batchfile.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/c9search.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/c_cpp.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/cirru.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/clojure.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/cobol.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/coffee.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/coldfusion.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/crystal.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/csharp.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/csound_document.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/csound_orchestra.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/csound_score.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/csp.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/css.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/curly.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/d.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/dart.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/diff.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/django.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/dockerfile.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/dot.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/drools.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/edifact.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/eiffel.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/ejs.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/elixir.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/elm.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/erlang.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/forth.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/fortran.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/fsharp.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/fsl.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/snippets/ftl.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/gcode.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/gherkin.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/gitignore.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/glsl.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/gobstones.js +1695 -26
- package/src/sap/ui/codeeditor/js/ace/snippets/golang.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/graphqlschema.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/groovy.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/haml.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/handlebars.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/haskell.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/haskell_cabal.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/haxe.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/hjson.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/html.js +4 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/html_elixir.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/html_ruby.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/ini.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/io.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/jack.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/jade.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/java.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/javascript.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/json.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/json5.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/jsoniq.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/jsp.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/jssm.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/jsx.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/julia.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/kotlin.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/latex.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/latte.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/less.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/liquid.js +884 -4
- package/src/sap/ui/codeeditor/js/ace/snippets/lisp.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/livescript.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/logiql.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/logtalk.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/lsl.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/lua.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/luapage.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/lucene.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/makefile.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/markdown.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/mask.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/matlab.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/maze.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/mediawiki.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/mel.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/mips.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/mixal.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/mushcode.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/mysql.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/nginx.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/nim.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/nix.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/nsis.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/nunjucks.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/objectivec.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/ocaml.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/pascal.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/perl.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/pgsql.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/php.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/php_laravel_blade.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/pig.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/plain_text.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/powershell.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/praat.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/prisma.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/prolog.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/properties.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/protobuf.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/puppet.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/python.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/qml.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/r.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/raku.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/razor.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/rdoc.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/red.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/redshift.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/rhtml.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/rst.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/ruby.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/rust.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/sass.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/scad.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/scala.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/scheme.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/scrypt.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/scss.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/sh.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/sjs.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/slim.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/smarty.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/smithy.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/snippets/snippets.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/soy_template.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/space.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/sparql.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/sql.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/sqlserver.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/stylus.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/svg.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/swift.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/tcl.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/terraform.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/tex.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/text.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/textile.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/toml.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/tsx.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/turtle.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/twig.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/typescript.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/vala.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/vbscript.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/velocity.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/verilog.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/vhdl.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/visualforce.js +2 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/wollok.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/xml.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/xquery.js +2 -3
- package/src/sap/ui/codeeditor/js/ace/snippets/yaml.js +1 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/zeek.js +9 -0
- package/src/sap/ui/codeeditor/js/ace/theme-ambiance.js +5 -4
- package/src/sap/ui/codeeditor/js/ace/theme-chaos.js +3 -3
- package/src/sap/ui/codeeditor/js/ace/theme-chrome.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-clouds.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-clouds_midnight.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-cobalt.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-crimson_editor.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-dawn.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-dracula.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-dreamweaver.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-eclipse.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-github.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-gob.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-gruvbox.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-idle_fingers.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-iplastic.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-katzenmilch.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-kr_theme.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-kuroir.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-merbivore.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-merbivore_soft.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-mono_industrial.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-monokai.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-nord_dark.js +102 -0
- package/src/sap/ui/codeeditor/js/ace/theme-one_dark.js +139 -0
- package/src/sap/ui/codeeditor/js/ace/theme-pastel_on_dark.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-solarized_dark.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-solarized_light.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-sqlserver.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-terminal.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-textmate.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_blue.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_bright.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-tomorrow_night_eighties.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-twilight.js +5 -5
- package/src/sap/ui/codeeditor/js/ace/theme-vibrant_ink.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/theme-xcode.js +2 -2
- package/src/sap/ui/codeeditor/js/ace/worker-base.js +1421 -0
- package/src/sap/ui/codeeditor/js/ace/worker-coffee.js +17 -703
- package/src/sap/ui/codeeditor/js/ace/worker-css.js +3629 -3396
- package/src/sap/ui/codeeditor/js/ace/worker-html.js +17 -703
- package/src/sap/ui/codeeditor/js/ace/worker-javascript.js +7831 -5361
- package/src/sap/ui/codeeditor/js/ace/worker-json.js +17 -703
- package/src/sap/ui/codeeditor/js/ace/worker-lua.js +973 -1001
- package/src/sap/ui/codeeditor/js/ace/worker-php.js +859 -1477
- package/src/sap/ui/codeeditor/js/ace/worker-xml.js +26 -707
- package/src/sap/ui/codeeditor/js/ace/worker-xquery.js +17 -703
- package/src/sap/ui/codeeditor/library.js +2 -2
- package/ui5.yaml +4 -1
- package/src/sap/ui/codeeditor/js/ace/LICENSE.txt +0 -24
- package/src/sap/ui/codeeditor/js/ace/ext-chromevox.js +0 -540
- package/src/sap/ui/codeeditor/js/ace/ext-old_ie.js +0 -502
- package/src/sap/ui/codeeditor/js/ace/mode-bro.js +0 -334
- package/src/sap/ui/codeeditor/js/ace/mode-lean.js +0 -281
- package/src/sap/ui/codeeditor/js/ace/mode-live_script.js +0 -481
- package/src/sap/ui/codeeditor/js/ace/mode-mavens_mate_log.js +0 -160
- package/src/sap/ui/codeeditor/js/ace/mode-mips_assembler.js +0 -235
- package/src/sap/ui/codeeditor/js/ace/mode-swig.js +0 -1099
- package/src/sap/ui/codeeditor/js/ace/snippets/bro.js +0 -15
- package/src/sap/ui/codeeditor/js/ace/snippets/lean.js +0 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/live_script.js +0 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/mips_assembler.js +0 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/mipsassembler.js +0 -7
- package/src/sap/ui/codeeditor/js/ace/snippets/perl6.js +0 -14
- package/src/sap/ui/codeeditor/js/ace/snippets/swig.js +0 -7
|
@@ -209,7 +209,6 @@ window.onmessage = function(e) {
|
|
|
209
209
|
}
|
|
210
210
|
else if (msg.init) {
|
|
211
211
|
window.initBaseUrls(msg.tlns);
|
|
212
|
-
require("ace/lib/es5-shim");
|
|
213
212
|
sender = window.sender = window.initSender();
|
|
214
213
|
var clazz = require(msg.module)[msg.classname];
|
|
215
214
|
main = window.main = new clazz(sender);
|
|
@@ -599,8 +598,8 @@ EventEmitter._signal = function(eventName, e) {
|
|
|
599
598
|
|
|
600
599
|
EventEmitter.once = function(eventName, callback) {
|
|
601
600
|
var _self = this;
|
|
602
|
-
this.
|
|
603
|
-
_self.
|
|
601
|
+
this.on(eventName, function newCallback() {
|
|
602
|
+
_self.off(eventName, newCallback);
|
|
604
603
|
callback.apply(null, arguments);
|
|
605
604
|
});
|
|
606
605
|
if (!callback) {
|
|
@@ -672,7 +671,9 @@ EventEmitter.removeEventListener = function(eventName, callback) {
|
|
|
672
671
|
};
|
|
673
672
|
|
|
674
673
|
EventEmitter.removeAllListeners = function(eventName) {
|
|
675
|
-
if (this._eventRegistry
|
|
674
|
+
if (!eventName) this._eventRegistry = this._defaultHandlers = undefined;
|
|
675
|
+
if (this._eventRegistry) this._eventRegistry[eventName] = undefined;
|
|
676
|
+
if (this._defaultHandlers) this._defaultHandlers[eventName] = undefined;
|
|
676
677
|
};
|
|
677
678
|
|
|
678
679
|
exports.EventEmitter = EventEmitter;
|
|
@@ -772,7 +773,7 @@ var Anchor = exports.Anchor = function(doc, row, column) {
|
|
|
772
773
|
});
|
|
773
774
|
};
|
|
774
775
|
this.detach = function() {
|
|
775
|
-
this.document.
|
|
776
|
+
this.document.off("change", this.$onChange);
|
|
776
777
|
};
|
|
777
778
|
this.attach = function(doc) {
|
|
778
779
|
this.document = doc || this.document;
|
|
@@ -1104,6 +1105,16 @@ var Document = function(textOrLines) {
|
|
|
1104
1105
|
}
|
|
1105
1106
|
};
|
|
1106
1107
|
|
|
1108
|
+
this.$safeApplyDelta = function(delta) {
|
|
1109
|
+
var docLength = this.$lines.length;
|
|
1110
|
+
if (
|
|
1111
|
+
delta.action == "remove" && delta.start.row < docLength && delta.end.row < docLength
|
|
1112
|
+
|| delta.action == "insert" && delta.start.row <= docLength
|
|
1113
|
+
) {
|
|
1114
|
+
this.applyDelta(delta);
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
|
|
1107
1118
|
this.$splitAndapplyLargeDelta = function(delta, MAX) {
|
|
1108
1119
|
var lines = delta.lines;
|
|
1109
1120
|
var l = lines.length - MAX + 1;
|
|
@@ -1126,7 +1137,7 @@ var Document = function(textOrLines) {
|
|
|
1126
1137
|
this.applyDelta(delta, true);
|
|
1127
1138
|
};
|
|
1128
1139
|
this.revertDelta = function(delta) {
|
|
1129
|
-
this
|
|
1140
|
+
this.$safeApplyDelta({
|
|
1130
1141
|
start: this.clonePos(delta.start),
|
|
1131
1142
|
end: this.clonePos(delta.end),
|
|
1132
1143
|
action: (delta.action == "insert" ? "remove" : "insert"),
|
|
@@ -1416,15 +1427,104 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1416
1427
|
}(this, 'luaparse', function (exports) {
|
|
1417
1428
|
'use strict';
|
|
1418
1429
|
|
|
1419
|
-
exports.version =
|
|
1430
|
+
exports.version = "0.3.1";
|
|
1420
1431
|
|
|
1421
|
-
var input, options, length;
|
|
1432
|
+
var input, options, length, features, encodingMode;
|
|
1422
1433
|
var defaultOptions = exports.defaultOptions = {
|
|
1423
1434
|
wait: false
|
|
1424
1435
|
, comments: true
|
|
1425
1436
|
, scope: false
|
|
1426
1437
|
, locations: false
|
|
1427
1438
|
, ranges: false
|
|
1439
|
+
, onCreateNode: null
|
|
1440
|
+
, onCreateScope: null
|
|
1441
|
+
, onDestroyScope: null
|
|
1442
|
+
, onLocalDeclaration: null
|
|
1443
|
+
, luaVersion: '5.1'
|
|
1444
|
+
, encodingMode: 'none'
|
|
1445
|
+
};
|
|
1446
|
+
|
|
1447
|
+
function encodeUTF8(codepoint, highMask) {
|
|
1448
|
+
highMask = highMask || 0;
|
|
1449
|
+
|
|
1450
|
+
if (codepoint < 0x80) {
|
|
1451
|
+
return String.fromCharCode(codepoint);
|
|
1452
|
+
} else if (codepoint < 0x800) {
|
|
1453
|
+
return String.fromCharCode(
|
|
1454
|
+
highMask | 0xc0 | (codepoint >> 6) ,
|
|
1455
|
+
highMask | 0x80 | ( codepoint & 0x3f)
|
|
1456
|
+
);
|
|
1457
|
+
} else if (codepoint < 0x10000) {
|
|
1458
|
+
return String.fromCharCode(
|
|
1459
|
+
highMask | 0xe0 | (codepoint >> 12) ,
|
|
1460
|
+
highMask | 0x80 | ((codepoint >> 6) & 0x3f),
|
|
1461
|
+
highMask | 0x80 | ( codepoint & 0x3f)
|
|
1462
|
+
);
|
|
1463
|
+
} else /* istanbul ignore else */ if (codepoint < 0x110000) {
|
|
1464
|
+
return String.fromCharCode(
|
|
1465
|
+
highMask | 0xf0 | (codepoint >> 18) ,
|
|
1466
|
+
highMask | 0x80 | ((codepoint >> 12) & 0x3f),
|
|
1467
|
+
highMask | 0x80 | ((codepoint >> 6) & 0x3f),
|
|
1468
|
+
highMask | 0x80 | ( codepoint & 0x3f)
|
|
1469
|
+
);
|
|
1470
|
+
} else {
|
|
1471
|
+
return null;
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
function toHex(num, digits) {
|
|
1476
|
+
var result = num.toString(16);
|
|
1477
|
+
while (result.length < digits)
|
|
1478
|
+
result = '0' + result;
|
|
1479
|
+
return result;
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
function checkChars(rx) {
|
|
1483
|
+
return function (s) {
|
|
1484
|
+
var m = rx.exec(s);
|
|
1485
|
+
if (!m)
|
|
1486
|
+
return s;
|
|
1487
|
+
raise(null, errors.invalidCodeUnit, toHex(m[0].charCodeAt(0), 4).toUpperCase());
|
|
1488
|
+
};
|
|
1489
|
+
}
|
|
1490
|
+
|
|
1491
|
+
var encodingModes = {
|
|
1492
|
+
'pseudo-latin1': {
|
|
1493
|
+
fixup: checkChars(/[^\x00-\xff]/),
|
|
1494
|
+
encodeByte: function (value) {
|
|
1495
|
+
if (value === null)
|
|
1496
|
+
return '';
|
|
1497
|
+
return String.fromCharCode(value);
|
|
1498
|
+
},
|
|
1499
|
+
encodeUTF8: function (codepoint) {
|
|
1500
|
+
return encodeUTF8(codepoint);
|
|
1501
|
+
},
|
|
1502
|
+
},
|
|
1503
|
+
'x-user-defined': {
|
|
1504
|
+
fixup: checkChars(/[^\x00-\x7f\uf780-\uf7ff]/),
|
|
1505
|
+
encodeByte: function (value) {
|
|
1506
|
+
if (value === null)
|
|
1507
|
+
return '';
|
|
1508
|
+
if (value >= 0x80)
|
|
1509
|
+
return String.fromCharCode(value | 0xf700);
|
|
1510
|
+
return String.fromCharCode(value);
|
|
1511
|
+
},
|
|
1512
|
+
encodeUTF8: function (codepoint) {
|
|
1513
|
+
return encodeUTF8(codepoint, 0xf700);
|
|
1514
|
+
}
|
|
1515
|
+
},
|
|
1516
|
+
'none': {
|
|
1517
|
+
discardStrings: true,
|
|
1518
|
+
fixup: function (s) {
|
|
1519
|
+
return s;
|
|
1520
|
+
},
|
|
1521
|
+
encodeByte: function (value) {
|
|
1522
|
+
return '';
|
|
1523
|
+
},
|
|
1524
|
+
encodeUTF8: function (codepoint) {
|
|
1525
|
+
return '';
|
|
1526
|
+
}
|
|
1527
|
+
}
|
|
1428
1528
|
};
|
|
1429
1529
|
|
|
1430
1530
|
var EOF = 1, StringLiteral = 2, Keyword = 4, Identifier = 8
|
|
@@ -1438,11 +1538,26 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1438
1538
|
};
|
|
1439
1539
|
|
|
1440
1540
|
var errors = exports.errors = {
|
|
1441
|
-
unexpected: '
|
|
1541
|
+
unexpected: 'unexpected %1 \'%2\' near \'%3\''
|
|
1542
|
+
, unexpectedEOF: 'unexpected symbol near \'<eof>\''
|
|
1442
1543
|
, expected: '\'%1\' expected near \'%2\''
|
|
1443
1544
|
, expectedToken: '%1 expected near \'%2\''
|
|
1444
1545
|
, unfinishedString: 'unfinished string near \'%1\''
|
|
1445
1546
|
, malformedNumber: 'malformed number near \'%1\''
|
|
1547
|
+
, decimalEscapeTooLarge: 'decimal escape too large near \'%1\''
|
|
1548
|
+
, invalidEscape: 'invalid escape sequence near \'%1\''
|
|
1549
|
+
, hexadecimalDigitExpected: 'hexadecimal digit expected near \'%1\''
|
|
1550
|
+
, braceExpected: 'missing \'%1\' near \'%2\''
|
|
1551
|
+
, tooLargeCodepoint: 'UTF-8 value too large near \'%1\''
|
|
1552
|
+
, unfinishedLongString: 'unfinished long string (starting at line %1) near \'%2\''
|
|
1553
|
+
, unfinishedLongComment: 'unfinished long comment (starting at line %1) near \'%2\''
|
|
1554
|
+
, ambiguousSyntax: 'ambiguous syntax (function call x new statement) near \'%1\''
|
|
1555
|
+
, noLoopToBreak: 'no loop to break near \'%1\''
|
|
1556
|
+
, labelAlreadyDefined: 'label \'%1\' already defined on line %2'
|
|
1557
|
+
, labelNotVisible: 'no visible label \'%1\' for <goto>'
|
|
1558
|
+
, gotoJumpInLocalScope: '<goto %1> jumps into the scope of local \'%2\''
|
|
1559
|
+
, cannotUseVararg: 'cannot use \'...\' outside a vararg function near \'%1\''
|
|
1560
|
+
, invalidCodeUnit: 'code unit U+%1 is not allowed in the current encoding mode'
|
|
1446
1561
|
};
|
|
1447
1562
|
|
|
1448
1563
|
var ast = exports.ast = {
|
|
@@ -1705,23 +1820,29 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1705
1820
|
if (trackLocations) {
|
|
1706
1821
|
var location = locations.pop();
|
|
1707
1822
|
location.complete();
|
|
1708
|
-
|
|
1709
|
-
if (options.ranges) node.range = location.range;
|
|
1823
|
+
location.bless(node);
|
|
1710
1824
|
}
|
|
1825
|
+
if (options.onCreateNode) options.onCreateNode(node);
|
|
1711
1826
|
return node;
|
|
1712
1827
|
}
|
|
1713
1828
|
|
|
1714
1829
|
var slice = Array.prototype.slice
|
|
1715
1830
|
, toString = Object.prototype.toString
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
return
|
|
1831
|
+
;
|
|
1832
|
+
|
|
1833
|
+
var indexOf = /* istanbul ignore next */ function (array, element) {
|
|
1834
|
+
for (var i = 0, length = array.length; i < length; ++i) {
|
|
1835
|
+
if (array[i] === element) return i;
|
|
1836
|
+
}
|
|
1837
|
+
return -1;
|
|
1838
|
+
};
|
|
1839
|
+
if (Array.prototype.indexOf)
|
|
1840
|
+
indexOf = function (array, element) {
|
|
1841
|
+
return array.indexOf(element);
|
|
1721
1842
|
};
|
|
1722
1843
|
|
|
1723
1844
|
function indexOfObject(array, property, element) {
|
|
1724
|
-
for (var i = 0, length = array.length; i < length; i
|
|
1845
|
+
for (var i = 0, length = array.length; i < length; ++i) {
|
|
1725
1846
|
if (array[i][property] === element) return i;
|
|
1726
1847
|
}
|
|
1727
1848
|
return -1;
|
|
@@ -1730,51 +1851,73 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1730
1851
|
function sprintf(format) {
|
|
1731
1852
|
var args = slice.call(arguments, 1);
|
|
1732
1853
|
format = format.replace(/%(\d)/g, function (match, index) {
|
|
1733
|
-
return '' + args[index - 1] || '';
|
|
1854
|
+
return '' + args[index - 1] || /* istanbul ignore next */ '';
|
|
1734
1855
|
});
|
|
1735
1856
|
return format;
|
|
1736
1857
|
}
|
|
1737
1858
|
|
|
1738
|
-
function
|
|
1739
|
-
var args = slice.call(arguments)
|
|
1740
|
-
, dest = {}
|
|
1859
|
+
var assign = /* istanbul ignore next */ function (dest) {
|
|
1860
|
+
var args = slice.call(arguments, 1)
|
|
1741
1861
|
, src, prop;
|
|
1742
1862
|
|
|
1743
|
-
for (var i = 0, length = args.length; i < length; i
|
|
1863
|
+
for (var i = 0, length = args.length; i < length; ++i) {
|
|
1744
1864
|
src = args[i];
|
|
1745
|
-
for (prop in src)
|
|
1746
|
-
|
|
1747
|
-
|
|
1865
|
+
for (prop in src)
|
|
1866
|
+
if (Object.prototype.hasOwnProperty.call(src, prop)) {
|
|
1867
|
+
dest[prop] = src[prop];
|
|
1868
|
+
}
|
|
1748
1869
|
}
|
|
1870
|
+
|
|
1749
1871
|
return dest;
|
|
1872
|
+
};
|
|
1873
|
+
if (Object.assign)
|
|
1874
|
+
assign = Object.assign;
|
|
1875
|
+
|
|
1876
|
+
exports.SyntaxError = SyntaxError;
|
|
1877
|
+
|
|
1878
|
+
function fixupError(e) {
|
|
1879
|
+
if (!Object.create)
|
|
1880
|
+
return e;
|
|
1881
|
+
return Object.create(e, {
|
|
1882
|
+
'line': { 'writable': true, value: e.line },
|
|
1883
|
+
'index': { 'writable': true, value: e.index },
|
|
1884
|
+
'column': { 'writable': true, value: e.column }
|
|
1885
|
+
});
|
|
1750
1886
|
}
|
|
1751
1887
|
|
|
1752
1888
|
function raise(token) {
|
|
1753
1889
|
var message = sprintf.apply(null, slice.call(arguments, 1))
|
|
1754
1890
|
, error, col;
|
|
1755
1891
|
|
|
1756
|
-
if (
|
|
1757
|
-
col = token.range[0] - token.lineStart;
|
|
1758
|
-
error = new SyntaxError(sprintf('[%1:%2] %3', token.line, col, message));
|
|
1759
|
-
error.line = token.line;
|
|
1760
|
-
error.index = token.range[0];
|
|
1761
|
-
error.column = col;
|
|
1762
|
-
} else {
|
|
1892
|
+
if (token === null || typeof token.line === 'undefined') {
|
|
1763
1893
|
col = index - lineStart + 1;
|
|
1764
|
-
error = new SyntaxError(sprintf('[%1:%2] %3', line, col, message));
|
|
1894
|
+
error = fixupError(new SyntaxError(sprintf('[%1:%2] %3', line, col, message)));
|
|
1765
1895
|
error.index = index;
|
|
1766
1896
|
error.line = line;
|
|
1767
1897
|
error.column = col;
|
|
1898
|
+
} else {
|
|
1899
|
+
col = token.range[0] - token.lineStart;
|
|
1900
|
+
error = fixupError(new SyntaxError(sprintf('[%1:%2] %3', token.line, col, message)));
|
|
1901
|
+
error.line = token.line;
|
|
1902
|
+
error.index = token.range[0];
|
|
1903
|
+
error.column = col;
|
|
1768
1904
|
}
|
|
1769
1905
|
throw error;
|
|
1770
1906
|
}
|
|
1771
1907
|
|
|
1908
|
+
function tokenValue(token) {
|
|
1909
|
+
var raw = input.slice(token.range[0], token.range[1]);
|
|
1910
|
+
if (raw)
|
|
1911
|
+
return raw;
|
|
1912
|
+
return token.value;
|
|
1913
|
+
}
|
|
1914
|
+
|
|
1772
1915
|
function raiseUnexpectedToken(type, token) {
|
|
1773
|
-
raise(token, errors.expectedToken, type, token
|
|
1916
|
+
raise(token, errors.expectedToken, type, tokenValue(token));
|
|
1774
1917
|
}
|
|
1775
1918
|
|
|
1776
|
-
function unexpected(found
|
|
1777
|
-
|
|
1919
|
+
function unexpected(found) {
|
|
1920
|
+
var near = tokenValue(lookahead);
|
|
1778
1921
|
if ('undefined' !== typeof found.type) {
|
|
1779
1922
|
var type;
|
|
1780
1923
|
switch (found.type) {
|
|
@@ -1786,8 +1929,10 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1786
1929
|
case BooleanLiteral: type = 'boolean'; break;
|
|
1787
1930
|
case NilLiteral:
|
|
1788
1931
|
return raise(found, errors.unexpected, 'symbol', 'nil', near);
|
|
1932
|
+
case EOF:
|
|
1933
|
+
return raise(found, errors.unexpectedEOF);
|
|
1789
1934
|
}
|
|
1790
|
-
return raise(found, errors.unexpected, type, found
|
|
1935
|
+
return raise(found, errors.unexpected, type, tokenValue(found), near);
|
|
1791
1936
|
}
|
|
1792
1937
|
return raise(found, errors.unexpected, 'symbol', found, near);
|
|
1793
1938
|
}
|
|
@@ -1826,8 +1971,9 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1826
1971
|
switch (charCode) {
|
|
1827
1972
|
case 39: case 34: // '"
|
|
1828
1973
|
return scanStringLiteral();
|
|
1974
|
+
|
|
1829
1975
|
case 48: case 49: case 50: case 51: case 52: case 53:
|
|
1830
|
-
case 54: case 55: case 56: case 57:
|
|
1976
|
+
case 54: case 55: case 56: case 57: // 0-9
|
|
1831
1977
|
return scanNumericLiteral();
|
|
1832
1978
|
|
|
1833
1979
|
case 46: // .
|
|
@@ -1843,41 +1989,70 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1843
1989
|
return scanPunctuator('=');
|
|
1844
1990
|
|
|
1845
1991
|
case 62: // >
|
|
1992
|
+
if (features.bitwiseOperators)
|
|
1993
|
+
if (62 === next) return scanPunctuator('>>');
|
|
1846
1994
|
if (61 === next) return scanPunctuator('>=');
|
|
1847
1995
|
return scanPunctuator('>');
|
|
1848
1996
|
|
|
1849
1997
|
case 60: // <
|
|
1998
|
+
if (features.bitwiseOperators)
|
|
1999
|
+
if (60 === next) return scanPunctuator('<<');
|
|
1850
2000
|
if (61 === next) return scanPunctuator('<=');
|
|
1851
2001
|
return scanPunctuator('<');
|
|
1852
2002
|
|
|
1853
2003
|
case 126: // ~
|
|
1854
2004
|
if (61 === next) return scanPunctuator('~=');
|
|
2005
|
+
if (!features.bitwiseOperators)
|
|
2006
|
+
break;
|
|
1855
2007
|
return scanPunctuator('~');
|
|
1856
2008
|
|
|
1857
2009
|
case 58: // :
|
|
1858
|
-
if (
|
|
2010
|
+
if (features.labels)
|
|
2011
|
+
if (58 === next) return scanPunctuator('::');
|
|
1859
2012
|
return scanPunctuator(':');
|
|
1860
2013
|
|
|
1861
2014
|
case 91: // [
|
|
1862
2015
|
if (91 === next || 61 === next) return scanLongStringLiteral();
|
|
1863
2016
|
return scanPunctuator('[');
|
|
1864
|
-
|
|
1865
|
-
case
|
|
2017
|
+
|
|
2018
|
+
case 47: // /
|
|
2019
|
+
if (features.integerDivision)
|
|
2020
|
+
if (47 === next) return scanPunctuator('//');
|
|
2021
|
+
return scanPunctuator('/');
|
|
2022
|
+
|
|
2023
|
+
case 38: case 124: // & |
|
|
2024
|
+
if (!features.bitwiseOperators)
|
|
2025
|
+
break;
|
|
2026
|
+
case 42: case 94: case 37: case 44: case 123: case 125:
|
|
2027
|
+
case 93: case 40: case 41: case 59: case 35: case 45:
|
|
2028
|
+
case 43: // * ^ % , { } ] ( ) ; # - +
|
|
1866
2029
|
return scanPunctuator(input.charAt(index));
|
|
1867
2030
|
}
|
|
1868
2031
|
|
|
1869
2032
|
return unexpected(input.charAt(index));
|
|
1870
2033
|
}
|
|
1871
2034
|
|
|
2035
|
+
function consumeEOL() {
|
|
2036
|
+
var charCode = input.charCodeAt(index)
|
|
2037
|
+
, peekCharCode = input.charCodeAt(index + 1);
|
|
2038
|
+
|
|
2039
|
+
if (isLineTerminator(charCode)) {
|
|
2040
|
+
if (10 === charCode && 13 === peekCharCode) ++index;
|
|
2041
|
+
if (13 === charCode && 10 === peekCharCode) ++index;
|
|
2042
|
+
++line;
|
|
2043
|
+
lineStart = ++index;
|
|
2044
|
+
|
|
2045
|
+
return true;
|
|
2046
|
+
}
|
|
2047
|
+
return false;
|
|
2048
|
+
}
|
|
2049
|
+
|
|
1872
2050
|
function skipWhiteSpace() {
|
|
1873
2051
|
while (index < length) {
|
|
1874
2052
|
var charCode = input.charCodeAt(index);
|
|
1875
2053
|
if (isWhiteSpace(charCode)) {
|
|
1876
|
-
index
|
|
1877
|
-
} else if (
|
|
1878
|
-
line++;
|
|
1879
|
-
lineStart = ++index;
|
|
1880
|
-
} else {
|
|
2054
|
+
++index;
|
|
2055
|
+
} else if (!consumeEOL()) {
|
|
1881
2056
|
break;
|
|
1882
2057
|
}
|
|
1883
2058
|
}
|
|
@@ -1886,7 +2061,7 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1886
2061
|
function scanIdentifierOrKeyword() {
|
|
1887
2062
|
var value, type;
|
|
1888
2063
|
while (isIdentifierPart(input.charCodeAt(++index)));
|
|
1889
|
-
value = input.slice(tokenStart, index);
|
|
2064
|
+
value = encodingMode.fixup(input.slice(tokenStart, index));
|
|
1890
2065
|
if (isKeyword(value)) {
|
|
1891
2066
|
type = Keyword;
|
|
1892
2067
|
} else if ('true' === value || 'false' === value) {
|
|
@@ -1932,42 +2107,59 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1932
2107
|
|
|
1933
2108
|
function scanStringLiteral() {
|
|
1934
2109
|
var delimiter = input.charCodeAt(index++)
|
|
2110
|
+
, beginLine = line
|
|
2111
|
+
, beginLineStart = lineStart
|
|
1935
2112
|
, stringStart = index
|
|
1936
|
-
, string = ''
|
|
2113
|
+
, string = encodingMode.discardStrings ? null : ''
|
|
1937
2114
|
, charCode;
|
|
1938
2115
|
|
|
1939
|
-
|
|
2116
|
+
for (;;) {
|
|
1940
2117
|
charCode = input.charCodeAt(index++);
|
|
1941
2118
|
if (delimiter === charCode) break;
|
|
1942
|
-
if (
|
|
1943
|
-
string += input.slice(stringStart, index - 1) + readEscapeSequence();
|
|
1944
|
-
stringStart = index;
|
|
1945
|
-
}
|
|
1946
|
-
else if (index >= length || isLineTerminator(charCode)) {
|
|
2119
|
+
if (index > length || isLineTerminator(charCode)) {
|
|
1947
2120
|
string += input.slice(stringStart, index - 1);
|
|
1948
|
-
raise(
|
|
2121
|
+
raise(null, errors.unfinishedString, input.slice(tokenStart, index - 1));
|
|
2122
|
+
}
|
|
2123
|
+
if (92 === charCode) { // backslash
|
|
2124
|
+
if (!encodingMode.discardStrings) {
|
|
2125
|
+
var beforeEscape = input.slice(stringStart, index - 1);
|
|
2126
|
+
string += encodingMode.fixup(beforeEscape);
|
|
2127
|
+
}
|
|
2128
|
+
var escapeValue = readEscapeSequence();
|
|
2129
|
+
if (!encodingMode.discardStrings)
|
|
2130
|
+
string += escapeValue;
|
|
2131
|
+
stringStart = index;
|
|
1949
2132
|
}
|
|
1950
2133
|
}
|
|
1951
|
-
|
|
2134
|
+
if (!encodingMode.discardStrings) {
|
|
2135
|
+
string += encodingMode.encodeByte(null);
|
|
2136
|
+
string += encodingMode.fixup(input.slice(stringStart, index - 1));
|
|
2137
|
+
}
|
|
1952
2138
|
|
|
1953
2139
|
return {
|
|
1954
2140
|
type: StringLiteral
|
|
1955
2141
|
, value: string
|
|
1956
|
-
, line:
|
|
1957
|
-
, lineStart:
|
|
2142
|
+
, line: beginLine
|
|
2143
|
+
, lineStart: beginLineStart
|
|
2144
|
+
, lastLine: line
|
|
2145
|
+
, lastLineStart: lineStart
|
|
1958
2146
|
, range: [tokenStart, index]
|
|
1959
2147
|
};
|
|
1960
2148
|
}
|
|
1961
2149
|
|
|
1962
2150
|
function scanLongStringLiteral() {
|
|
1963
|
-
var
|
|
1964
|
-
|
|
2151
|
+
var beginLine = line
|
|
2152
|
+
, beginLineStart = lineStart
|
|
2153
|
+
, string = readLongString(false);
|
|
2154
|
+
if (false === string) raise(token, errors.expected, '[', tokenValue(token));
|
|
1965
2155
|
|
|
1966
2156
|
return {
|
|
1967
2157
|
type: StringLiteral
|
|
1968
|
-
, value: string
|
|
1969
|
-
, line:
|
|
1970
|
-
, lineStart:
|
|
2158
|
+
, value: encodingMode.discardStrings ? null : encodingMode.fixup(string)
|
|
2159
|
+
, line: beginLine
|
|
2160
|
+
, lineStart: beginLineStart
|
|
2161
|
+
, lastLine: line
|
|
2162
|
+
, lastLineStart: lineStart
|
|
1971
2163
|
, range: [tokenStart, index]
|
|
1972
2164
|
};
|
|
1973
2165
|
}
|
|
@@ -1976,18 +2168,62 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1976
2168
|
var character = input.charAt(index)
|
|
1977
2169
|
, next = input.charAt(index + 1);
|
|
1978
2170
|
|
|
1979
|
-
var
|
|
2171
|
+
var literal = ('0' === character && 'xX'.indexOf(next || null) >= 0) ?
|
|
1980
2172
|
readHexLiteral() : readDecLiteral();
|
|
1981
2173
|
|
|
2174
|
+
var foundImaginaryUnit = readImaginaryUnitSuffix()
|
|
2175
|
+
, foundInt64Suffix = readInt64Suffix();
|
|
2176
|
+
|
|
2177
|
+
if (foundInt64Suffix && (foundImaginaryUnit || literal.hasFractionPart)) {
|
|
2178
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2179
|
+
}
|
|
2180
|
+
|
|
1982
2181
|
return {
|
|
1983
2182
|
type: NumericLiteral
|
|
1984
|
-
, value: value
|
|
2183
|
+
, value: literal.value
|
|
1985
2184
|
, line: line
|
|
1986
2185
|
, lineStart: lineStart
|
|
1987
2186
|
, range: [tokenStart, index]
|
|
1988
2187
|
};
|
|
1989
2188
|
}
|
|
1990
2189
|
|
|
2190
|
+
function readImaginaryUnitSuffix() {
|
|
2191
|
+
if (!features.imaginaryNumbers) return;
|
|
2192
|
+
if ('iI'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2193
|
+
++index;
|
|
2194
|
+
return true;
|
|
2195
|
+
} else {
|
|
2196
|
+
return false;
|
|
2197
|
+
}
|
|
2198
|
+
}
|
|
2199
|
+
|
|
2200
|
+
function readInt64Suffix() {
|
|
2201
|
+
if (!features.integerSuffixes) return;
|
|
2202
|
+
|
|
2203
|
+
if ('uU'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2204
|
+
++index;
|
|
2205
|
+
if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2206
|
+
++index;
|
|
2207
|
+
if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2208
|
+
++index;
|
|
2209
|
+
return 'ULL';
|
|
2210
|
+
} else {
|
|
2211
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2212
|
+
}
|
|
2213
|
+
} else {
|
|
2214
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2215
|
+
}
|
|
2216
|
+
} else if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2217
|
+
++index;
|
|
2218
|
+
if ('lL'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2219
|
+
++index;
|
|
2220
|
+
return 'LL';
|
|
2221
|
+
} else {
|
|
2222
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
}
|
|
2226
|
+
|
|
1991
2227
|
function readHexLiteral() {
|
|
1992
2228
|
var fraction = 0 // defaults to 0 as it gets summed
|
|
1993
2229
|
, binaryExponent = 1 // defaults to 1 as it gets multiplied
|
|
@@ -1996,77 +2232,158 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
1996
2232
|
|
|
1997
2233
|
digitStart = index += 2; // Skip 0x part
|
|
1998
2234
|
if (!isHexDigit(input.charCodeAt(index)))
|
|
1999
|
-
raise(
|
|
2235
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2000
2236
|
|
|
2001
|
-
while (isHexDigit(input.charCodeAt(index))) index
|
|
2237
|
+
while (isHexDigit(input.charCodeAt(index))) ++index;
|
|
2002
2238
|
digit = parseInt(input.slice(digitStart, index), 16);
|
|
2239
|
+
var foundFraction = false;
|
|
2003
2240
|
if ('.' === input.charAt(index)) {
|
|
2241
|
+
foundFraction = true;
|
|
2004
2242
|
fractionStart = ++index;
|
|
2005
2243
|
|
|
2006
|
-
while (isHexDigit(input.charCodeAt(index))) index
|
|
2244
|
+
while (isHexDigit(input.charCodeAt(index))) ++index;
|
|
2007
2245
|
fraction = input.slice(fractionStart, index);
|
|
2008
2246
|
fraction = (fractionStart === index) ? 0
|
|
2009
2247
|
: parseInt(fraction, 16) / Math.pow(16, index - fractionStart);
|
|
2010
2248
|
}
|
|
2249
|
+
var foundBinaryExponent = false;
|
|
2011
2250
|
if ('pP'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2012
|
-
|
|
2251
|
+
foundBinaryExponent = true;
|
|
2252
|
+
++index;
|
|
2013
2253
|
if ('+-'.indexOf(input.charAt(index) || null) >= 0)
|
|
2014
2254
|
binarySign = ('+' === input.charAt(index++)) ? 1 : -1;
|
|
2015
2255
|
|
|
2016
2256
|
exponentStart = index;
|
|
2017
2257
|
if (!isDecDigit(input.charCodeAt(index)))
|
|
2018
|
-
raise(
|
|
2258
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2019
2259
|
|
|
2020
|
-
while (isDecDigit(input.charCodeAt(index))) index
|
|
2260
|
+
while (isDecDigit(input.charCodeAt(index))) ++index;
|
|
2021
2261
|
binaryExponent = input.slice(exponentStart, index);
|
|
2022
2262
|
binaryExponent = Math.pow(2, binaryExponent * binarySign);
|
|
2023
2263
|
}
|
|
2024
2264
|
|
|
2025
|
-
return
|
|
2265
|
+
return {
|
|
2266
|
+
value: (digit + fraction) * binaryExponent,
|
|
2267
|
+
hasFractionPart: foundFraction || foundBinaryExponent
|
|
2268
|
+
};
|
|
2026
2269
|
}
|
|
2027
2270
|
|
|
2028
2271
|
function readDecLiteral() {
|
|
2029
|
-
while (isDecDigit(input.charCodeAt(index))) index
|
|
2272
|
+
while (isDecDigit(input.charCodeAt(index))) ++index;
|
|
2273
|
+
var foundFraction = false;
|
|
2030
2274
|
if ('.' === input.charAt(index)) {
|
|
2031
|
-
|
|
2032
|
-
|
|
2275
|
+
foundFraction = true;
|
|
2276
|
+
++index;
|
|
2277
|
+
while (isDecDigit(input.charCodeAt(index))) ++index;
|
|
2033
2278
|
}
|
|
2279
|
+
var foundExponent = false;
|
|
2034
2280
|
if ('eE'.indexOf(input.charAt(index) || null) >= 0) {
|
|
2035
|
-
|
|
2036
|
-
|
|
2281
|
+
foundExponent = true;
|
|
2282
|
+
++index;
|
|
2283
|
+
if ('+-'.indexOf(input.charAt(index) || null) >= 0) ++index;
|
|
2037
2284
|
if (!isDecDigit(input.charCodeAt(index)))
|
|
2038
|
-
raise(
|
|
2285
|
+
raise(null, errors.malformedNumber, input.slice(tokenStart, index));
|
|
2039
2286
|
|
|
2040
|
-
while (isDecDigit(input.charCodeAt(index))) index
|
|
2287
|
+
while (isDecDigit(input.charCodeAt(index))) ++index;
|
|
2041
2288
|
}
|
|
2042
2289
|
|
|
2043
|
-
return
|
|
2290
|
+
return {
|
|
2291
|
+
value: parseFloat(input.slice(tokenStart, index)),
|
|
2292
|
+
hasFractionPart: foundFraction || foundExponent
|
|
2293
|
+
};
|
|
2044
2294
|
}
|
|
2045
2295
|
|
|
2296
|
+
function readUnicodeEscapeSequence() {
|
|
2297
|
+
var sequenceStart = index++;
|
|
2298
|
+
|
|
2299
|
+
if (input.charAt(index++) !== '{')
|
|
2300
|
+
raise(null, errors.braceExpected, '{', '\\' + input.slice(sequenceStart, index));
|
|
2301
|
+
if (!isHexDigit(input.charCodeAt(index)))
|
|
2302
|
+
raise(null, errors.hexadecimalDigitExpected, '\\' + input.slice(sequenceStart, index));
|
|
2303
|
+
|
|
2304
|
+
while (input.charCodeAt(index) === 0x30) ++index;
|
|
2305
|
+
var escStart = index;
|
|
2306
|
+
|
|
2307
|
+
while (isHexDigit(input.charCodeAt(index))) {
|
|
2308
|
+
++index;
|
|
2309
|
+
if (index - escStart > 6)
|
|
2310
|
+
raise(null, errors.tooLargeCodepoint, '\\' + input.slice(sequenceStart, index));
|
|
2311
|
+
}
|
|
2312
|
+
|
|
2313
|
+
var b = input.charAt(index++);
|
|
2314
|
+
if (b !== '}') {
|
|
2315
|
+
if ((b === '"') || (b === "'"))
|
|
2316
|
+
raise(null, errors.braceExpected, '}', '\\' + input.slice(sequenceStart, index--));
|
|
2317
|
+
else
|
|
2318
|
+
raise(null, errors.hexadecimalDigitExpected, '\\' + input.slice(sequenceStart, index));
|
|
2319
|
+
}
|
|
2320
|
+
|
|
2321
|
+
var codepoint = parseInt(input.slice(escStart, index - 1) || '0', 16);
|
|
2322
|
+
var frag = '\\' + input.slice(sequenceStart, index);
|
|
2323
|
+
|
|
2324
|
+
if (codepoint > 0x10ffff) {
|
|
2325
|
+
raise(null, errors.tooLargeCodepoint, frag);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
return encodingMode.encodeUTF8(codepoint, frag);
|
|
2329
|
+
}
|
|
2046
2330
|
function readEscapeSequence() {
|
|
2047
2331
|
var sequenceStart = index;
|
|
2048
2332
|
switch (input.charAt(index)) {
|
|
2049
|
-
case '
|
|
2050
|
-
case '
|
|
2051
|
-
case '
|
|
2052
|
-
case '
|
|
2053
|
-
case '
|
|
2054
|
-
case '
|
|
2055
|
-
case '
|
|
2056
|
-
case '
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
|
|
2060
|
-
|
|
2333
|
+
case 'a': ++index; return '\x07';
|
|
2334
|
+
case 'n': ++index; return '\n';
|
|
2335
|
+
case 'r': ++index; return '\r';
|
|
2336
|
+
case 't': ++index; return '\t';
|
|
2337
|
+
case 'v': ++index; return '\x0b';
|
|
2338
|
+
case 'b': ++index; return '\b';
|
|
2339
|
+
case 'f': ++index; return '\f';
|
|
2340
|
+
case '\r':
|
|
2341
|
+
case '\n':
|
|
2342
|
+
consumeEOL();
|
|
2343
|
+
return '\n';
|
|
2344
|
+
|
|
2345
|
+
case '0': case '1': case '2': case '3': case '4':
|
|
2346
|
+
case '5': case '6': case '7': case '8': case '9':
|
|
2347
|
+
while (isDecDigit(input.charCodeAt(index)) && index - sequenceStart < 3) ++index;
|
|
2348
|
+
|
|
2349
|
+
var frag = input.slice(sequenceStart, index);
|
|
2350
|
+
var ddd = parseInt(frag, 10);
|
|
2351
|
+
if (ddd > 255) {
|
|
2352
|
+
raise(null, errors.decimalEscapeTooLarge, '\\' + ddd);
|
|
2353
|
+
}
|
|
2354
|
+
return encodingMode.encodeByte(ddd, '\\' + frag);
|
|
2355
|
+
|
|
2356
|
+
case 'z':
|
|
2357
|
+
if (features.skipWhitespaceEscape) {
|
|
2358
|
+
++index;
|
|
2359
|
+
skipWhiteSpace();
|
|
2360
|
+
return '';
|
|
2061
2361
|
}
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2362
|
+
break;
|
|
2363
|
+
|
|
2364
|
+
case 'x':
|
|
2365
|
+
if (features.hexEscapes) {
|
|
2366
|
+
if (isHexDigit(input.charCodeAt(index + 1)) &&
|
|
2367
|
+
isHexDigit(input.charCodeAt(index + 2))) {
|
|
2368
|
+
index += 3;
|
|
2369
|
+
return encodingMode.encodeByte(parseInt(input.slice(sequenceStart + 1, index), 16), '\\' + input.slice(sequenceStart, index));
|
|
2370
|
+
}
|
|
2371
|
+
raise(null, errors.hexadecimalDigitExpected, '\\' + input.slice(sequenceStart, index + 2));
|
|
2067
2372
|
}
|
|
2373
|
+
break;
|
|
2374
|
+
|
|
2375
|
+
case 'u':
|
|
2376
|
+
if (features.unicodeEscapes)
|
|
2377
|
+
return readUnicodeEscapeSequence();
|
|
2378
|
+
break;
|
|
2379
|
+
|
|
2380
|
+
case '\\': case '"': case "'":
|
|
2068
2381
|
return input.charAt(index++);
|
|
2069
2382
|
}
|
|
2383
|
+
|
|
2384
|
+
if (features.strictEscapes)
|
|
2385
|
+
raise(null, errors.invalidEscape, '\\' + input.slice(sequenceStart, index + 1));
|
|
2386
|
+
return input.charAt(index++);
|
|
2070
2387
|
}
|
|
2071
2388
|
|
|
2072
2389
|
function scanComment() {
|
|
@@ -2081,14 +2398,14 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2081
2398
|
, lineComment = line;
|
|
2082
2399
|
|
|
2083
2400
|
if ('[' === character) {
|
|
2084
|
-
content = readLongString();
|
|
2401
|
+
content = readLongString(true);
|
|
2085
2402
|
if (false === content) content = character;
|
|
2086
2403
|
else isLong = true;
|
|
2087
2404
|
}
|
|
2088
2405
|
if (!isLong) {
|
|
2089
2406
|
while (index < length) {
|
|
2090
2407
|
if (isLineTerminator(input.charCodeAt(index))) break;
|
|
2091
|
-
index
|
|
2408
|
+
++index;
|
|
2092
2409
|
}
|
|
2093
2410
|
if (options.comments) content = input.slice(commentStart, index);
|
|
2094
2411
|
}
|
|
@@ -2104,46 +2421,47 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2104
2421
|
if (options.ranges) {
|
|
2105
2422
|
node.range = [tokenStart, index];
|
|
2106
2423
|
}
|
|
2424
|
+
if (options.onCreateNode) options.onCreateNode(node);
|
|
2107
2425
|
comments.push(node);
|
|
2108
2426
|
}
|
|
2109
2427
|
}
|
|
2110
2428
|
|
|
2111
|
-
function readLongString() {
|
|
2429
|
+
function readLongString(isComment) {
|
|
2112
2430
|
var level = 0
|
|
2113
2431
|
, content = ''
|
|
2114
2432
|
, terminator = false
|
|
2115
|
-
, character, stringStart;
|
|
2433
|
+
, character, stringStart, firstLine = line;
|
|
2116
2434
|
|
|
2117
|
-
index
|
|
2118
|
-
while ('=' === input.charAt(index + level)) level
|
|
2435
|
+
++index; // [
|
|
2436
|
+
while ('=' === input.charAt(index + level)) ++level;
|
|
2119
2437
|
if ('[' !== input.charAt(index + level)) return false;
|
|
2120
2438
|
|
|
2121
2439
|
index += level + 1;
|
|
2122
|
-
if (isLineTerminator(input.charCodeAt(index)))
|
|
2123
|
-
line++;
|
|
2124
|
-
lineStart = index++;
|
|
2125
|
-
}
|
|
2440
|
+
if (isLineTerminator(input.charCodeAt(index))) consumeEOL();
|
|
2126
2441
|
|
|
2127
2442
|
stringStart = index;
|
|
2128
2443
|
while (index < length) {
|
|
2444
|
+
while (isLineTerminator(input.charCodeAt(index))) consumeEOL();
|
|
2445
|
+
|
|
2129
2446
|
character = input.charAt(index++);
|
|
2130
|
-
if (isLineTerminator(character.charCodeAt(0))) {
|
|
2131
|
-
line++;
|
|
2132
|
-
lineStart = index;
|
|
2133
|
-
}
|
|
2134
2447
|
if (']' === character) {
|
|
2135
2448
|
terminator = true;
|
|
2136
|
-
for (var i = 0; i < level; i
|
|
2449
|
+
for (var i = 0; i < level; ++i) {
|
|
2137
2450
|
if ('=' !== input.charAt(index + i)) terminator = false;
|
|
2138
2451
|
}
|
|
2139
2452
|
if (']' !== input.charAt(index + level)) terminator = false;
|
|
2140
2453
|
}
|
|
2141
|
-
if (terminator)
|
|
2454
|
+
if (terminator) {
|
|
2455
|
+
content += input.slice(stringStart, index - 1);
|
|
2456
|
+
index += level + 1;
|
|
2457
|
+
return content;
|
|
2458
|
+
}
|
|
2142
2459
|
}
|
|
2143
|
-
content += input.slice(stringStart, index - 1);
|
|
2144
|
-
index += level + 1;
|
|
2145
2460
|
|
|
2146
|
-
|
|
2461
|
+
raise(null, isComment ?
|
|
2462
|
+
errors.unfinishedLongComment :
|
|
2463
|
+
errors.unfinishedLongString,
|
|
2464
|
+
firstLine, '<eof>');
|
|
2147
2465
|
}
|
|
2148
2466
|
|
|
2149
2467
|
function next() {
|
|
@@ -2162,7 +2480,7 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2162
2480
|
|
|
2163
2481
|
function expect(value) {
|
|
2164
2482
|
if (value === token.value) next();
|
|
2165
|
-
else raise(token, errors.expected, value, token
|
|
2483
|
+
else raise(token, errors.expected, value, tokenValue(token));
|
|
2166
2484
|
}
|
|
2167
2485
|
|
|
2168
2486
|
function isWhiteSpace(charCode) {
|
|
@@ -2182,11 +2500,19 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2182
2500
|
}
|
|
2183
2501
|
|
|
2184
2502
|
function isIdentifierStart(charCode) {
|
|
2185
|
-
|
|
2503
|
+
if ((charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode)
|
|
2504
|
+
return true;
|
|
2505
|
+
if (features.extendedIdentifiers && charCode >= 128)
|
|
2506
|
+
return true;
|
|
2507
|
+
return false;
|
|
2186
2508
|
}
|
|
2187
2509
|
|
|
2188
2510
|
function isIdentifierPart(charCode) {
|
|
2189
|
-
|
|
2511
|
+
if ((charCode >= 65 && charCode <= 90) || (charCode >= 97 && charCode <= 122) || 95 === charCode || (charCode >= 48 && charCode <= 57))
|
|
2512
|
+
return true;
|
|
2513
|
+
if (features.extendedIdentifiers && charCode >= 128)
|
|
2514
|
+
return true;
|
|
2515
|
+
return false;
|
|
2190
2516
|
}
|
|
2191
2517
|
|
|
2192
2518
|
function isKeyword(id) {
|
|
@@ -2196,7 +2522,11 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2196
2522
|
case 3:
|
|
2197
2523
|
return 'and' === id || 'end' === id || 'for' === id || 'not' === id;
|
|
2198
2524
|
case 4:
|
|
2199
|
-
|
|
2525
|
+
if ('else' === id || 'then' === id)
|
|
2526
|
+
return true;
|
|
2527
|
+
if (features.labels && !features.contextualGoto)
|
|
2528
|
+
return ('goto' === id);
|
|
2529
|
+
return false;
|
|
2200
2530
|
case 5:
|
|
2201
2531
|
return 'break' === id || 'local' === id || 'until' === id || 'while' === id;
|
|
2202
2532
|
case 6:
|
|
@@ -2212,15 +2542,6 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2212
2542
|
if (Keyword === token.type) return 'not' === token.value;
|
|
2213
2543
|
return false;
|
|
2214
2544
|
}
|
|
2215
|
-
function isCallExpression(expression) {
|
|
2216
|
-
switch (expression.type) {
|
|
2217
|
-
case 'CallExpression':
|
|
2218
|
-
case 'TableCallExpression':
|
|
2219
|
-
case 'StringCallExpression':
|
|
2220
|
-
return true;
|
|
2221
|
-
}
|
|
2222
|
-
return false;
|
|
2223
|
-
}
|
|
2224
2545
|
|
|
2225
2546
|
function isBlockFollow(token) {
|
|
2226
2547
|
if (EOF === token.type) return true;
|
|
@@ -2237,13 +2558,17 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2237
2558
|
, scopeDepth
|
|
2238
2559
|
, globals;
|
|
2239
2560
|
function createScope() {
|
|
2240
|
-
|
|
2561
|
+
var scope = scopes[scopeDepth++].slice();
|
|
2562
|
+
scopes.push(scope);
|
|
2563
|
+
if (options.onCreateScope) options.onCreateScope();
|
|
2241
2564
|
}
|
|
2242
|
-
function
|
|
2243
|
-
scopes.pop();
|
|
2244
|
-
scopeDepth
|
|
2565
|
+
function destroyScope() {
|
|
2566
|
+
var scope = scopes.pop();
|
|
2567
|
+
--scopeDepth;
|
|
2568
|
+
if (options.onDestroyScope) options.onDestroyScope();
|
|
2245
2569
|
}
|
|
2246
2570
|
function scopeIdentifierName(name) {
|
|
2571
|
+
if (options.onLocalDeclaration) options.onLocalDeclaration(name);
|
|
2247
2572
|
if (-1 !== indexOf(scopes[scopeDepth], name)) return;
|
|
2248
2573
|
scopes[scopeDepth].push(name);
|
|
2249
2574
|
}
|
|
@@ -2285,13 +2610,35 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2285
2610
|
}
|
|
2286
2611
|
Marker.prototype.complete = function() {
|
|
2287
2612
|
if (options.locations) {
|
|
2288
|
-
this.loc.end.line = previousToken.line;
|
|
2289
|
-
this.loc.end.column = previousToken.range[1] - previousToken.lineStart;
|
|
2613
|
+
this.loc.end.line = previousToken.lastLine || previousToken.line;
|
|
2614
|
+
this.loc.end.column = previousToken.range[1] - (previousToken.lastLineStart || previousToken.lineStart);
|
|
2290
2615
|
}
|
|
2291
2616
|
if (options.ranges) {
|
|
2292
2617
|
this.range[1] = previousToken.range[1];
|
|
2293
2618
|
}
|
|
2294
2619
|
};
|
|
2620
|
+
|
|
2621
|
+
Marker.prototype.bless = function (node) {
|
|
2622
|
+
if (this.loc) {
|
|
2623
|
+
var loc = this.loc;
|
|
2624
|
+
node.loc = {
|
|
2625
|
+
start: {
|
|
2626
|
+
line: loc.start.line,
|
|
2627
|
+
column: loc.start.column
|
|
2628
|
+
},
|
|
2629
|
+
end: {
|
|
2630
|
+
line: loc.end.line,
|
|
2631
|
+
column: loc.end.column
|
|
2632
|
+
}
|
|
2633
|
+
};
|
|
2634
|
+
}
|
|
2635
|
+
if (this.range) {
|
|
2636
|
+
node.range = [
|
|
2637
|
+
this.range[0],
|
|
2638
|
+
this.range[1]
|
|
2639
|
+
];
|
|
2640
|
+
}
|
|
2641
|
+
};
|
|
2295
2642
|
function markLocation() {
|
|
2296
2643
|
if (trackLocations) locations.push(createLocationMarker());
|
|
2297
2644
|
}
|
|
@@ -2299,71 +2646,234 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2299
2646
|
if (trackLocations) locations.push(marker);
|
|
2300
2647
|
}
|
|
2301
2648
|
|
|
2649
|
+
function FullFlowContext() {
|
|
2650
|
+
this.scopes = [];
|
|
2651
|
+
this.pendingGotos = [];
|
|
2652
|
+
}
|
|
2653
|
+
|
|
2654
|
+
FullFlowContext.prototype.isInLoop = function () {
|
|
2655
|
+
var i = this.scopes.length;
|
|
2656
|
+
while (i --> 0) {
|
|
2657
|
+
if (this.scopes[i].isLoop)
|
|
2658
|
+
return true;
|
|
2659
|
+
}
|
|
2660
|
+
return false;
|
|
2661
|
+
};
|
|
2662
|
+
|
|
2663
|
+
FullFlowContext.prototype.pushScope = function (isLoop) {
|
|
2664
|
+
var scope = {
|
|
2665
|
+
labels: {},
|
|
2666
|
+
locals: [],
|
|
2667
|
+
deferredGotos: [],
|
|
2668
|
+
isLoop: !!isLoop
|
|
2669
|
+
};
|
|
2670
|
+
this.scopes.push(scope);
|
|
2671
|
+
};
|
|
2672
|
+
|
|
2673
|
+
FullFlowContext.prototype.popScope = function () {
|
|
2674
|
+
for (var i = 0; i < this.pendingGotos.length; ++i) {
|
|
2675
|
+
var theGoto = this.pendingGotos[i];
|
|
2676
|
+
if (theGoto.maxDepth >= this.scopes.length)
|
|
2677
|
+
if (--theGoto.maxDepth <= 0)
|
|
2678
|
+
raise(theGoto.token, errors.labelNotVisible, theGoto.target);
|
|
2679
|
+
}
|
|
2680
|
+
|
|
2681
|
+
this.scopes.pop();
|
|
2682
|
+
};
|
|
2683
|
+
|
|
2684
|
+
FullFlowContext.prototype.addGoto = function (target, token) {
|
|
2685
|
+
var localCounts = [];
|
|
2686
|
+
|
|
2687
|
+
for (var i = 0; i < this.scopes.length; ++i) {
|
|
2688
|
+
var scope = this.scopes[i];
|
|
2689
|
+
localCounts.push(scope.locals.length);
|
|
2690
|
+
if (Object.prototype.hasOwnProperty.call(scope.labels, target))
|
|
2691
|
+
return;
|
|
2692
|
+
}
|
|
2693
|
+
|
|
2694
|
+
this.pendingGotos.push({
|
|
2695
|
+
maxDepth: this.scopes.length,
|
|
2696
|
+
target: target,
|
|
2697
|
+
token: token,
|
|
2698
|
+
localCounts: localCounts
|
|
2699
|
+
});
|
|
2700
|
+
};
|
|
2701
|
+
|
|
2702
|
+
FullFlowContext.prototype.addLabel = function (name, token) {
|
|
2703
|
+
var scope = this.currentScope();
|
|
2704
|
+
|
|
2705
|
+
if (Object.prototype.hasOwnProperty.call(scope.labels, name)) {
|
|
2706
|
+
raise(token, errors.labelAlreadyDefined, name, scope.labels[name].line);
|
|
2707
|
+
} else {
|
|
2708
|
+
var newGotos = [];
|
|
2709
|
+
|
|
2710
|
+
for (var i = 0; i < this.pendingGotos.length; ++i) {
|
|
2711
|
+
var theGoto = this.pendingGotos[i];
|
|
2712
|
+
|
|
2713
|
+
if (theGoto.maxDepth >= this.scopes.length && theGoto.target === name) {
|
|
2714
|
+
if (theGoto.localCounts[this.scopes.length - 1] < scope.locals.length) {
|
|
2715
|
+
scope.deferredGotos.push(theGoto);
|
|
2716
|
+
}
|
|
2717
|
+
continue;
|
|
2718
|
+
}
|
|
2719
|
+
|
|
2720
|
+
newGotos.push(theGoto);
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
this.pendingGotos = newGotos;
|
|
2724
|
+
}
|
|
2725
|
+
|
|
2726
|
+
scope.labels[name] = {
|
|
2727
|
+
localCount: scope.locals.length,
|
|
2728
|
+
line: token.line
|
|
2729
|
+
};
|
|
2730
|
+
};
|
|
2731
|
+
|
|
2732
|
+
FullFlowContext.prototype.addLocal = function (name, token) {
|
|
2733
|
+
this.currentScope().locals.push({
|
|
2734
|
+
name: name,
|
|
2735
|
+
token: token
|
|
2736
|
+
});
|
|
2737
|
+
};
|
|
2738
|
+
|
|
2739
|
+
FullFlowContext.prototype.currentScope = function () {
|
|
2740
|
+
return this.scopes[this.scopes.length - 1];
|
|
2741
|
+
};
|
|
2742
|
+
|
|
2743
|
+
FullFlowContext.prototype.raiseDeferredErrors = function () {
|
|
2744
|
+
var scope = this.currentScope();
|
|
2745
|
+
var bads = scope.deferredGotos;
|
|
2746
|
+
for (var i = 0; i < bads.length; ++i) {
|
|
2747
|
+
var theGoto = bads[i];
|
|
2748
|
+
raise(theGoto.token, errors.gotoJumpInLocalScope, theGoto.target, scope.locals[theGoto.localCounts[this.scopes.length - 1]].name);
|
|
2749
|
+
}
|
|
2750
|
+
};
|
|
2751
|
+
|
|
2752
|
+
function LoopFlowContext() {
|
|
2753
|
+
this.level = 0;
|
|
2754
|
+
this.loopLevels = [];
|
|
2755
|
+
}
|
|
2756
|
+
|
|
2757
|
+
LoopFlowContext.prototype.isInLoop = function () {
|
|
2758
|
+
return !!this.loopLevels.length;
|
|
2759
|
+
};
|
|
2760
|
+
|
|
2761
|
+
LoopFlowContext.prototype.pushScope = function (isLoop) {
|
|
2762
|
+
++this.level;
|
|
2763
|
+
if (isLoop)
|
|
2764
|
+
this.loopLevels.push(this.level);
|
|
2765
|
+
};
|
|
2766
|
+
|
|
2767
|
+
LoopFlowContext.prototype.popScope = function () {
|
|
2768
|
+
var levels = this.loopLevels;
|
|
2769
|
+
var levlen = levels.length;
|
|
2770
|
+
if (levlen) {
|
|
2771
|
+
if (levels[levlen - 1] === this.level)
|
|
2772
|
+
levels.pop();
|
|
2773
|
+
}
|
|
2774
|
+
--this.level;
|
|
2775
|
+
};
|
|
2776
|
+
|
|
2777
|
+
LoopFlowContext.prototype.addGoto =
|
|
2778
|
+
LoopFlowContext.prototype.addLabel =
|
|
2779
|
+
function () { throw new Error('This should never happen'); };
|
|
2780
|
+
|
|
2781
|
+
LoopFlowContext.prototype.addLocal =
|
|
2782
|
+
LoopFlowContext.prototype.raiseDeferredErrors =
|
|
2783
|
+
function () {};
|
|
2784
|
+
|
|
2785
|
+
function makeFlowContext() {
|
|
2786
|
+
return features.labels ? new FullFlowContext() : new LoopFlowContext();
|
|
2787
|
+
}
|
|
2788
|
+
|
|
2302
2789
|
function parseChunk() {
|
|
2303
2790
|
next();
|
|
2304
2791
|
markLocation();
|
|
2305
|
-
|
|
2792
|
+
if (options.scope) createScope();
|
|
2793
|
+
var flowContext = makeFlowContext();
|
|
2794
|
+
flowContext.allowVararg = true;
|
|
2795
|
+
flowContext.pushScope();
|
|
2796
|
+
var body = parseBlock(flowContext);
|
|
2797
|
+
flowContext.popScope();
|
|
2798
|
+
if (options.scope) destroyScope();
|
|
2306
2799
|
if (EOF !== token.type) unexpected(token);
|
|
2307
2800
|
if (trackLocations && !body.length) previousToken = token;
|
|
2308
2801
|
return finishNode(ast.chunk(body));
|
|
2309
2802
|
}
|
|
2310
2803
|
|
|
2311
|
-
function parseBlock(
|
|
2804
|
+
function parseBlock(flowContext) {
|
|
2312
2805
|
var block = []
|
|
2313
2806
|
, statement;
|
|
2314
|
-
if (options.scope) createScope();
|
|
2315
2807
|
|
|
2316
2808
|
while (!isBlockFollow(token)) {
|
|
2317
|
-
if ('return' === token.value) {
|
|
2318
|
-
block.push(parseStatement());
|
|
2809
|
+
if ('return' === token.value || (!features.relaxedBreak && 'break' === token.value)) {
|
|
2810
|
+
block.push(parseStatement(flowContext));
|
|
2319
2811
|
break;
|
|
2320
2812
|
}
|
|
2321
|
-
statement = parseStatement();
|
|
2813
|
+
statement = parseStatement(flowContext);
|
|
2814
|
+
consume(';');
|
|
2322
2815
|
if (statement) block.push(statement);
|
|
2323
2816
|
}
|
|
2324
|
-
|
|
2325
|
-
if (options.scope) exitScope();
|
|
2326
2817
|
return block;
|
|
2327
2818
|
}
|
|
2328
2819
|
|
|
2329
|
-
function parseStatement() {
|
|
2820
|
+
function parseStatement(flowContext) {
|
|
2330
2821
|
markLocation();
|
|
2822
|
+
|
|
2823
|
+
if (Punctuator === token.type) {
|
|
2824
|
+
if (consume('::')) return parseLabelStatement(flowContext);
|
|
2825
|
+
}
|
|
2826
|
+
if (features.emptyStatement) {
|
|
2827
|
+
if (consume(';')) {
|
|
2828
|
+
if (trackLocations) locations.pop();
|
|
2829
|
+
return;
|
|
2830
|
+
}
|
|
2831
|
+
}
|
|
2832
|
+
|
|
2833
|
+
flowContext.raiseDeferredErrors();
|
|
2834
|
+
|
|
2331
2835
|
if (Keyword === token.type) {
|
|
2332
2836
|
switch (token.value) {
|
|
2333
|
-
case 'local': next(); return parseLocalStatement();
|
|
2334
|
-
case 'if': next(); return parseIfStatement();
|
|
2335
|
-
case 'return': next(); return parseReturnStatement();
|
|
2837
|
+
case 'local': next(); return parseLocalStatement(flowContext);
|
|
2838
|
+
case 'if': next(); return parseIfStatement(flowContext);
|
|
2839
|
+
case 'return': next(); return parseReturnStatement(flowContext);
|
|
2336
2840
|
case 'function': next();
|
|
2337
2841
|
var name = parseFunctionName();
|
|
2338
2842
|
return parseFunctionDeclaration(name);
|
|
2339
|
-
case 'while': next(); return parseWhileStatement();
|
|
2340
|
-
case 'for': next(); return parseForStatement();
|
|
2341
|
-
case 'repeat': next(); return parseRepeatStatement();
|
|
2342
|
-
case 'break': next();
|
|
2343
|
-
|
|
2344
|
-
|
|
2843
|
+
case 'while': next(); return parseWhileStatement(flowContext);
|
|
2844
|
+
case 'for': next(); return parseForStatement(flowContext);
|
|
2845
|
+
case 'repeat': next(); return parseRepeatStatement(flowContext);
|
|
2846
|
+
case 'break': next();
|
|
2847
|
+
if (!flowContext.isInLoop())
|
|
2848
|
+
raise(token, errors.noLoopToBreak, token.value);
|
|
2849
|
+
return parseBreakStatement();
|
|
2850
|
+
case 'do': next(); return parseDoStatement(flowContext);
|
|
2851
|
+
case 'goto': next(); return parseGotoStatement(flowContext);
|
|
2345
2852
|
}
|
|
2346
2853
|
}
|
|
2347
2854
|
|
|
2348
|
-
if (
|
|
2349
|
-
|
|
2855
|
+
if (features.contextualGoto &&
|
|
2856
|
+
token.type === Identifier && token.value === 'goto' &&
|
|
2857
|
+
lookahead.type === Identifier && lookahead.value !== 'goto') {
|
|
2858
|
+
next(); return parseGotoStatement(flowContext);
|
|
2350
2859
|
}
|
|
2351
2860
|
if (trackLocations) locations.pop();
|
|
2352
|
-
if (consume(';')) return;
|
|
2353
2861
|
|
|
2354
|
-
return parseAssignmentOrCallStatement();
|
|
2862
|
+
return parseAssignmentOrCallStatement(flowContext);
|
|
2355
2863
|
}
|
|
2356
2864
|
|
|
2357
|
-
function parseLabelStatement() {
|
|
2358
|
-
var
|
|
2865
|
+
function parseLabelStatement(flowContext) {
|
|
2866
|
+
var nameToken = token
|
|
2359
2867
|
, label = parseIdentifier();
|
|
2360
2868
|
|
|
2361
2869
|
if (options.scope) {
|
|
2362
|
-
scopeIdentifierName('::' +
|
|
2870
|
+
scopeIdentifierName('::' + nameToken.value + '::');
|
|
2363
2871
|
attachScope(label, true);
|
|
2364
2872
|
}
|
|
2365
2873
|
|
|
2366
2874
|
expect('::');
|
|
2875
|
+
|
|
2876
|
+
flowContext.addLabel(nameToken.value, nameToken);
|
|
2367
2877
|
return finishNode(ast.labelStatement(label));
|
|
2368
2878
|
}
|
|
2369
2879
|
|
|
@@ -2371,43 +2881,57 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2371
2881
|
return finishNode(ast.breakStatement());
|
|
2372
2882
|
}
|
|
2373
2883
|
|
|
2374
|
-
function parseGotoStatement() {
|
|
2884
|
+
function parseGotoStatement(flowContext) {
|
|
2375
2885
|
var name = token.value
|
|
2886
|
+
, gotoToken = previousToken
|
|
2376
2887
|
, label = parseIdentifier();
|
|
2377
2888
|
|
|
2378
|
-
|
|
2889
|
+
flowContext.addGoto(name, gotoToken);
|
|
2379
2890
|
return finishNode(ast.gotoStatement(label));
|
|
2380
2891
|
}
|
|
2381
2892
|
|
|
2382
|
-
function parseDoStatement() {
|
|
2383
|
-
|
|
2893
|
+
function parseDoStatement(flowContext) {
|
|
2894
|
+
if (options.scope) createScope();
|
|
2895
|
+
flowContext.pushScope();
|
|
2896
|
+
var body = parseBlock(flowContext);
|
|
2897
|
+
flowContext.popScope();
|
|
2898
|
+
if (options.scope) destroyScope();
|
|
2384
2899
|
expect('end');
|
|
2385
2900
|
return finishNode(ast.doStatement(body));
|
|
2386
2901
|
}
|
|
2387
2902
|
|
|
2388
|
-
function parseWhileStatement() {
|
|
2389
|
-
var condition = parseExpectedExpression();
|
|
2903
|
+
function parseWhileStatement(flowContext) {
|
|
2904
|
+
var condition = parseExpectedExpression(flowContext);
|
|
2390
2905
|
expect('do');
|
|
2391
|
-
|
|
2906
|
+
if (options.scope) createScope();
|
|
2907
|
+
flowContext.pushScope(true);
|
|
2908
|
+
var body = parseBlock(flowContext);
|
|
2909
|
+
flowContext.popScope();
|
|
2910
|
+
if (options.scope) destroyScope();
|
|
2392
2911
|
expect('end');
|
|
2393
2912
|
return finishNode(ast.whileStatement(condition, body));
|
|
2394
2913
|
}
|
|
2395
2914
|
|
|
2396
|
-
function parseRepeatStatement() {
|
|
2397
|
-
|
|
2915
|
+
function parseRepeatStatement(flowContext) {
|
|
2916
|
+
if (options.scope) createScope();
|
|
2917
|
+
flowContext.pushScope(true);
|
|
2918
|
+
var body = parseBlock(flowContext);
|
|
2398
2919
|
expect('until');
|
|
2399
|
-
|
|
2920
|
+
flowContext.raiseDeferredErrors();
|
|
2921
|
+
var condition = parseExpectedExpression(flowContext);
|
|
2922
|
+
flowContext.popScope();
|
|
2923
|
+
if (options.scope) destroyScope();
|
|
2400
2924
|
return finishNode(ast.repeatStatement(condition, body));
|
|
2401
2925
|
}
|
|
2402
2926
|
|
|
2403
|
-
function parseReturnStatement() {
|
|
2927
|
+
function parseReturnStatement(flowContext) {
|
|
2404
2928
|
var expressions = [];
|
|
2405
2929
|
|
|
2406
2930
|
if ('end' !== token.value) {
|
|
2407
|
-
var expression = parseExpression();
|
|
2931
|
+
var expression = parseExpression(flowContext);
|
|
2408
2932
|
if (null != expression) expressions.push(expression);
|
|
2409
2933
|
while (consume(',')) {
|
|
2410
|
-
expression = parseExpectedExpression();
|
|
2934
|
+
expression = parseExpectedExpression(flowContext);
|
|
2411
2935
|
expressions.push(expression);
|
|
2412
2936
|
}
|
|
2413
2937
|
consume(';'); // grammar tells us ; is optional here.
|
|
@@ -2415,7 +2939,7 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2415
2939
|
return finishNode(ast.returnStatement(expressions));
|
|
2416
2940
|
}
|
|
2417
2941
|
|
|
2418
|
-
function parseIfStatement() {
|
|
2942
|
+
function parseIfStatement(flowContext) {
|
|
2419
2943
|
var clauses = []
|
|
2420
2944
|
, condition
|
|
2421
2945
|
, body
|
|
@@ -2424,17 +2948,25 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2424
2948
|
marker = locations[locations.length - 1];
|
|
2425
2949
|
locations.push(marker);
|
|
2426
2950
|
}
|
|
2427
|
-
condition = parseExpectedExpression();
|
|
2951
|
+
condition = parseExpectedExpression(flowContext);
|
|
2428
2952
|
expect('then');
|
|
2429
|
-
|
|
2953
|
+
if (options.scope) createScope();
|
|
2954
|
+
flowContext.pushScope();
|
|
2955
|
+
body = parseBlock(flowContext);
|
|
2956
|
+
flowContext.popScope();
|
|
2957
|
+
if (options.scope) destroyScope();
|
|
2430
2958
|
clauses.push(finishNode(ast.ifClause(condition, body)));
|
|
2431
2959
|
|
|
2432
2960
|
if (trackLocations) marker = createLocationMarker();
|
|
2433
2961
|
while (consume('elseif')) {
|
|
2434
2962
|
pushLocation(marker);
|
|
2435
|
-
condition = parseExpectedExpression();
|
|
2963
|
+
condition = parseExpectedExpression(flowContext);
|
|
2436
2964
|
expect('then');
|
|
2437
|
-
|
|
2965
|
+
if (options.scope) createScope();
|
|
2966
|
+
flowContext.pushScope();
|
|
2967
|
+
body = parseBlock(flowContext);
|
|
2968
|
+
flowContext.popScope();
|
|
2969
|
+
if (options.scope) destroyScope();
|
|
2438
2970
|
clauses.push(finishNode(ast.elseifClause(condition, body)));
|
|
2439
2971
|
if (trackLocations) marker = createLocationMarker();
|
|
2440
2972
|
}
|
|
@@ -2444,7 +2976,11 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2444
2976
|
marker = new Marker(previousToken);
|
|
2445
2977
|
locations.push(marker);
|
|
2446
2978
|
}
|
|
2447
|
-
|
|
2979
|
+
if (options.scope) createScope();
|
|
2980
|
+
flowContext.pushScope();
|
|
2981
|
+
body = parseBlock(flowContext);
|
|
2982
|
+
flowContext.popScope();
|
|
2983
|
+
if (options.scope) destroyScope();
|
|
2448
2984
|
clauses.push(finishNode(ast.elseClause(body)));
|
|
2449
2985
|
}
|
|
2450
2986
|
|
|
@@ -2452,19 +2988,26 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2452
2988
|
return finishNode(ast.ifStatement(clauses));
|
|
2453
2989
|
}
|
|
2454
2990
|
|
|
2455
|
-
function parseForStatement() {
|
|
2991
|
+
function parseForStatement(flowContext) {
|
|
2456
2992
|
var variable = parseIdentifier()
|
|
2457
2993
|
, body;
|
|
2458
|
-
|
|
2994
|
+
|
|
2995
|
+
if (options.scope) {
|
|
2996
|
+
createScope();
|
|
2997
|
+
scopeIdentifier(variable);
|
|
2998
|
+
}
|
|
2459
2999
|
if (consume('=')) {
|
|
2460
|
-
var start = parseExpectedExpression();
|
|
3000
|
+
var start = parseExpectedExpression(flowContext);
|
|
2461
3001
|
expect(',');
|
|
2462
|
-
var end = parseExpectedExpression();
|
|
2463
|
-
var step = consume(',') ? parseExpectedExpression() : null;
|
|
3002
|
+
var end = parseExpectedExpression(flowContext);
|
|
3003
|
+
var step = consume(',') ? parseExpectedExpression(flowContext) : null;
|
|
2464
3004
|
|
|
2465
3005
|
expect('do');
|
|
2466
|
-
|
|
3006
|
+
flowContext.pushScope(true);
|
|
3007
|
+
body = parseBlock(flowContext);
|
|
3008
|
+
flowContext.popScope();
|
|
2467
3009
|
expect('end');
|
|
3010
|
+
if (options.scope) destroyScope();
|
|
2468
3011
|
|
|
2469
3012
|
return finishNode(ast.forNumericStatement(variable, start, end, step, body));
|
|
2470
3013
|
}
|
|
@@ -2478,20 +3021,24 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2478
3021
|
expect('in');
|
|
2479
3022
|
var iterators = [];
|
|
2480
3023
|
do {
|
|
2481
|
-
var expression = parseExpectedExpression();
|
|
3024
|
+
var expression = parseExpectedExpression(flowContext);
|
|
2482
3025
|
iterators.push(expression);
|
|
2483
3026
|
} while (consume(','));
|
|
2484
3027
|
|
|
2485
3028
|
expect('do');
|
|
2486
|
-
|
|
3029
|
+
flowContext.pushScope(true);
|
|
3030
|
+
body = parseBlock(flowContext);
|
|
3031
|
+
flowContext.popScope();
|
|
2487
3032
|
expect('end');
|
|
3033
|
+
if (options.scope) destroyScope();
|
|
2488
3034
|
|
|
2489
3035
|
return finishNode(ast.forGenericStatement(variables, iterators, body));
|
|
2490
3036
|
}
|
|
2491
3037
|
}
|
|
2492
3038
|
|
|
2493
|
-
function parseLocalStatement() {
|
|
2494
|
-
var name
|
|
3039
|
+
function parseLocalStatement(flowContext) {
|
|
3040
|
+
var name
|
|
3041
|
+
, declToken = previousToken;
|
|
2495
3042
|
|
|
2496
3043
|
if (Identifier === token.type) {
|
|
2497
3044
|
var variables = []
|
|
@@ -2501,16 +3048,17 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2501
3048
|
name = parseIdentifier();
|
|
2502
3049
|
|
|
2503
3050
|
variables.push(name);
|
|
3051
|
+
flowContext.addLocal(name.name, declToken);
|
|
2504
3052
|
} while (consume(','));
|
|
2505
3053
|
|
|
2506
3054
|
if (consume('=')) {
|
|
2507
3055
|
do {
|
|
2508
|
-
var expression = parseExpectedExpression();
|
|
3056
|
+
var expression = parseExpectedExpression(flowContext);
|
|
2509
3057
|
init.push(expression);
|
|
2510
3058
|
} while (consume(','));
|
|
2511
3059
|
}
|
|
2512
3060
|
if (options.scope) {
|
|
2513
|
-
for (var i = 0, l = variables.length; i < l; i
|
|
3061
|
+
for (var i = 0, l = variables.length; i < l; ++i) {
|
|
2514
3062
|
scopeIdentifier(variables[i]);
|
|
2515
3063
|
}
|
|
2516
3064
|
}
|
|
@@ -2519,45 +3067,94 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2519
3067
|
}
|
|
2520
3068
|
if (consume('function')) {
|
|
2521
3069
|
name = parseIdentifier();
|
|
2522
|
-
|
|
3070
|
+
flowContext.addLocal(name.name, declToken);
|
|
3071
|
+
|
|
3072
|
+
if (options.scope) {
|
|
3073
|
+
scopeIdentifier(name);
|
|
3074
|
+
createScope();
|
|
3075
|
+
}
|
|
2523
3076
|
return parseFunctionDeclaration(name, true);
|
|
2524
3077
|
} else {
|
|
2525
3078
|
raiseUnexpectedToken('<name>', token);
|
|
2526
3079
|
}
|
|
2527
3080
|
}
|
|
2528
3081
|
|
|
2529
|
-
function parseAssignmentOrCallStatement() {
|
|
3082
|
+
function parseAssignmentOrCallStatement(flowContext) {
|
|
2530
3083
|
var previous = token
|
|
2531
|
-
,
|
|
3084
|
+
, marker, startMarker;
|
|
3085
|
+
var lvalue, base, name;
|
|
2532
3086
|
|
|
2533
|
-
|
|
2534
|
-
expression = parsePrefixExpression();
|
|
3087
|
+
var targets = [];
|
|
2535
3088
|
|
|
2536
|
-
if (
|
|
2537
|
-
if (',='.indexOf(token.value) >= 0) {
|
|
2538
|
-
var variables = [expression]
|
|
2539
|
-
, init = []
|
|
2540
|
-
, exp;
|
|
3089
|
+
if (trackLocations) startMarker = createLocationMarker();
|
|
2541
3090
|
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
3091
|
+
do {
|
|
3092
|
+
if (trackLocations) marker = createLocationMarker();
|
|
3093
|
+
|
|
3094
|
+
if (Identifier === token.type) {
|
|
3095
|
+
name = token.value;
|
|
3096
|
+
base = parseIdentifier();
|
|
3097
|
+
if (options.scope) attachScope(base, scopeHasName(name));
|
|
3098
|
+
lvalue = true;
|
|
3099
|
+
} else if ('(' === token.value) {
|
|
3100
|
+
next();
|
|
3101
|
+
base = parseExpectedExpression(flowContext);
|
|
3102
|
+
expect(')');
|
|
3103
|
+
lvalue = false;
|
|
3104
|
+
} else {
|
|
3105
|
+
return unexpected(token);
|
|
2546
3106
|
}
|
|
2547
|
-
expect('=');
|
|
2548
|
-
do {
|
|
2549
|
-
exp = parseExpectedExpression();
|
|
2550
|
-
init.push(exp);
|
|
2551
|
-
} while (consume(','));
|
|
2552
3107
|
|
|
3108
|
+
both: for (;;) {
|
|
3109
|
+
var newBase;
|
|
3110
|
+
|
|
3111
|
+
switch (StringLiteral === token.type ? '"' : token.value) {
|
|
3112
|
+
case '.':
|
|
3113
|
+
case '[':
|
|
3114
|
+
lvalue = true;
|
|
3115
|
+
break;
|
|
3116
|
+
case ':':
|
|
3117
|
+
case '(':
|
|
3118
|
+
case '{':
|
|
3119
|
+
case '"':
|
|
3120
|
+
lvalue = null;
|
|
3121
|
+
break;
|
|
3122
|
+
default:
|
|
3123
|
+
break both;
|
|
3124
|
+
}
|
|
3125
|
+
|
|
3126
|
+
base = parsePrefixExpressionPart(base, marker, flowContext);
|
|
3127
|
+
}
|
|
3128
|
+
|
|
3129
|
+
targets.push(base);
|
|
3130
|
+
|
|
3131
|
+
if (',' !== token.value)
|
|
3132
|
+
break;
|
|
3133
|
+
|
|
3134
|
+
if (!lvalue) {
|
|
3135
|
+
return unexpected(token);
|
|
3136
|
+
}
|
|
3137
|
+
|
|
3138
|
+
next();
|
|
3139
|
+
} while (true);
|
|
3140
|
+
|
|
3141
|
+
if (targets.length === 1 && lvalue === null) {
|
|
2553
3142
|
pushLocation(marker);
|
|
2554
|
-
return finishNode(ast.
|
|
2555
|
-
}
|
|
2556
|
-
|
|
2557
|
-
pushLocation(marker);
|
|
2558
|
-
return finishNode(ast.callStatement(expression));
|
|
3143
|
+
return finishNode(ast.callStatement(targets[0]));
|
|
3144
|
+
} else if (!lvalue) {
|
|
3145
|
+
return unexpected(token);
|
|
2559
3146
|
}
|
|
2560
|
-
|
|
3147
|
+
|
|
3148
|
+
expect('=');
|
|
3149
|
+
|
|
3150
|
+
var values = [];
|
|
3151
|
+
|
|
3152
|
+
do {
|
|
3153
|
+
values.push(parseExpectedExpression(flowContext));
|
|
3154
|
+
} while (consume(','));
|
|
3155
|
+
|
|
3156
|
+
pushLocation(startMarker);
|
|
3157
|
+
return finishNode(ast.assignmentStatement(targets, values));
|
|
2561
3158
|
}
|
|
2562
3159
|
|
|
2563
3160
|
function parseIdentifier() {
|
|
@@ -2569,6 +3166,9 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2569
3166
|
}
|
|
2570
3167
|
|
|
2571
3168
|
function parseFunctionDeclaration(name, isLocal) {
|
|
3169
|
+
var flowContext = makeFlowContext();
|
|
3170
|
+
flowContext.pushScope();
|
|
3171
|
+
|
|
2572
3172
|
var parameters = [];
|
|
2573
3173
|
expect('(');
|
|
2574
3174
|
if (!consume(')')) {
|
|
@@ -2580,20 +3180,22 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2580
3180
|
parameters.push(parameter);
|
|
2581
3181
|
|
|
2582
3182
|
if (consume(',')) continue;
|
|
2583
|
-
else if (consume(')')) break;
|
|
2584
3183
|
}
|
|
2585
3184
|
else if (VarargLiteral === token.type) {
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
break;
|
|
3185
|
+
flowContext.allowVararg = true;
|
|
3186
|
+
parameters.push(parsePrimaryExpression(flowContext));
|
|
2589
3187
|
} else {
|
|
2590
3188
|
raiseUnexpectedToken('<name> or \'...\'', token);
|
|
2591
3189
|
}
|
|
3190
|
+
expect(')');
|
|
3191
|
+
break;
|
|
2592
3192
|
}
|
|
2593
3193
|
}
|
|
2594
3194
|
|
|
2595
|
-
var body = parseBlock();
|
|
3195
|
+
var body = parseBlock(flowContext);
|
|
3196
|
+
flowContext.popScope();
|
|
2596
3197
|
expect('end');
|
|
3198
|
+
if (options.scope) destroyScope();
|
|
2597
3199
|
|
|
2598
3200
|
isLocal = isLocal || false;
|
|
2599
3201
|
return finishNode(ast.functionStatement(name, parameters, isLocal, body));
|
|
@@ -2605,47 +3207,51 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2605
3207
|
if (trackLocations) marker = createLocationMarker();
|
|
2606
3208
|
base = parseIdentifier();
|
|
2607
3209
|
|
|
2608
|
-
if (options.scope)
|
|
3210
|
+
if (options.scope) {
|
|
3211
|
+
attachScope(base, scopeHasName(base.name));
|
|
3212
|
+
createScope();
|
|
3213
|
+
}
|
|
2609
3214
|
|
|
2610
3215
|
while (consume('.')) {
|
|
2611
3216
|
pushLocation(marker);
|
|
2612
3217
|
name = parseIdentifier();
|
|
2613
|
-
if (options.scope) attachScope(name, false);
|
|
2614
3218
|
base = finishNode(ast.memberExpression(base, '.', name));
|
|
2615
3219
|
}
|
|
2616
3220
|
|
|
2617
3221
|
if (consume(':')) {
|
|
2618
3222
|
pushLocation(marker);
|
|
2619
3223
|
name = parseIdentifier();
|
|
2620
|
-
if (options.scope) attachScope(name, false);
|
|
2621
3224
|
base = finishNode(ast.memberExpression(base, ':', name));
|
|
3225
|
+
if (options.scope) scopeIdentifierName('self');
|
|
2622
3226
|
}
|
|
2623
3227
|
|
|
2624
3228
|
return base;
|
|
2625
3229
|
}
|
|
2626
3230
|
|
|
2627
|
-
function parseTableConstructor() {
|
|
3231
|
+
function parseTableConstructor(flowContext) {
|
|
2628
3232
|
var fields = []
|
|
2629
3233
|
, key, value;
|
|
2630
3234
|
|
|
2631
3235
|
while (true) {
|
|
2632
3236
|
markLocation();
|
|
2633
3237
|
if (Punctuator === token.type && consume('[')) {
|
|
2634
|
-
key = parseExpectedExpression();
|
|
3238
|
+
key = parseExpectedExpression(flowContext);
|
|
2635
3239
|
expect(']');
|
|
2636
3240
|
expect('=');
|
|
2637
|
-
value = parseExpectedExpression();
|
|
3241
|
+
value = parseExpectedExpression(flowContext);
|
|
2638
3242
|
fields.push(finishNode(ast.tableKey(key, value)));
|
|
2639
3243
|
} else if (Identifier === token.type) {
|
|
2640
|
-
|
|
2641
|
-
|
|
2642
|
-
|
|
3244
|
+
if ('=' === lookahead.value) {
|
|
3245
|
+
key = parseIdentifier();
|
|
3246
|
+
next();
|
|
3247
|
+
value = parseExpectedExpression(flowContext);
|
|
2643
3248
|
fields.push(finishNode(ast.tableKeyString(key, value)));
|
|
2644
3249
|
} else {
|
|
2645
|
-
|
|
3250
|
+
value = parseExpectedExpression(flowContext);
|
|
3251
|
+
fields.push(finishNode(ast.tableValue(value)));
|
|
2646
3252
|
}
|
|
2647
3253
|
} else {
|
|
2648
|
-
if (null == (value = parseExpression())) {
|
|
3254
|
+
if (null == (value = parseExpression(flowContext))) {
|
|
2649
3255
|
locations.pop();
|
|
2650
3256
|
break;
|
|
2651
3257
|
}
|
|
@@ -2655,19 +3261,19 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2655
3261
|
next();
|
|
2656
3262
|
continue;
|
|
2657
3263
|
}
|
|
2658
|
-
|
|
3264
|
+
break;
|
|
2659
3265
|
}
|
|
2660
3266
|
expect('}');
|
|
2661
3267
|
return finishNode(ast.tableConstructorExpression(fields));
|
|
2662
3268
|
}
|
|
2663
3269
|
|
|
2664
|
-
function parseExpression() {
|
|
2665
|
-
var expression = parseSubExpression(0);
|
|
3270
|
+
function parseExpression(flowContext) {
|
|
3271
|
+
var expression = parseSubExpression(0, flowContext);
|
|
2666
3272
|
return expression;
|
|
2667
3273
|
}
|
|
2668
3274
|
|
|
2669
|
-
function parseExpectedExpression() {
|
|
2670
|
-
var expression = parseExpression();
|
|
3275
|
+
function parseExpectedExpression(flowContext) {
|
|
3276
|
+
var expression = parseExpression(flowContext);
|
|
2671
3277
|
if (null == expression) raiseUnexpectedToken('<expression>', token);
|
|
2672
3278
|
else return expression;
|
|
2673
3279
|
}
|
|
@@ -2678,23 +3284,29 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2678
3284
|
|
|
2679
3285
|
if (1 === length) {
|
|
2680
3286
|
switch (charCode) {
|
|
2681
|
-
case 94: return
|
|
2682
|
-
case 42: case 47: case 37: return
|
|
2683
|
-
case 43: case 45: return
|
|
3287
|
+
case 94: return 12; // ^
|
|
3288
|
+
case 42: case 47: case 37: return 10; // * / %
|
|
3289
|
+
case 43: case 45: return 9; // + -
|
|
3290
|
+
case 38: return 6; // &
|
|
3291
|
+
case 126: return 5; // ~
|
|
3292
|
+
case 124: return 4; // |
|
|
2684
3293
|
case 60: case 62: return 3; // < >
|
|
2685
|
-
case 38: case 124: return 7; // & |
|
|
2686
3294
|
}
|
|
2687
3295
|
} else if (2 === length) {
|
|
2688
3296
|
switch (charCode) {
|
|
2689
|
-
case
|
|
2690
|
-
case
|
|
3297
|
+
case 47: return 10; // //
|
|
3298
|
+
case 46: return 8; // ..
|
|
3299
|
+
case 60: case 62:
|
|
3300
|
+
if('<<' === operator || '>>' === operator) return 7; // << >>
|
|
3301
|
+
return 3; // <= >=
|
|
3302
|
+
case 61: case 126: return 3; // == ~=
|
|
2691
3303
|
case 111: return 1; // or
|
|
2692
3304
|
}
|
|
2693
3305
|
} else if (97 === charCode && 'and' === operator) return 2;
|
|
2694
3306
|
return 0;
|
|
2695
3307
|
}
|
|
2696
3308
|
|
|
2697
|
-
function parseSubExpression(minPrecedence) {
|
|
3309
|
+
function parseSubExpression(minPrecedence, flowContext) {
|
|
2698
3310
|
var operator = token.value
|
|
2699
3311
|
, expression, marker;
|
|
2700
3312
|
|
|
@@ -2702,14 +3314,14 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2702
3314
|
if (isUnary(token)) {
|
|
2703
3315
|
markLocation();
|
|
2704
3316
|
next();
|
|
2705
|
-
var argument = parseSubExpression(
|
|
3317
|
+
var argument = parseSubExpression(10, flowContext);
|
|
2706
3318
|
if (argument == null) raiseUnexpectedToken('<expression>', token);
|
|
2707
3319
|
expression = finishNode(ast.unaryExpression(operator, argument));
|
|
2708
3320
|
}
|
|
2709
3321
|
if (null == expression) {
|
|
2710
|
-
expression = parsePrimaryExpression();
|
|
3322
|
+
expression = parsePrimaryExpression(flowContext);
|
|
2711
3323
|
if (null == expression) {
|
|
2712
|
-
expression = parsePrefixExpression();
|
|
3324
|
+
expression = parsePrefixExpression(flowContext);
|
|
2713
3325
|
}
|
|
2714
3326
|
}
|
|
2715
3327
|
if (null == expression) return null;
|
|
@@ -2722,9 +3334,9 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2722
3334
|
binaryPrecedence(operator) : 0;
|
|
2723
3335
|
|
|
2724
3336
|
if (precedence === 0 || precedence <= minPrecedence) break;
|
|
2725
|
-
if ('^' === operator || '..' === operator) precedence
|
|
3337
|
+
if ('^' === operator || '..' === operator) --precedence;
|
|
2726
3338
|
next();
|
|
2727
|
-
var right = parseSubExpression(precedence);
|
|
3339
|
+
var right = parseSubExpression(precedence, flowContext);
|
|
2728
3340
|
if (null == right) raiseUnexpectedToken('<expression>', token);
|
|
2729
3341
|
if (trackLocations) locations.push(marker);
|
|
2730
3342
|
expression = finishNode(ast.binaryExpression(operator, expression, right));
|
|
@@ -2733,77 +3345,79 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2733
3345
|
return expression;
|
|
2734
3346
|
}
|
|
2735
3347
|
|
|
2736
|
-
function
|
|
2737
|
-
var
|
|
2738
|
-
|
|
3348
|
+
function parsePrefixExpressionPart(base, marker, flowContext) {
|
|
3349
|
+
var expression, identifier;
|
|
3350
|
+
|
|
3351
|
+
if (Punctuator === token.type) {
|
|
3352
|
+
switch (token.value) {
|
|
3353
|
+
case '[':
|
|
3354
|
+
pushLocation(marker);
|
|
3355
|
+
next();
|
|
3356
|
+
expression = parseExpectedExpression(flowContext);
|
|
3357
|
+
expect(']');
|
|
3358
|
+
return finishNode(ast.indexExpression(base, expression));
|
|
3359
|
+
case '.':
|
|
3360
|
+
pushLocation(marker);
|
|
3361
|
+
next();
|
|
3362
|
+
identifier = parseIdentifier();
|
|
3363
|
+
return finishNode(ast.memberExpression(base, '.', identifier));
|
|
3364
|
+
case ':':
|
|
3365
|
+
pushLocation(marker);
|
|
3366
|
+
next();
|
|
3367
|
+
identifier = parseIdentifier();
|
|
3368
|
+
base = finishNode(ast.memberExpression(base, ':', identifier));
|
|
3369
|
+
pushLocation(marker);
|
|
3370
|
+
return parseCallExpression(base, flowContext);
|
|
3371
|
+
case '(': case '{': // args
|
|
3372
|
+
pushLocation(marker);
|
|
3373
|
+
return parseCallExpression(base, flowContext);
|
|
3374
|
+
}
|
|
3375
|
+
} else if (StringLiteral === token.type) {
|
|
3376
|
+
pushLocation(marker);
|
|
3377
|
+
return parseCallExpression(base, flowContext);
|
|
3378
|
+
}
|
|
3379
|
+
|
|
3380
|
+
return null;
|
|
3381
|
+
}
|
|
3382
|
+
|
|
3383
|
+
function parsePrefixExpression(flowContext) {
|
|
3384
|
+
var base, name, marker;
|
|
2739
3385
|
|
|
2740
3386
|
if (trackLocations) marker = createLocationMarker();
|
|
2741
3387
|
if (Identifier === token.type) {
|
|
2742
3388
|
name = token.value;
|
|
2743
3389
|
base = parseIdentifier();
|
|
2744
|
-
if (options.scope) attachScope(base,
|
|
3390
|
+
if (options.scope) attachScope(base, scopeHasName(name));
|
|
2745
3391
|
} else if (consume('(')) {
|
|
2746
|
-
base = parseExpectedExpression();
|
|
3392
|
+
base = parseExpectedExpression(flowContext);
|
|
2747
3393
|
expect(')');
|
|
2748
|
-
if (options.scope) isLocal = base.isLocal;
|
|
2749
3394
|
} else {
|
|
2750
3395
|
return null;
|
|
2751
3396
|
}
|
|
2752
|
-
|
|
2753
|
-
|
|
2754
|
-
if (
|
|
2755
|
-
switch (token.value) {
|
|
2756
|
-
case '[':
|
|
2757
|
-
pushLocation(marker);
|
|
2758
|
-
next();
|
|
2759
|
-
expression = parseExpectedExpression();
|
|
2760
|
-
base = finishNode(ast.indexExpression(base, expression));
|
|
2761
|
-
expect(']');
|
|
2762
|
-
break;
|
|
2763
|
-
case '.':
|
|
2764
|
-
pushLocation(marker);
|
|
2765
|
-
next();
|
|
2766
|
-
identifier = parseIdentifier();
|
|
2767
|
-
if (options.scope) attachScope(identifier, isLocal);
|
|
2768
|
-
base = finishNode(ast.memberExpression(base, '.', identifier));
|
|
2769
|
-
break;
|
|
2770
|
-
case ':':
|
|
2771
|
-
pushLocation(marker);
|
|
2772
|
-
next();
|
|
2773
|
-
identifier = parseIdentifier();
|
|
2774
|
-
if (options.scope) attachScope(identifier, isLocal);
|
|
2775
|
-
base = finishNode(ast.memberExpression(base, ':', identifier));
|
|
2776
|
-
pushLocation(marker);
|
|
2777
|
-
base = parseCallExpression(base);
|
|
2778
|
-
break;
|
|
2779
|
-
case '(': case '{': // args
|
|
2780
|
-
pushLocation(marker);
|
|
2781
|
-
base = parseCallExpression(base);
|
|
2782
|
-
break;
|
|
2783
|
-
default:
|
|
2784
|
-
return base;
|
|
2785
|
-
}
|
|
2786
|
-
} else if (StringLiteral === token.type) {
|
|
2787
|
-
pushLocation(marker);
|
|
2788
|
-
base = parseCallExpression(base);
|
|
2789
|
-
} else {
|
|
3397
|
+
for (;;) {
|
|
3398
|
+
var newBase = parsePrefixExpressionPart(base, marker, flowContext);
|
|
3399
|
+
if (newBase === null)
|
|
2790
3400
|
break;
|
|
2791
|
-
|
|
3401
|
+
base = newBase;
|
|
2792
3402
|
}
|
|
2793
3403
|
|
|
2794
3404
|
return base;
|
|
2795
3405
|
}
|
|
2796
3406
|
|
|
2797
|
-
function parseCallExpression(base) {
|
|
3407
|
+
function parseCallExpression(base, flowContext) {
|
|
2798
3408
|
if (Punctuator === token.type) {
|
|
2799
3409
|
switch (token.value) {
|
|
2800
3410
|
case '(':
|
|
3411
|
+
if (!features.emptyStatement) {
|
|
3412
|
+
if (token.line !== previousToken.line)
|
|
3413
|
+
raise(null, errors.ambiguousSyntax, token.value);
|
|
3414
|
+
}
|
|
2801
3415
|
next();
|
|
2802
3416
|
var expressions = [];
|
|
2803
|
-
var expression = parseExpression();
|
|
3417
|
+
var expression = parseExpression(flowContext);
|
|
2804
3418
|
if (null != expression) expressions.push(expression);
|
|
2805
3419
|
while (consume(',')) {
|
|
2806
|
-
expression = parseExpectedExpression();
|
|
3420
|
+
expression = parseExpectedExpression(flowContext);
|
|
2807
3421
|
expressions.push(expression);
|
|
2808
3422
|
}
|
|
2809
3423
|
|
|
@@ -2813,17 +3427,17 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2813
3427
|
case '{':
|
|
2814
3428
|
markLocation();
|
|
2815
3429
|
next();
|
|
2816
|
-
var table = parseTableConstructor();
|
|
3430
|
+
var table = parseTableConstructor(flowContext);
|
|
2817
3431
|
return finishNode(ast.tableCallExpression(base, table));
|
|
2818
3432
|
}
|
|
2819
3433
|
} else if (StringLiteral === token.type) {
|
|
2820
|
-
return finishNode(ast.stringCallExpression(base, parsePrimaryExpression()));
|
|
3434
|
+
return finishNode(ast.stringCallExpression(base, parsePrimaryExpression(flowContext)));
|
|
2821
3435
|
}
|
|
2822
3436
|
|
|
2823
3437
|
raiseUnexpectedToken('function arguments', token);
|
|
2824
3438
|
}
|
|
2825
3439
|
|
|
2826
|
-
function parsePrimaryExpression() {
|
|
3440
|
+
function parsePrimaryExpression(flowContext) {
|
|
2827
3441
|
var literals = StringLiteral | NumericLiteral | BooleanLiteral | NilLiteral | VarargLiteral
|
|
2828
3442
|
, value = token.value
|
|
2829
3443
|
, type = token.type
|
|
@@ -2831,6 +3445,10 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2831
3445
|
|
|
2832
3446
|
if (trackLocations) marker = createLocationMarker();
|
|
2833
3447
|
|
|
3448
|
+
if (type === VarargLiteral && !flowContext.allowVararg) {
|
|
3449
|
+
raise(token, errors.cannotUseVararg, token.value);
|
|
3450
|
+
}
|
|
3451
|
+
|
|
2834
3452
|
if (type & literals) {
|
|
2835
3453
|
pushLocation(marker);
|
|
2836
3454
|
var raw = input.slice(token.range[0], token.range[1]);
|
|
@@ -2839,15 +3457,50 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2839
3457
|
} else if (Keyword === type && 'function' === value) {
|
|
2840
3458
|
pushLocation(marker);
|
|
2841
3459
|
next();
|
|
3460
|
+
if (options.scope) createScope();
|
|
2842
3461
|
return parseFunctionDeclaration(null);
|
|
2843
3462
|
} else if (consume('{')) {
|
|
2844
3463
|
pushLocation(marker);
|
|
2845
|
-
return parseTableConstructor();
|
|
3464
|
+
return parseTableConstructor(flowContext);
|
|
2846
3465
|
}
|
|
2847
3466
|
}
|
|
2848
3467
|
|
|
2849
3468
|
exports.parse = parse;
|
|
2850
3469
|
|
|
3470
|
+
var versionFeatures = {
|
|
3471
|
+
'5.1': {
|
|
3472
|
+
},
|
|
3473
|
+
'5.2': {
|
|
3474
|
+
labels: true,
|
|
3475
|
+
emptyStatement: true,
|
|
3476
|
+
hexEscapes: true,
|
|
3477
|
+
skipWhitespaceEscape: true,
|
|
3478
|
+
strictEscapes: true,
|
|
3479
|
+
relaxedBreak: true
|
|
3480
|
+
},
|
|
3481
|
+
'5.3': {
|
|
3482
|
+
labels: true,
|
|
3483
|
+
emptyStatement: true,
|
|
3484
|
+
hexEscapes: true,
|
|
3485
|
+
skipWhitespaceEscape: true,
|
|
3486
|
+
strictEscapes: true,
|
|
3487
|
+
unicodeEscapes: true,
|
|
3488
|
+
bitwiseOperators: true,
|
|
3489
|
+
integerDivision: true,
|
|
3490
|
+
relaxedBreak: true
|
|
3491
|
+
},
|
|
3492
|
+
'LuaJIT': {
|
|
3493
|
+
labels: true,
|
|
3494
|
+
contextualGoto: true,
|
|
3495
|
+
hexEscapes: true,
|
|
3496
|
+
skipWhitespaceEscape: true,
|
|
3497
|
+
strictEscapes: true,
|
|
3498
|
+
unicodeEscapes: true,
|
|
3499
|
+
imaginaryNumbers: true,
|
|
3500
|
+
integerSuffixes: true
|
|
3501
|
+
}
|
|
3502
|
+
};
|
|
3503
|
+
|
|
2851
3504
|
function parse(_input, _options) {
|
|
2852
3505
|
if ('undefined' === typeof _options && 'object' === typeof _input) {
|
|
2853
3506
|
_options = _input;
|
|
@@ -2856,7 +3509,7 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2856
3509
|
if (!_options) _options = {};
|
|
2857
3510
|
|
|
2858
3511
|
input = _input || '';
|
|
2859
|
-
options =
|
|
3512
|
+
options = assign({}, defaultOptions, _options);
|
|
2860
3513
|
index = 0;
|
|
2861
3514
|
line = 1;
|
|
2862
3515
|
lineStart = 0;
|
|
@@ -2866,6 +3519,20 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2866
3519
|
globals = [];
|
|
2867
3520
|
locations = [];
|
|
2868
3521
|
|
|
3522
|
+
if (!Object.prototype.hasOwnProperty.call(versionFeatures, options.luaVersion)) {
|
|
3523
|
+
throw new Error(sprintf("Lua version '%1' not supported", options.luaVersion));
|
|
3524
|
+
}
|
|
3525
|
+
|
|
3526
|
+
features = assign({}, versionFeatures[options.luaVersion]);
|
|
3527
|
+
if (options.extendedIdentifiers !== void 0)
|
|
3528
|
+
features.extendedIdentifiers = !!options.extendedIdentifiers;
|
|
3529
|
+
|
|
3530
|
+
if (!Object.prototype.hasOwnProperty.call(encodingModes, options.encodingMode)) {
|
|
3531
|
+
throw new Error(sprintf("Encoding mode '%1' not supported", options.encodingMode));
|
|
3532
|
+
}
|
|
3533
|
+
|
|
3534
|
+
encodingMode = encodingModes[options.encodingMode];
|
|
3535
|
+
|
|
2869
3536
|
if (options.comments) comments = [];
|
|
2870
3537
|
if (!options.wait) return end();
|
|
2871
3538
|
return exports;
|
|
@@ -2881,6 +3548,9 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2881
3548
|
|
|
2882
3549
|
function end(_input) {
|
|
2883
3550
|
if ('undefined' !== typeof _input) write(_input);
|
|
3551
|
+
if (input && input.substr(0, 2) === '#!') input = input.replace(/^.*/, function (line) {
|
|
3552
|
+
return line.replace(/./g, ' ');
|
|
3553
|
+
});
|
|
2884
3554
|
|
|
2885
3555
|
length = input.length;
|
|
2886
3556
|
trackLocations = options.locations || options.ranges;
|
|
@@ -2889,7 +3559,6 @@ ace.define("ace/mode/lua/luaparse",[], function(require, exports, module) {
|
|
|
2889
3559
|
var chunk = parseChunk();
|
|
2890
3560
|
if (options.comments) chunk.comments = comments;
|
|
2891
3561
|
if (options.scope) chunk.globals = globals;
|
|
2892
|
-
|
|
2893
3562
|
if (locations.length > 0)
|
|
2894
3563
|
throw new Error('Location tracking failed. This is most likely a bug in luaparse');
|
|
2895
3564
|
|
|
@@ -2922,7 +3591,7 @@ oop.inherits(Worker, Mirror);
|
|
|
2922
3591
|
try {
|
|
2923
3592
|
luaparse.parse(value);
|
|
2924
3593
|
} catch(e) {
|
|
2925
|
-
if (e instanceof SyntaxError) {
|
|
3594
|
+
if (e instanceof luaparse.SyntaxError) {
|
|
2926
3595
|
errors.push({
|
|
2927
3596
|
row: e.line - 1,
|
|
2928
3597
|
column: e.column,
|
|
@@ -2937,700 +3606,3 @@ oop.inherits(Worker, Mirror);
|
|
|
2937
3606
|
}).call(Worker.prototype);
|
|
2938
3607
|
|
|
2939
3608
|
});
|
|
2940
|
-
|
|
2941
|
-
ace.define("ace/lib/es5-shim",[], function(require, exports, module) {
|
|
2942
|
-
|
|
2943
|
-
function Empty() {}
|
|
2944
|
-
|
|
2945
|
-
if (!Function.prototype.bind) {
|
|
2946
|
-
Function.prototype.bind = function bind(that) { // .length is 1
|
|
2947
|
-
var target = this;
|
|
2948
|
-
if (typeof target != "function") {
|
|
2949
|
-
throw new TypeError("Function.prototype.bind called on incompatible " + target);
|
|
2950
|
-
}
|
|
2951
|
-
var args = slice.call(arguments, 1); // for normal call
|
|
2952
|
-
var bound = function () {
|
|
2953
|
-
|
|
2954
|
-
if (this instanceof bound) {
|
|
2955
|
-
|
|
2956
|
-
var result = target.apply(
|
|
2957
|
-
this,
|
|
2958
|
-
args.concat(slice.call(arguments))
|
|
2959
|
-
);
|
|
2960
|
-
if (Object(result) === result) {
|
|
2961
|
-
return result;
|
|
2962
|
-
}
|
|
2963
|
-
return this;
|
|
2964
|
-
|
|
2965
|
-
} else {
|
|
2966
|
-
return target.apply(
|
|
2967
|
-
that,
|
|
2968
|
-
args.concat(slice.call(arguments))
|
|
2969
|
-
);
|
|
2970
|
-
|
|
2971
|
-
}
|
|
2972
|
-
|
|
2973
|
-
};
|
|
2974
|
-
if(target.prototype) {
|
|
2975
|
-
Empty.prototype = target.prototype;
|
|
2976
|
-
bound.prototype = new Empty();
|
|
2977
|
-
Empty.prototype = null;
|
|
2978
|
-
}
|
|
2979
|
-
return bound;
|
|
2980
|
-
};
|
|
2981
|
-
}
|
|
2982
|
-
var call = Function.prototype.call;
|
|
2983
|
-
var prototypeOfArray = Array.prototype;
|
|
2984
|
-
var prototypeOfObject = Object.prototype;
|
|
2985
|
-
var slice = prototypeOfArray.slice;
|
|
2986
|
-
var _toString = call.bind(prototypeOfObject.toString);
|
|
2987
|
-
var owns = call.bind(prototypeOfObject.hasOwnProperty);
|
|
2988
|
-
var defineGetter;
|
|
2989
|
-
var defineSetter;
|
|
2990
|
-
var lookupGetter;
|
|
2991
|
-
var lookupSetter;
|
|
2992
|
-
var supportsAccessors;
|
|
2993
|
-
if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
|
|
2994
|
-
defineGetter = call.bind(prototypeOfObject.__defineGetter__);
|
|
2995
|
-
defineSetter = call.bind(prototypeOfObject.__defineSetter__);
|
|
2996
|
-
lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
|
|
2997
|
-
lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
|
|
2998
|
-
}
|
|
2999
|
-
if ([1,2].splice(0).length != 2) {
|
|
3000
|
-
if(function() { // test IE < 9 to splice bug - see issue #138
|
|
3001
|
-
function makeArray(l) {
|
|
3002
|
-
var a = new Array(l+2);
|
|
3003
|
-
a[0] = a[1] = 0;
|
|
3004
|
-
return a;
|
|
3005
|
-
}
|
|
3006
|
-
var array = [], lengthBefore;
|
|
3007
|
-
|
|
3008
|
-
array.splice.apply(array, makeArray(20));
|
|
3009
|
-
array.splice.apply(array, makeArray(26));
|
|
3010
|
-
|
|
3011
|
-
lengthBefore = array.length; //46
|
|
3012
|
-
array.splice(5, 0, "XXX"); // add one element
|
|
3013
|
-
|
|
3014
|
-
lengthBefore + 1 == array.length
|
|
3015
|
-
|
|
3016
|
-
if (lengthBefore + 1 == array.length) {
|
|
3017
|
-
return true;// has right splice implementation without bugs
|
|
3018
|
-
}
|
|
3019
|
-
}()) {//IE 6/7
|
|
3020
|
-
var array_splice = Array.prototype.splice;
|
|
3021
|
-
Array.prototype.splice = function(start, deleteCount) {
|
|
3022
|
-
if (!arguments.length) {
|
|
3023
|
-
return [];
|
|
3024
|
-
} else {
|
|
3025
|
-
return array_splice.apply(this, [
|
|
3026
|
-
start === void 0 ? 0 : start,
|
|
3027
|
-
deleteCount === void 0 ? (this.length - start) : deleteCount
|
|
3028
|
-
].concat(slice.call(arguments, 2)))
|
|
3029
|
-
}
|
|
3030
|
-
};
|
|
3031
|
-
} else {//IE8
|
|
3032
|
-
Array.prototype.splice = function(pos, removeCount){
|
|
3033
|
-
var length = this.length;
|
|
3034
|
-
if (pos > 0) {
|
|
3035
|
-
if (pos > length)
|
|
3036
|
-
pos = length;
|
|
3037
|
-
} else if (pos == void 0) {
|
|
3038
|
-
pos = 0;
|
|
3039
|
-
} else if (pos < 0) {
|
|
3040
|
-
pos = Math.max(length + pos, 0);
|
|
3041
|
-
}
|
|
3042
|
-
|
|
3043
|
-
if (!(pos+removeCount < length))
|
|
3044
|
-
removeCount = length - pos;
|
|
3045
|
-
|
|
3046
|
-
var removed = this.slice(pos, pos+removeCount);
|
|
3047
|
-
var insert = slice.call(arguments, 2);
|
|
3048
|
-
var add = insert.length;
|
|
3049
|
-
if (pos === length) {
|
|
3050
|
-
if (add) {
|
|
3051
|
-
this.push.apply(this, insert);
|
|
3052
|
-
}
|
|
3053
|
-
} else {
|
|
3054
|
-
var remove = Math.min(removeCount, length - pos);
|
|
3055
|
-
var tailOldPos = pos + remove;
|
|
3056
|
-
var tailNewPos = tailOldPos + add - remove;
|
|
3057
|
-
var tailCount = length - tailOldPos;
|
|
3058
|
-
var lengthAfterRemove = length - remove;
|
|
3059
|
-
|
|
3060
|
-
if (tailNewPos < tailOldPos) { // case A
|
|
3061
|
-
for (var i = 0; i < tailCount; ++i) {
|
|
3062
|
-
this[tailNewPos+i] = this[tailOldPos+i];
|
|
3063
|
-
}
|
|
3064
|
-
} else if (tailNewPos > tailOldPos) { // case B
|
|
3065
|
-
for (i = tailCount; i--; ) {
|
|
3066
|
-
this[tailNewPos+i] = this[tailOldPos+i];
|
|
3067
|
-
}
|
|
3068
|
-
} // else, add == remove (nothing to do)
|
|
3069
|
-
|
|
3070
|
-
if (add && pos === lengthAfterRemove) {
|
|
3071
|
-
this.length = lengthAfterRemove; // truncate array
|
|
3072
|
-
this.push.apply(this, insert);
|
|
3073
|
-
} else {
|
|
3074
|
-
this.length = lengthAfterRemove + add; // reserves space
|
|
3075
|
-
for (i = 0; i < add; ++i) {
|
|
3076
|
-
this[pos+i] = insert[i];
|
|
3077
|
-
}
|
|
3078
|
-
}
|
|
3079
|
-
}
|
|
3080
|
-
return removed;
|
|
3081
|
-
};
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
if (!Array.isArray) {
|
|
3085
|
-
Array.isArray = function isArray(obj) {
|
|
3086
|
-
return _toString(obj) == "[object Array]";
|
|
3087
|
-
};
|
|
3088
|
-
}
|
|
3089
|
-
var boxedString = Object("a"),
|
|
3090
|
-
splitString = boxedString[0] != "a" || !(0 in boxedString);
|
|
3091
|
-
|
|
3092
|
-
if (!Array.prototype.forEach) {
|
|
3093
|
-
Array.prototype.forEach = function forEach(fun /*, thisp*/) {
|
|
3094
|
-
var object = toObject(this),
|
|
3095
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3096
|
-
this.split("") :
|
|
3097
|
-
object,
|
|
3098
|
-
thisp = arguments[1],
|
|
3099
|
-
i = -1,
|
|
3100
|
-
length = self.length >>> 0;
|
|
3101
|
-
if (_toString(fun) != "[object Function]") {
|
|
3102
|
-
throw new TypeError(); // TODO message
|
|
3103
|
-
}
|
|
3104
|
-
|
|
3105
|
-
while (++i < length) {
|
|
3106
|
-
if (i in self) {
|
|
3107
|
-
fun.call(thisp, self[i], i, object);
|
|
3108
|
-
}
|
|
3109
|
-
}
|
|
3110
|
-
};
|
|
3111
|
-
}
|
|
3112
|
-
if (!Array.prototype.map) {
|
|
3113
|
-
Array.prototype.map = function map(fun /*, thisp*/) {
|
|
3114
|
-
var object = toObject(this),
|
|
3115
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3116
|
-
this.split("") :
|
|
3117
|
-
object,
|
|
3118
|
-
length = self.length >>> 0,
|
|
3119
|
-
result = Array(length),
|
|
3120
|
-
thisp = arguments[1];
|
|
3121
|
-
if (_toString(fun) != "[object Function]") {
|
|
3122
|
-
throw new TypeError(fun + " is not a function");
|
|
3123
|
-
}
|
|
3124
|
-
|
|
3125
|
-
for (var i = 0; i < length; i++) {
|
|
3126
|
-
if (i in self)
|
|
3127
|
-
result[i] = fun.call(thisp, self[i], i, object);
|
|
3128
|
-
}
|
|
3129
|
-
return result;
|
|
3130
|
-
};
|
|
3131
|
-
}
|
|
3132
|
-
if (!Array.prototype.filter) {
|
|
3133
|
-
Array.prototype.filter = function filter(fun /*, thisp */) {
|
|
3134
|
-
var object = toObject(this),
|
|
3135
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3136
|
-
this.split("") :
|
|
3137
|
-
object,
|
|
3138
|
-
length = self.length >>> 0,
|
|
3139
|
-
result = [],
|
|
3140
|
-
value,
|
|
3141
|
-
thisp = arguments[1];
|
|
3142
|
-
if (_toString(fun) != "[object Function]") {
|
|
3143
|
-
throw new TypeError(fun + " is not a function");
|
|
3144
|
-
}
|
|
3145
|
-
|
|
3146
|
-
for (var i = 0; i < length; i++) {
|
|
3147
|
-
if (i in self) {
|
|
3148
|
-
value = self[i];
|
|
3149
|
-
if (fun.call(thisp, value, i, object)) {
|
|
3150
|
-
result.push(value);
|
|
3151
|
-
}
|
|
3152
|
-
}
|
|
3153
|
-
}
|
|
3154
|
-
return result;
|
|
3155
|
-
};
|
|
3156
|
-
}
|
|
3157
|
-
if (!Array.prototype.every) {
|
|
3158
|
-
Array.prototype.every = function every(fun /*, thisp */) {
|
|
3159
|
-
var object = toObject(this),
|
|
3160
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3161
|
-
this.split("") :
|
|
3162
|
-
object,
|
|
3163
|
-
length = self.length >>> 0,
|
|
3164
|
-
thisp = arguments[1];
|
|
3165
|
-
if (_toString(fun) != "[object Function]") {
|
|
3166
|
-
throw new TypeError(fun + " is not a function");
|
|
3167
|
-
}
|
|
3168
|
-
|
|
3169
|
-
for (var i = 0; i < length; i++) {
|
|
3170
|
-
if (i in self && !fun.call(thisp, self[i], i, object)) {
|
|
3171
|
-
return false;
|
|
3172
|
-
}
|
|
3173
|
-
}
|
|
3174
|
-
return true;
|
|
3175
|
-
};
|
|
3176
|
-
}
|
|
3177
|
-
if (!Array.prototype.some) {
|
|
3178
|
-
Array.prototype.some = function some(fun /*, thisp */) {
|
|
3179
|
-
var object = toObject(this),
|
|
3180
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3181
|
-
this.split("") :
|
|
3182
|
-
object,
|
|
3183
|
-
length = self.length >>> 0,
|
|
3184
|
-
thisp = arguments[1];
|
|
3185
|
-
if (_toString(fun) != "[object Function]") {
|
|
3186
|
-
throw new TypeError(fun + " is not a function");
|
|
3187
|
-
}
|
|
3188
|
-
|
|
3189
|
-
for (var i = 0; i < length; i++) {
|
|
3190
|
-
if (i in self && fun.call(thisp, self[i], i, object)) {
|
|
3191
|
-
return true;
|
|
3192
|
-
}
|
|
3193
|
-
}
|
|
3194
|
-
return false;
|
|
3195
|
-
};
|
|
3196
|
-
}
|
|
3197
|
-
if (!Array.prototype.reduce) {
|
|
3198
|
-
Array.prototype.reduce = function reduce(fun /*, initial*/) {
|
|
3199
|
-
var object = toObject(this),
|
|
3200
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3201
|
-
this.split("") :
|
|
3202
|
-
object,
|
|
3203
|
-
length = self.length >>> 0;
|
|
3204
|
-
if (_toString(fun) != "[object Function]") {
|
|
3205
|
-
throw new TypeError(fun + " is not a function");
|
|
3206
|
-
}
|
|
3207
|
-
if (!length && arguments.length == 1) {
|
|
3208
|
-
throw new TypeError("reduce of empty array with no initial value");
|
|
3209
|
-
}
|
|
3210
|
-
|
|
3211
|
-
var i = 0;
|
|
3212
|
-
var result;
|
|
3213
|
-
if (arguments.length >= 2) {
|
|
3214
|
-
result = arguments[1];
|
|
3215
|
-
} else {
|
|
3216
|
-
do {
|
|
3217
|
-
if (i in self) {
|
|
3218
|
-
result = self[i++];
|
|
3219
|
-
break;
|
|
3220
|
-
}
|
|
3221
|
-
if (++i >= length) {
|
|
3222
|
-
throw new TypeError("reduce of empty array with no initial value");
|
|
3223
|
-
}
|
|
3224
|
-
} while (true);
|
|
3225
|
-
}
|
|
3226
|
-
|
|
3227
|
-
for (; i < length; i++) {
|
|
3228
|
-
if (i in self) {
|
|
3229
|
-
result = fun.call(void 0, result, self[i], i, object);
|
|
3230
|
-
}
|
|
3231
|
-
}
|
|
3232
|
-
|
|
3233
|
-
return result;
|
|
3234
|
-
};
|
|
3235
|
-
}
|
|
3236
|
-
if (!Array.prototype.reduceRight) {
|
|
3237
|
-
Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
|
|
3238
|
-
var object = toObject(this),
|
|
3239
|
-
self = splitString && _toString(this) == "[object String]" ?
|
|
3240
|
-
this.split("") :
|
|
3241
|
-
object,
|
|
3242
|
-
length = self.length >>> 0;
|
|
3243
|
-
if (_toString(fun) != "[object Function]") {
|
|
3244
|
-
throw new TypeError(fun + " is not a function");
|
|
3245
|
-
}
|
|
3246
|
-
if (!length && arguments.length == 1) {
|
|
3247
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
|
3248
|
-
}
|
|
3249
|
-
|
|
3250
|
-
var result, i = length - 1;
|
|
3251
|
-
if (arguments.length >= 2) {
|
|
3252
|
-
result = arguments[1];
|
|
3253
|
-
} else {
|
|
3254
|
-
do {
|
|
3255
|
-
if (i in self) {
|
|
3256
|
-
result = self[i--];
|
|
3257
|
-
break;
|
|
3258
|
-
}
|
|
3259
|
-
if (--i < 0) {
|
|
3260
|
-
throw new TypeError("reduceRight of empty array with no initial value");
|
|
3261
|
-
}
|
|
3262
|
-
} while (true);
|
|
3263
|
-
}
|
|
3264
|
-
|
|
3265
|
-
do {
|
|
3266
|
-
if (i in this) {
|
|
3267
|
-
result = fun.call(void 0, result, self[i], i, object);
|
|
3268
|
-
}
|
|
3269
|
-
} while (i--);
|
|
3270
|
-
|
|
3271
|
-
return result;
|
|
3272
|
-
};
|
|
3273
|
-
}
|
|
3274
|
-
if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) {
|
|
3275
|
-
Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
|
|
3276
|
-
var self = splitString && _toString(this) == "[object String]" ?
|
|
3277
|
-
this.split("") :
|
|
3278
|
-
toObject(this),
|
|
3279
|
-
length = self.length >>> 0;
|
|
3280
|
-
|
|
3281
|
-
if (!length) {
|
|
3282
|
-
return -1;
|
|
3283
|
-
}
|
|
3284
|
-
|
|
3285
|
-
var i = 0;
|
|
3286
|
-
if (arguments.length > 1) {
|
|
3287
|
-
i = toInteger(arguments[1]);
|
|
3288
|
-
}
|
|
3289
|
-
i = i >= 0 ? i : Math.max(0, length + i);
|
|
3290
|
-
for (; i < length; i++) {
|
|
3291
|
-
if (i in self && self[i] === sought) {
|
|
3292
|
-
return i;
|
|
3293
|
-
}
|
|
3294
|
-
}
|
|
3295
|
-
return -1;
|
|
3296
|
-
};
|
|
3297
|
-
}
|
|
3298
|
-
if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) {
|
|
3299
|
-
Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
|
|
3300
|
-
var self = splitString && _toString(this) == "[object String]" ?
|
|
3301
|
-
this.split("") :
|
|
3302
|
-
toObject(this),
|
|
3303
|
-
length = self.length >>> 0;
|
|
3304
|
-
|
|
3305
|
-
if (!length) {
|
|
3306
|
-
return -1;
|
|
3307
|
-
}
|
|
3308
|
-
var i = length - 1;
|
|
3309
|
-
if (arguments.length > 1) {
|
|
3310
|
-
i = Math.min(i, toInteger(arguments[1]));
|
|
3311
|
-
}
|
|
3312
|
-
i = i >= 0 ? i : length - Math.abs(i);
|
|
3313
|
-
for (; i >= 0; i--) {
|
|
3314
|
-
if (i in self && sought === self[i]) {
|
|
3315
|
-
return i;
|
|
3316
|
-
}
|
|
3317
|
-
}
|
|
3318
|
-
return -1;
|
|
3319
|
-
};
|
|
3320
|
-
}
|
|
3321
|
-
if (!Object.getPrototypeOf) {
|
|
3322
|
-
Object.getPrototypeOf = function getPrototypeOf(object) {
|
|
3323
|
-
return object.__proto__ || (
|
|
3324
|
-
object.constructor ?
|
|
3325
|
-
object.constructor.prototype :
|
|
3326
|
-
prototypeOfObject
|
|
3327
|
-
);
|
|
3328
|
-
};
|
|
3329
|
-
}
|
|
3330
|
-
if (!Object.getOwnPropertyDescriptor) {
|
|
3331
|
-
var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
|
|
3332
|
-
"non-object: ";
|
|
3333
|
-
Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
|
|
3334
|
-
if ((typeof object != "object" && typeof object != "function") || object === null)
|
|
3335
|
-
throw new TypeError(ERR_NON_OBJECT + object);
|
|
3336
|
-
if (!owns(object, property))
|
|
3337
|
-
return;
|
|
3338
|
-
|
|
3339
|
-
var descriptor, getter, setter;
|
|
3340
|
-
descriptor = { enumerable: true, configurable: true };
|
|
3341
|
-
if (supportsAccessors) {
|
|
3342
|
-
var prototype = object.__proto__;
|
|
3343
|
-
object.__proto__ = prototypeOfObject;
|
|
3344
|
-
|
|
3345
|
-
var getter = lookupGetter(object, property);
|
|
3346
|
-
var setter = lookupSetter(object, property);
|
|
3347
|
-
object.__proto__ = prototype;
|
|
3348
|
-
|
|
3349
|
-
if (getter || setter) {
|
|
3350
|
-
if (getter) descriptor.get = getter;
|
|
3351
|
-
if (setter) descriptor.set = setter;
|
|
3352
|
-
return descriptor;
|
|
3353
|
-
}
|
|
3354
|
-
}
|
|
3355
|
-
descriptor.value = object[property];
|
|
3356
|
-
return descriptor;
|
|
3357
|
-
};
|
|
3358
|
-
}
|
|
3359
|
-
if (!Object.getOwnPropertyNames) {
|
|
3360
|
-
Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
|
|
3361
|
-
return Object.keys(object);
|
|
3362
|
-
};
|
|
3363
|
-
}
|
|
3364
|
-
if (!Object.create) {
|
|
3365
|
-
var createEmpty;
|
|
3366
|
-
if (Object.prototype.__proto__ === null) {
|
|
3367
|
-
createEmpty = function () {
|
|
3368
|
-
return { "__proto__": null };
|
|
3369
|
-
};
|
|
3370
|
-
} else {
|
|
3371
|
-
createEmpty = function () {
|
|
3372
|
-
var empty = {};
|
|
3373
|
-
for (var i in empty)
|
|
3374
|
-
empty[i] = null;
|
|
3375
|
-
empty.constructor =
|
|
3376
|
-
empty.hasOwnProperty =
|
|
3377
|
-
empty.propertyIsEnumerable =
|
|
3378
|
-
empty.isPrototypeOf =
|
|
3379
|
-
empty.toLocaleString =
|
|
3380
|
-
empty.toString =
|
|
3381
|
-
empty.valueOf =
|
|
3382
|
-
empty.__proto__ = null;
|
|
3383
|
-
return empty;
|
|
3384
|
-
}
|
|
3385
|
-
}
|
|
3386
|
-
|
|
3387
|
-
Object.create = function create(prototype, properties) {
|
|
3388
|
-
var object;
|
|
3389
|
-
if (prototype === null) {
|
|
3390
|
-
object = createEmpty();
|
|
3391
|
-
} else {
|
|
3392
|
-
if (typeof prototype != "object")
|
|
3393
|
-
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
|
|
3394
|
-
var Type = function () {};
|
|
3395
|
-
Type.prototype = prototype;
|
|
3396
|
-
object = new Type();
|
|
3397
|
-
object.__proto__ = prototype;
|
|
3398
|
-
}
|
|
3399
|
-
if (properties !== void 0)
|
|
3400
|
-
Object.defineProperties(object, properties);
|
|
3401
|
-
return object;
|
|
3402
|
-
};
|
|
3403
|
-
}
|
|
3404
|
-
|
|
3405
|
-
function doesDefinePropertyWork(object) {
|
|
3406
|
-
try {
|
|
3407
|
-
Object.defineProperty(object, "sentinel", {});
|
|
3408
|
-
return "sentinel" in object;
|
|
3409
|
-
} catch (exception) {
|
|
3410
|
-
}
|
|
3411
|
-
}
|
|
3412
|
-
if (Object.defineProperty) {
|
|
3413
|
-
var definePropertyWorksOnObject = doesDefinePropertyWork({});
|
|
3414
|
-
var definePropertyWorksOnDom = typeof document == "undefined" ||
|
|
3415
|
-
doesDefinePropertyWork(document.createElement("div"));
|
|
3416
|
-
if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
|
|
3417
|
-
var definePropertyFallback = Object.defineProperty;
|
|
3418
|
-
}
|
|
3419
|
-
}
|
|
3420
|
-
|
|
3421
|
-
if (!Object.defineProperty || definePropertyFallback) {
|
|
3422
|
-
var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
|
|
3423
|
-
var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
|
|
3424
|
-
var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
|
|
3425
|
-
"on this javascript engine";
|
|
3426
|
-
|
|
3427
|
-
Object.defineProperty = function defineProperty(object, property, descriptor) {
|
|
3428
|
-
if ((typeof object != "object" && typeof object != "function") || object === null)
|
|
3429
|
-
throw new TypeError(ERR_NON_OBJECT_TARGET + object);
|
|
3430
|
-
if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
|
|
3431
|
-
throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
|
|
3432
|
-
if (definePropertyFallback) {
|
|
3433
|
-
try {
|
|
3434
|
-
return definePropertyFallback.call(Object, object, property, descriptor);
|
|
3435
|
-
} catch (exception) {
|
|
3436
|
-
}
|
|
3437
|
-
}
|
|
3438
|
-
if (owns(descriptor, "value")) {
|
|
3439
|
-
|
|
3440
|
-
if (supportsAccessors && (lookupGetter(object, property) ||
|
|
3441
|
-
lookupSetter(object, property)))
|
|
3442
|
-
{
|
|
3443
|
-
var prototype = object.__proto__;
|
|
3444
|
-
object.__proto__ = prototypeOfObject;
|
|
3445
|
-
delete object[property];
|
|
3446
|
-
object[property] = descriptor.value;
|
|
3447
|
-
object.__proto__ = prototype;
|
|
3448
|
-
} else {
|
|
3449
|
-
object[property] = descriptor.value;
|
|
3450
|
-
}
|
|
3451
|
-
} else {
|
|
3452
|
-
if (!supportsAccessors)
|
|
3453
|
-
throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
|
|
3454
|
-
if (owns(descriptor, "get"))
|
|
3455
|
-
defineGetter(object, property, descriptor.get);
|
|
3456
|
-
if (owns(descriptor, "set"))
|
|
3457
|
-
defineSetter(object, property, descriptor.set);
|
|
3458
|
-
}
|
|
3459
|
-
|
|
3460
|
-
return object;
|
|
3461
|
-
};
|
|
3462
|
-
}
|
|
3463
|
-
if (!Object.defineProperties) {
|
|
3464
|
-
Object.defineProperties = function defineProperties(object, properties) {
|
|
3465
|
-
for (var property in properties) {
|
|
3466
|
-
if (owns(properties, property))
|
|
3467
|
-
Object.defineProperty(object, property, properties[property]);
|
|
3468
|
-
}
|
|
3469
|
-
return object;
|
|
3470
|
-
};
|
|
3471
|
-
}
|
|
3472
|
-
if (!Object.seal) {
|
|
3473
|
-
Object.seal = function seal(object) {
|
|
3474
|
-
return object;
|
|
3475
|
-
};
|
|
3476
|
-
}
|
|
3477
|
-
if (!Object.freeze) {
|
|
3478
|
-
Object.freeze = function freeze(object) {
|
|
3479
|
-
return object;
|
|
3480
|
-
};
|
|
3481
|
-
}
|
|
3482
|
-
try {
|
|
3483
|
-
Object.freeze(function () {});
|
|
3484
|
-
} catch (exception) {
|
|
3485
|
-
Object.freeze = (function freeze(freezeObject) {
|
|
3486
|
-
return function freeze(object) {
|
|
3487
|
-
if (typeof object == "function") {
|
|
3488
|
-
return object;
|
|
3489
|
-
} else {
|
|
3490
|
-
return freezeObject(object);
|
|
3491
|
-
}
|
|
3492
|
-
};
|
|
3493
|
-
})(Object.freeze);
|
|
3494
|
-
}
|
|
3495
|
-
if (!Object.preventExtensions) {
|
|
3496
|
-
Object.preventExtensions = function preventExtensions(object) {
|
|
3497
|
-
return object;
|
|
3498
|
-
};
|
|
3499
|
-
}
|
|
3500
|
-
if (!Object.isSealed) {
|
|
3501
|
-
Object.isSealed = function isSealed(object) {
|
|
3502
|
-
return false;
|
|
3503
|
-
};
|
|
3504
|
-
}
|
|
3505
|
-
if (!Object.isFrozen) {
|
|
3506
|
-
Object.isFrozen = function isFrozen(object) {
|
|
3507
|
-
return false;
|
|
3508
|
-
};
|
|
3509
|
-
}
|
|
3510
|
-
if (!Object.isExtensible) {
|
|
3511
|
-
Object.isExtensible = function isExtensible(object) {
|
|
3512
|
-
if (Object(object) === object) {
|
|
3513
|
-
throw new TypeError(); // TODO message
|
|
3514
|
-
}
|
|
3515
|
-
var name = '';
|
|
3516
|
-
while (owns(object, name)) {
|
|
3517
|
-
name += '?';
|
|
3518
|
-
}
|
|
3519
|
-
object[name] = true;
|
|
3520
|
-
var returnValue = owns(object, name);
|
|
3521
|
-
delete object[name];
|
|
3522
|
-
return returnValue;
|
|
3523
|
-
};
|
|
3524
|
-
}
|
|
3525
|
-
if (!Object.keys) {
|
|
3526
|
-
var hasDontEnumBug = true,
|
|
3527
|
-
dontEnums = [
|
|
3528
|
-
"toString",
|
|
3529
|
-
"toLocaleString",
|
|
3530
|
-
"valueOf",
|
|
3531
|
-
"hasOwnProperty",
|
|
3532
|
-
"isPrototypeOf",
|
|
3533
|
-
"propertyIsEnumerable",
|
|
3534
|
-
"constructor"
|
|
3535
|
-
],
|
|
3536
|
-
dontEnumsLength = dontEnums.length;
|
|
3537
|
-
|
|
3538
|
-
for (var key in {"toString": null}) {
|
|
3539
|
-
hasDontEnumBug = false;
|
|
3540
|
-
}
|
|
3541
|
-
|
|
3542
|
-
Object.keys = function keys(object) {
|
|
3543
|
-
|
|
3544
|
-
if (
|
|
3545
|
-
(typeof object != "object" && typeof object != "function") ||
|
|
3546
|
-
object === null
|
|
3547
|
-
) {
|
|
3548
|
-
throw new TypeError("Object.keys called on a non-object");
|
|
3549
|
-
}
|
|
3550
|
-
|
|
3551
|
-
var keys = [];
|
|
3552
|
-
for (var name in object) {
|
|
3553
|
-
if (owns(object, name)) {
|
|
3554
|
-
keys.push(name);
|
|
3555
|
-
}
|
|
3556
|
-
}
|
|
3557
|
-
|
|
3558
|
-
if (hasDontEnumBug) {
|
|
3559
|
-
for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
|
|
3560
|
-
var dontEnum = dontEnums[i];
|
|
3561
|
-
if (owns(object, dontEnum)) {
|
|
3562
|
-
keys.push(dontEnum);
|
|
3563
|
-
}
|
|
3564
|
-
}
|
|
3565
|
-
}
|
|
3566
|
-
return keys;
|
|
3567
|
-
};
|
|
3568
|
-
|
|
3569
|
-
}
|
|
3570
|
-
if (!Date.now) {
|
|
3571
|
-
Date.now = function now() {
|
|
3572
|
-
return new Date().getTime();
|
|
3573
|
-
};
|
|
3574
|
-
}
|
|
3575
|
-
var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
|
|
3576
|
-
"\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
|
|
3577
|
-
"\u2029\uFEFF";
|
|
3578
|
-
if (!String.prototype.trim || ws.trim()) {
|
|
3579
|
-
ws = "[" + ws + "]";
|
|
3580
|
-
var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
|
|
3581
|
-
trimEndRegexp = new RegExp(ws + ws + "*$");
|
|
3582
|
-
String.prototype.trim = function trim() {
|
|
3583
|
-
return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
|
|
3584
|
-
};
|
|
3585
|
-
}
|
|
3586
|
-
|
|
3587
|
-
function toInteger(n) {
|
|
3588
|
-
n = +n;
|
|
3589
|
-
if (n !== n) { // isNaN
|
|
3590
|
-
n = 0;
|
|
3591
|
-
} else if (n !== 0 && n !== (1/0) && n !== -(1/0)) {
|
|
3592
|
-
n = (n > 0 || -1) * Math.floor(Math.abs(n));
|
|
3593
|
-
}
|
|
3594
|
-
return n;
|
|
3595
|
-
}
|
|
3596
|
-
|
|
3597
|
-
function isPrimitive(input) {
|
|
3598
|
-
var type = typeof input;
|
|
3599
|
-
return (
|
|
3600
|
-
input === null ||
|
|
3601
|
-
type === "undefined" ||
|
|
3602
|
-
type === "boolean" ||
|
|
3603
|
-
type === "number" ||
|
|
3604
|
-
type === "string"
|
|
3605
|
-
);
|
|
3606
|
-
}
|
|
3607
|
-
|
|
3608
|
-
function toPrimitive(input) {
|
|
3609
|
-
var val, valueOf, toString;
|
|
3610
|
-
if (isPrimitive(input)) {
|
|
3611
|
-
return input;
|
|
3612
|
-
}
|
|
3613
|
-
valueOf = input.valueOf;
|
|
3614
|
-
if (typeof valueOf === "function") {
|
|
3615
|
-
val = valueOf.call(input);
|
|
3616
|
-
if (isPrimitive(val)) {
|
|
3617
|
-
return val;
|
|
3618
|
-
}
|
|
3619
|
-
}
|
|
3620
|
-
toString = input.toString;
|
|
3621
|
-
if (typeof toString === "function") {
|
|
3622
|
-
val = toString.call(input);
|
|
3623
|
-
if (isPrimitive(val)) {
|
|
3624
|
-
return val;
|
|
3625
|
-
}
|
|
3626
|
-
}
|
|
3627
|
-
throw new TypeError();
|
|
3628
|
-
}
|
|
3629
|
-
var toObject = function (o) {
|
|
3630
|
-
if (o == null) { // this matches both null and undefined
|
|
3631
|
-
throw new TypeError("can't convert "+o+" to object");
|
|
3632
|
-
}
|
|
3633
|
-
return Object(o);
|
|
3634
|
-
};
|
|
3635
|
-
|
|
3636
|
-
});
|