administrate-field-simple_mde_markdown 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.circleci/config.yml +72 -0
- data/.circleci/setup-rubygems.sh +3 -0
- data/.gitignore +11 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +8 -0
- data/Gemfile.lock +196 -0
- data/LICENSE.txt +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/administrate-field-simple_mde_markdown.gemspec +31 -0
- data/app/assets/javascripts/administrate-field-simple_mde_markdown/application.js +6 -0
- data/app/assets/stylesheets/administrate-field-simple_mde_markdown/application.css +3 -0
- data/app/views/fields/simple_mde_markdown/_form.html.erb +6 -0
- data/app/views/fields/simple_mde_markdown/_index.html.erb +1 -0
- data/app/views/fields/simple_mde_markdown/_show.html.erb +1 -0
- data/lib/administrate/field/simple_mde_markdown.rb +31 -0
- data/node_modules/.bin/marked +1 -0
- data/node_modules/codemirror-spell-checker/.eslintrc +23 -0
- data/node_modules/codemirror-spell-checker/.npmignore +2 -0
- data/node_modules/codemirror-spell-checker/.travis.yml +18 -0
- data/node_modules/codemirror-spell-checker/CONTRIBUTING 2.md +10 -0
- data/node_modules/codemirror-spell-checker/CONTRIBUTING.md +10 -0
- data/node_modules/codemirror-spell-checker/LICENSE +22 -0
- data/node_modules/codemirror-spell-checker/README.md +50 -0
- data/node_modules/codemirror-spell-checker/bower.json +27 -0
- data/node_modules/codemirror-spell-checker/debug/.spell-checker 2.css.icloud +0 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.css +9 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.debug.js +2844 -0
- data/node_modules/codemirror-spell-checker/debug/spell-checker.js +2841 -0
- data/node_modules/codemirror-spell-checker/dist/.spell-checker.min 2.css.icloud +0 -0
- data/node_modules/codemirror-spell-checker/dist/en_US.aff +201 -0
- data/node_modules/codemirror-spell-checker/dist/en_US.dic +62120 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min 2.js +7 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min.css +7 -0
- data/node_modules/codemirror-spell-checker/dist/spell-checker.min.js +7 -0
- data/node_modules/codemirror-spell-checker/gulpfile.js +94 -0
- data/node_modules/codemirror-spell-checker/package.json +75 -0
- data/node_modules/codemirror-spell-checker/src/css/spell-checker.css +3 -0
- data/node_modules/codemirror-spell-checker/src/data/en_US.aff +201 -0
- data/node_modules/codemirror-spell-checker/src/data/en_US.dic +62120 -0
- data/node_modules/codemirror-spell-checker/src/js/spell-checker.js +119 -0
- data/node_modules/codemirror/.package 2.json.icloud +0 -0
- data/node_modules/codemirror/AUTHORS +773 -0
- data/node_modules/codemirror/CHANGELOG.md +1486 -0
- data/node_modules/codemirror/CONTRIBUTING.md +92 -0
- data/node_modules/codemirror/LICENSE +21 -0
- data/node_modules/codemirror/README.md +49 -0
- data/node_modules/codemirror/addon/comment/comment.js +209 -0
- data/node_modules/codemirror/addon/comment/continuecomment.js +78 -0
- data/node_modules/codemirror/addon/dialog/dialog.css +32 -0
- data/node_modules/codemirror/addon/dialog/dialog.js +161 -0
- data/node_modules/codemirror/addon/display/autorefresh.js +47 -0
- data/node_modules/codemirror/addon/display/fullscreen.css +6 -0
- data/node_modules/codemirror/addon/display/fullscreen.js +41 -0
- data/node_modules/codemirror/addon/display/panel.js +127 -0
- data/node_modules/codemirror/addon/display/placeholder.js +63 -0
- data/node_modules/codemirror/addon/display/rulers.js +51 -0
- data/node_modules/codemirror/addon/edit/closebrackets.js +187 -0
- data/node_modules/codemirror/addon/edit/closetag.js +175 -0
- data/node_modules/codemirror/addon/edit/continuelist.js +89 -0
- data/node_modules/codemirror/addon/edit/matchbrackets.js +145 -0
- data/node_modules/codemirror/addon/edit/matchtags.js +66 -0
- data/node_modules/codemirror/addon/edit/trailingspace.js +27 -0
- data/node_modules/codemirror/addon/fold/brace-fold.js +105 -0
- data/node_modules/codemirror/addon/fold/comment-fold.js +59 -0
- data/node_modules/codemirror/addon/fold/foldcode.js +152 -0
- data/node_modules/codemirror/addon/fold/foldgutter.css +20 -0
- data/node_modules/codemirror/addon/fold/foldgutter.js +146 -0
- data/node_modules/codemirror/addon/fold/indent-fold.js +48 -0
- data/node_modules/codemirror/addon/fold/markdown-fold.js +49 -0
- data/node_modules/codemirror/addon/fold/xml-fold.js +184 -0
- data/node_modules/codemirror/addon/hint/anyword-hint.js +41 -0
- data/node_modules/codemirror/addon/hint/css-hint.js +60 -0
- data/node_modules/codemirror/addon/hint/html-hint.js +348 -0
- data/node_modules/codemirror/addon/hint/javascript-hint.js +157 -0
- data/node_modules/codemirror/addon/hint/show-hint.css +36 -0
- data/node_modules/codemirror/addon/hint/show-hint.js +434 -0
- data/node_modules/codemirror/addon/hint/sql-hint.js +299 -0
- data/node_modules/codemirror/addon/hint/xml-hint.js +110 -0
- data/node_modules/codemirror/addon/lint/coffeescript-lint.js +47 -0
- data/node_modules/codemirror/addon/lint/css-lint.js +40 -0
- data/node_modules/codemirror/addon/lint/html-lint.js +53 -0
- data/node_modules/codemirror/addon/lint/javascript-lint.js +63 -0
- data/node_modules/codemirror/addon/lint/json-lint.js +40 -0
- data/node_modules/codemirror/addon/lint/lint.css +73 -0
- data/node_modules/codemirror/addon/lint/lint.js +252 -0
- data/node_modules/codemirror/addon/lint/yaml-lint.js +41 -0
- data/node_modules/codemirror/addon/merge/merge.css +119 -0
- data/node_modules/codemirror/addon/merge/merge.js +1002 -0
- data/node_modules/codemirror/addon/mode/loadmode.js +64 -0
- data/node_modules/codemirror/addon/mode/multiplex.js +131 -0
- data/node_modules/codemirror/addon/mode/multiplex_test.js +33 -0
- data/node_modules/codemirror/addon/mode/overlay.js +90 -0
- data/node_modules/codemirror/addon/mode/simple.js +216 -0
- data/node_modules/codemirror/addon/runmode/colorize.js +40 -0
- data/node_modules/codemirror/addon/runmode/runmode-standalone.js +158 -0
- data/node_modules/codemirror/addon/runmode/runmode.js +72 -0
- data/node_modules/codemirror/addon/runmode/runmode.node.js +197 -0
- data/node_modules/codemirror/addon/scroll/annotatescrollbar.js +122 -0
- data/node_modules/codemirror/addon/scroll/scrollpastend.js +48 -0
- data/node_modules/codemirror/addon/scroll/simplescrollbars.css +66 -0
- data/node_modules/codemirror/addon/scroll/simplescrollbars.js +152 -0
- data/node_modules/codemirror/addon/search/jump-to-line.js +50 -0
- data/node_modules/codemirror/addon/search/match-highlighter.js +165 -0
- data/node_modules/codemirror/addon/search/matchesonscrollbar.css +8 -0
- data/node_modules/codemirror/addon/search/matchesonscrollbar.js +97 -0
- data/node_modules/codemirror/addon/search/search.js +258 -0
- data/node_modules/codemirror/addon/search/searchcursor.js +293 -0
- data/node_modules/codemirror/addon/selection/active-line.js +72 -0
- data/node_modules/codemirror/addon/selection/mark-selection.js +119 -0
- data/node_modules/codemirror/addon/selection/selection-pointer.js +98 -0
- data/node_modules/codemirror/addon/tern/tern.css +87 -0
- data/node_modules/codemirror/addon/tern/tern.js +718 -0
- data/node_modules/codemirror/addon/tern/worker.js +44 -0
- data/node_modules/codemirror/addon/wrap/hardwrap.js +145 -0
- data/node_modules/codemirror/bin/source-highlight +48 -0
- data/node_modules/codemirror/keymap/emacs.js +417 -0
- data/node_modules/codemirror/keymap/sublime.js +691 -0
- data/node_modules/codemirror/keymap/vim.js +5467 -0
- data/node_modules/codemirror/lib/codemirror.css +346 -0
- data/node_modules/codemirror/lib/codemirror.js +9698 -0
- data/node_modules/codemirror/mode/apl/apl.js +174 -0
- data/node_modules/codemirror/mode/asciiarmor/asciiarmor.js +74 -0
- data/node_modules/codemirror/mode/asn.1/asn.1.js +204 -0
- data/node_modules/codemirror/mode/asterisk/asterisk.js +196 -0
- data/node_modules/codemirror/mode/brainfuck/brainfuck.js +85 -0
- data/node_modules/codemirror/mode/clike/clike.js +879 -0
- data/node_modules/codemirror/mode/clojure/clojure.js +292 -0
- data/node_modules/codemirror/mode/cmake/cmake.js +97 -0
- data/node_modules/codemirror/mode/cobol/cobol.js +255 -0
- data/node_modules/codemirror/mode/coffeescript/coffeescript.js +359 -0
- data/node_modules/codemirror/mode/commonlisp/commonlisp.js +124 -0
- data/node_modules/codemirror/mode/crystal/crystal.js +433 -0
- data/node_modules/codemirror/mode/css/css.js +832 -0
- data/node_modules/codemirror/mode/cypher/cypher.js +150 -0
- data/node_modules/codemirror/mode/d/d.js +223 -0
- data/node_modules/codemirror/mode/dart/dart.js +157 -0
- data/node_modules/codemirror/mode/diff/diff.js +47 -0
- data/node_modules/codemirror/mode/django/django.js +356 -0
- data/node_modules/codemirror/mode/dockerfile/dockerfile.js +211 -0
- data/node_modules/codemirror/mode/dtd/dtd.js +142 -0
- data/node_modules/codemirror/mode/dylan/dylan.js +352 -0
- data/node_modules/codemirror/mode/ebnf/ebnf.js +195 -0
- data/node_modules/codemirror/mode/ecl/ecl.js +206 -0
- data/node_modules/codemirror/mode/eiffel/eiffel.js +160 -0
- data/node_modules/codemirror/mode/elm/elm.js +205 -0
- data/node_modules/codemirror/mode/erlang/erlang.js +619 -0
- data/node_modules/codemirror/mode/factor/factor.js +85 -0
- data/node_modules/codemirror/mode/fcl/fcl.js +173 -0
- data/node_modules/codemirror/mode/forth/forth.js +180 -0
- data/node_modules/codemirror/mode/fortran/fortran.js +188 -0
- data/node_modules/codemirror/mode/gas/gas.js +345 -0
- data/node_modules/codemirror/mode/gfm/gfm.js +129 -0
- data/node_modules/codemirror/mode/gherkin/gherkin.js +178 -0
- data/node_modules/codemirror/mode/go/go.js +187 -0
- data/node_modules/codemirror/mode/groovy/groovy.js +230 -0
- data/node_modules/codemirror/mode/haml/haml.js +161 -0
- data/node_modules/codemirror/mode/handlebars/handlebars.js +66 -0
- data/node_modules/codemirror/mode/haskell-literate/haskell-literate.js +43 -0
- data/node_modules/codemirror/mode/haskell/haskell.js +268 -0
- data/node_modules/codemirror/mode/haxe/haxe.js +515 -0
- data/node_modules/codemirror/mode/htmlembedded/htmlembedded.js +37 -0
- data/node_modules/codemirror/mode/htmlmixed/htmlmixed.js +152 -0
- data/node_modules/codemirror/mode/http/http.js +113 -0
- data/node_modules/codemirror/mode/idl/idl.js +290 -0
- data/node_modules/codemirror/mode/javascript/javascript.js +899 -0
- data/node_modules/codemirror/mode/jinja2/jinja2.js +144 -0
- data/node_modules/codemirror/mode/jsx/jsx.js +148 -0
- data/node_modules/codemirror/mode/julia/julia.js +433 -0
- data/node_modules/codemirror/mode/livescript/livescript.js +280 -0
- data/node_modules/codemirror/mode/lua/lua.js +159 -0
- data/node_modules/codemirror/mode/markdown/markdown.js +884 -0
- data/node_modules/codemirror/mode/mathematica/mathematica.js +176 -0
- data/node_modules/codemirror/mode/mbox/mbox.js +129 -0
- data/node_modules/codemirror/mode/meta.js +217 -0
- data/node_modules/codemirror/mode/mirc/mirc.js +193 -0
- data/node_modules/codemirror/mode/mllike/mllike.js +359 -0
- data/node_modules/codemirror/mode/modelica/modelica.js +245 -0
- data/node_modules/codemirror/mode/mscgen/mscgen.js +175 -0
- data/node_modules/codemirror/mode/mumps/mumps.js +148 -0
- data/node_modules/codemirror/mode/nginx/nginx.js +178 -0
- data/node_modules/codemirror/mode/nsis/nsis.js +95 -0
- data/node_modules/codemirror/mode/ntriples/ntriples.js +195 -0
- data/node_modules/codemirror/mode/octave/octave.js +139 -0
- data/node_modules/codemirror/mode/oz/oz.js +252 -0
- data/node_modules/codemirror/mode/pascal/pascal.js +121 -0
- data/node_modules/codemirror/mode/pegjs/pegjs.js +114 -0
- data/node_modules/codemirror/mode/perl/perl.js +837 -0
- data/node_modules/codemirror/mode/php/php.js +234 -0
- data/node_modules/codemirror/mode/pig/pig.js +178 -0
- data/node_modules/codemirror/mode/powershell/powershell.js +398 -0
- data/node_modules/codemirror/mode/properties/properties 2.js +78 -0
- data/node_modules/codemirror/mode/properties/properties.js +78 -0
- data/node_modules/codemirror/mode/protobuf/protobuf.js +69 -0
- data/node_modules/codemirror/mode/pug/pug.js +591 -0
- data/node_modules/codemirror/mode/puppet/puppet.js +220 -0
- data/node_modules/codemirror/mode/python/python.js +409 -0
- data/node_modules/codemirror/mode/q/q.js +139 -0
- data/node_modules/codemirror/mode/r/r.js +190 -0
- data/node_modules/codemirror/mode/rpm/changes/index.html +66 -0
- data/node_modules/codemirror/mode/rpm/rpm.js +109 -0
- data/node_modules/codemirror/mode/rst/rst.js +557 -0
- data/node_modules/codemirror/mode/ruby/ruby.js +296 -0
- data/node_modules/codemirror/mode/rust/rust.js +72 -0
- data/node_modules/codemirror/mode/sas/sas.js +303 -0
- data/node_modules/codemirror/mode/sass/sass.js +454 -0
- data/node_modules/codemirror/mode/scheme/scheme.js +265 -0
- data/node_modules/codemirror/mode/shell/shell.js +152 -0
- data/node_modules/codemirror/mode/sieve/sieve.js +193 -0
- data/node_modules/codemirror/mode/slim/slim.js +575 -0
- data/node_modules/codemirror/mode/smalltalk/smalltalk.js +168 -0
- data/node_modules/codemirror/mode/smarty/smarty.js +225 -0
- data/node_modules/codemirror/mode/solr/solr.js +104 -0
- data/node_modules/codemirror/mode/soy/soy 2.js +359 -0
- data/node_modules/codemirror/mode/soy/soy.js +235 -0
- data/node_modules/codemirror/mode/sparql/sparql.js +180 -0
- data/node_modules/codemirror/mode/spreadsheet/spreadsheet.js +112 -0
- data/node_modules/codemirror/mode/sql/sql.js +499 -0
- data/node_modules/codemirror/mode/stex/stex.js +264 -0
- data/node_modules/codemirror/mode/stylus/stylus.js +771 -0
- data/node_modules/codemirror/mode/swift/swift.js +219 -0
- data/node_modules/codemirror/mode/tcl/tcl.js +139 -0
- data/node_modules/codemirror/mode/textile/textile.js +469 -0
- data/node_modules/codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/node_modules/codemirror/mode/tiddlywiki/tiddlywiki.js +308 -0
- data/node_modules/codemirror/mode/tiki/tiki.css +26 -0
- data/node_modules/codemirror/mode/tiki/tiki.js +312 -0
- data/node_modules/codemirror/mode/toml/toml.js +88 -0
- data/node_modules/codemirror/mode/tornado/tornado.js +68 -0
- data/node_modules/codemirror/mode/troff/troff.js +84 -0
- data/node_modules/codemirror/mode/ttcn-cfg/ttcn-cfg.js +214 -0
- data/node_modules/codemirror/mode/ttcn/ttcn.js +283 -0
- data/node_modules/codemirror/mode/turtle/turtle.js +162 -0
- data/node_modules/codemirror/mode/twig/twig.js +141 -0
- data/node_modules/codemirror/mode/vb/vb.js +275 -0
- data/node_modules/codemirror/mode/vbscript/vbscript.js +350 -0
- data/node_modules/codemirror/mode/velocity/velocity.js +201 -0
- data/node_modules/codemirror/mode/verilog/verilog.js +675 -0
- data/node_modules/codemirror/mode/vhdl/vhdl.js +189 -0
- data/node_modules/codemirror/mode/vue/vue.js +77 -0
- data/node_modules/codemirror/mode/webidl/webidl.js +195 -0
- data/node_modules/codemirror/mode/xml/xml.js +402 -0
- data/node_modules/codemirror/mode/xquery/xquery.js +448 -0
- data/node_modules/codemirror/mode/yacas/yacas.js +204 -0
- data/node_modules/codemirror/mode/yaml-frontmatter/yaml-frontmatter.js +68 -0
- data/node_modules/codemirror/mode/yaml/yaml.js +120 -0
- data/node_modules/codemirror/mode/z80/z80.js +116 -0
- data/node_modules/codemirror/package.json +2395 -0
- data/node_modules/codemirror/rollup.config.js +20 -0
- data/node_modules/codemirror/src/codemirror.js +3 -0
- data/node_modules/codemirror/src/display/Display.js +106 -0
- data/node_modules/codemirror/src/display/focus.js +47 -0
- data/node_modules/codemirror/src/display/gutters.js +34 -0
- data/node_modules/codemirror/src/display/highlight_worker.js +55 -0
- data/node_modules/codemirror/src/display/line_numbers.js +48 -0
- data/node_modules/codemirror/src/display/mode_state.js +22 -0
- data/node_modules/codemirror/src/display/operations.js +205 -0
- data/node_modules/codemirror/src/display/scroll_events.js +115 -0
- data/node_modules/codemirror/src/display/scrollbars.js +193 -0
- data/node_modules/codemirror/src/display/scrolling.js +184 -0
- data/node_modules/codemirror/src/display/selection.js +158 -0
- data/node_modules/codemirror/src/display/update_display.js +260 -0
- data/node_modules/codemirror/src/display/update_line.js +188 -0
- data/node_modules/codemirror/src/display/update_lines.js +64 -0
- data/node_modules/codemirror/src/display/view_tracking.js +153 -0
- data/node_modules/codemirror/src/edit/CodeMirror.js +215 -0
- data/node_modules/codemirror/src/edit/commands.js +178 -0
- data/node_modules/codemirror/src/edit/deleteNearSelection.js +30 -0
- data/node_modules/codemirror/src/edit/drop_events.js +119 -0
- data/node_modules/codemirror/src/edit/fromTextArea.js +61 -0
- data/node_modules/codemirror/src/edit/global_events.js +42 -0
- data/node_modules/codemirror/src/edit/key_events.js +159 -0
- data/node_modules/codemirror/src/edit/legacy.js +62 -0
- data/node_modules/codemirror/src/edit/main.js +69 -0
- data/node_modules/codemirror/src/edit/methods.js +544 -0
- data/node_modules/codemirror/src/edit/mouse_events.js +407 -0
- data/node_modules/codemirror/src/edit/options.js +193 -0
- data/node_modules/codemirror/src/edit/utils.js +7 -0
- data/node_modules/codemirror/src/input/ContentEditableInput.js +527 -0
- data/node_modules/codemirror/src/input/TextareaInput.js +355 -0
- data/node_modules/codemirror/src/input/indent.js +71 -0
- data/node_modules/codemirror/src/input/input.js +135 -0
- data/node_modules/codemirror/src/input/keymap.js +148 -0
- data/node_modules/codemirror/src/input/keynames.js +17 -0
- data/node_modules/codemirror/src/input/movement.js +110 -0
- data/node_modules/codemirror/src/line/highlight.js +284 -0
- data/node_modules/codemirror/src/line/line_data.js +339 -0
- data/node_modules/codemirror/src/line/pos.js +40 -0
- data/node_modules/codemirror/src/line/saw_special_spans.js +10 -0
- data/node_modules/codemirror/src/line/spans.js +382 -0
- data/node_modules/codemirror/src/line/utils_line.js +85 -0
- data/node_modules/codemirror/src/measurement/position_measurement.js +699 -0
- data/node_modules/codemirror/src/measurement/widgets.js +26 -0
- data/node_modules/codemirror/src/model/Doc.js +432 -0
- data/node_modules/codemirror/src/model/change_measurement.js +61 -0
- data/node_modules/codemirror/src/model/changes.js +333 -0
- data/node_modules/codemirror/src/model/chunk.js +167 -0
- data/node_modules/codemirror/src/model/document_data.js +111 -0
- data/node_modules/codemirror/src/model/history.js +228 -0
- data/node_modules/codemirror/src/model/line_widget.js +78 -0
- data/node_modules/codemirror/src/model/mark_text.js +292 -0
- data/node_modules/codemirror/src/model/selection.js +84 -0
- data/node_modules/codemirror/src/model/selection_updates.js +208 -0
- data/node_modules/codemirror/src/modes.js +96 -0
- data/node_modules/codemirror/src/util/StringStream.js +90 -0
- data/node_modules/codemirror/src/util/bidi.js +214 -0
- data/node_modules/codemirror/src/util/browser.js +33 -0
- data/node_modules/codemirror/src/util/dom.js +97 -0
- data/node_modules/codemirror/src/util/event.js +103 -0
- data/node_modules/codemirror/src/util/feature_detection.js +84 -0
- data/node_modules/codemirror/src/util/misc.js +150 -0
- data/node_modules/codemirror/src/util/operation_group.js +72 -0
- data/node_modules/codemirror/theme/3024-day.css +41 -0
- data/node_modules/codemirror/theme/3024-night.css +39 -0
- data/node_modules/codemirror/theme/abcdef.css +32 -0
- data/node_modules/codemirror/theme/ambiance-mobile.css +5 -0
- data/node_modules/codemirror/theme/ambiance.css +74 -0
- data/node_modules/codemirror/theme/base16-dark.css +38 -0
- data/node_modules/codemirror/theme/base16-light.css +38 -0
- data/node_modules/codemirror/theme/bespin.css +34 -0
- data/node_modules/codemirror/theme/blackboard.css +32 -0
- data/node_modules/codemirror/theme/cobalt.css +25 -0
- data/node_modules/codemirror/theme/colorforth.css +33 -0
- data/node_modules/codemirror/theme/darcula.css +46 -0
- data/node_modules/codemirror/theme/dracula.css +40 -0
- data/node_modules/codemirror/theme/duotone-dark.css +35 -0
- data/node_modules/codemirror/theme/duotone-light.css +36 -0
- data/node_modules/codemirror/theme/eclipse.css +23 -0
- data/node_modules/codemirror/theme/elegant.css +13 -0
- data/node_modules/codemirror/theme/erlang-dark.css +34 -0
- data/node_modules/codemirror/theme/gruvbox-dark.css +37 -0
- data/node_modules/codemirror/theme/hopscotch.css +34 -0
- data/node_modules/codemirror/theme/icecoder.css +43 -0
- data/node_modules/codemirror/theme/idea.css +42 -0
- data/node_modules/codemirror/theme/isotope.css +34 -0
- data/node_modules/codemirror/theme/lesser-dark.css +47 -0
- data/node_modules/codemirror/theme/liquibyte.css +95 -0
- data/node_modules/codemirror/theme/lucario.css +37 -0
- data/node_modules/codemirror/theme/material.css +53 -0
- data/node_modules/codemirror/theme/mbo.css +37 -0
- data/node_modules/codemirror/theme/mdn-like.css +46 -0
- data/node_modules/codemirror/theme/midnight.css +43 -0
- data/node_modules/codemirror/theme/monokai.css +41 -0
- data/node_modules/codemirror/theme/neat.css +12 -0
- data/node_modules/codemirror/theme/neo.css +43 -0
- data/node_modules/codemirror/theme/night.css +27 -0
- data/node_modules/codemirror/theme/oceanic-next.css +44 -0
- data/node_modules/codemirror/theme/panda-syntax.css +85 -0
- data/node_modules/codemirror/theme/paraiso-dark.css +38 -0
- data/node_modules/codemirror/theme/paraiso-light.css +38 -0
- data/node_modules/codemirror/theme/pastel-on-dark.css +52 -0
- data/node_modules/codemirror/theme/railscasts.css +34 -0
- data/node_modules/codemirror/theme/rubyblue.css +25 -0
- data/node_modules/codemirror/theme/seti.css +44 -0
- data/node_modules/codemirror/theme/shadowfox.css +52 -0
- data/node_modules/codemirror/theme/solarized.css +168 -0
- data/node_modules/codemirror/theme/ssms.css +16 -0
- data/node_modules/codemirror/theme/the-matrix.css +30 -0
- data/node_modules/codemirror/theme/tomorrow-night-bright.css +35 -0
- data/node_modules/codemirror/theme/tomorrow-night-eighties.css +38 -0
- data/node_modules/codemirror/theme/ttcn.css +64 -0
- data/node_modules/codemirror/theme/twilight.css +32 -0
- data/node_modules/codemirror/theme/vibrant-ink.css +34 -0
- data/node_modules/codemirror/theme/xq-dark.css +53 -0
- data/node_modules/codemirror/theme/xq-light.css +43 -0
- data/node_modules/codemirror/theme/yeti.css +44 -0
- data/node_modules/codemirror/theme/zenburn.css +37 -0
- data/node_modules/marked/.editorconfig +16 -0
- data/node_modules/marked/.eslintignore +1 -0
- data/node_modules/marked/.eslintrc.json +28 -0
- data/node_modules/marked/.package 2.json.icloud +0 -0
- data/node_modules/marked/.travis.yml +47 -0
- data/node_modules/marked/Makefile +15 -0
- data/node_modules/marked/Makefile 2 +15 -0
- data/node_modules/marked/README 2.md +75 -0
- data/node_modules/marked/README.md +75 -0
- data/node_modules/marked/bin/marked +199 -0
- data/node_modules/marked/bower.json +23 -0
- data/node_modules/marked/component.json +10 -0
- data/node_modules/marked/index.js +1 -0
- data/node_modules/marked/jasmine.json +11 -0
- data/node_modules/marked/lib/marked 2.js +1604 -0
- data/node_modules/marked/lib/marked.js +1604 -0
- data/node_modules/marked/man/marked.1 +91 -0
- data/node_modules/marked/man/marked.1.txt +96 -0
- data/node_modules/marked/marked.min.js +6 -0
- data/node_modules/marked/package.json +95 -0
- data/node_modules/simplemde/.eslintrc +23 -0
- data/node_modules/simplemde/.npmignore +9 -0
- data/node_modules/simplemde/.travis.yml +18 -0
- data/node_modules/simplemde/CONTRIBUTING 2.md +10 -0
- data/node_modules/simplemde/CONTRIBUTING.md +10 -0
- data/node_modules/simplemde/LICENSE +22 -0
- data/node_modules/simplemde/README.md +331 -0
- data/node_modules/simplemde/bower.json +23 -0
- data/node_modules/simplemde/debug/.simplemde 2.css.icloud +0 -0
- data/node_modules/simplemde/debug/simplemde.css +676 -0
- data/node_modules/simplemde/debug/simplemde.debug.js +17023 -0
- data/node_modules/simplemde/debug/simplemde.js +17019 -0
- data/node_modules/simplemde/dist/simplemde.min.css +7 -0
- data/node_modules/simplemde/dist/simplemde.min.js +15 -0
- data/node_modules/simplemde/gulpfile.js +96 -0
- data/node_modules/simplemde/package.json +73 -0
- data/node_modules/simplemde/src/css/simplemde.css +328 -0
- data/node_modules/simplemde/src/js/codemirror/tablist 2.js +44 -0
- data/node_modules/simplemde/src/js/codemirror/tablist.js +44 -0
- data/node_modules/simplemde/src/js/simplemde.js +2028 -0
- data/node_modules/typo-js/README.md +45 -0
- data/node_modules/typo-js/dictionaries/en_US/.en_US 2.dic.icloud +0 -0
- data/node_modules/typo-js/dictionaries/en_US/README.md +7 -0
- data/node_modules/typo-js/dictionaries/en_US/en_US.aff +201 -0
- data/node_modules/typo-js/dictionaries/en_US/en_US.dic +62120 -0
- data/node_modules/typo-js/package.json +56 -0
- data/node_modules/typo-js/typo.js +931 -0
- data/package-lock.json +40 -0
- data/package.json +7 -0
- metadata +557 -0
@@ -0,0 +1,899 @@
|
|
1
|
+
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2
|
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3
|
+
|
4
|
+
(function(mod) {
|
5
|
+
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
6
|
+
mod(require("../../lib/codemirror"));
|
7
|
+
else if (typeof define == "function" && define.amd) // AMD
|
8
|
+
define(["../../lib/codemirror"], mod);
|
9
|
+
else // Plain browser env
|
10
|
+
mod(CodeMirror);
|
11
|
+
})(function(CodeMirror) {
|
12
|
+
"use strict";
|
13
|
+
|
14
|
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
15
|
+
var indentUnit = config.indentUnit;
|
16
|
+
var statementIndent = parserConfig.statementIndent;
|
17
|
+
var jsonldMode = parserConfig.jsonld;
|
18
|
+
var jsonMode = parserConfig.json || jsonldMode;
|
19
|
+
var isTS = parserConfig.typescript;
|
20
|
+
var wordRE = parserConfig.wordCharacters || /[\w$\xa1-\uffff]/;
|
21
|
+
|
22
|
+
// Tokenizer
|
23
|
+
|
24
|
+
var keywords = function(){
|
25
|
+
function kw(type) {return {type: type, style: "keyword"};}
|
26
|
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c"), D = kw("keyword d");
|
27
|
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
28
|
+
|
29
|
+
return {
|
30
|
+
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
31
|
+
"return": D, "break": D, "continue": D, "new": kw("new"), "delete": C, "void": C, "throw": C,
|
32
|
+
"debugger": kw("debugger"), "var": kw("var"), "const": kw("var"), "let": kw("var"),
|
33
|
+
"function": kw("function"), "catch": kw("catch"),
|
34
|
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
35
|
+
"in": operator, "typeof": operator, "instanceof": operator,
|
36
|
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
37
|
+
"this": kw("this"), "class": kw("class"), "super": kw("atom"),
|
38
|
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C,
|
39
|
+
"await": C
|
40
|
+
};
|
41
|
+
}();
|
42
|
+
|
43
|
+
var isOperatorChar = /[+\-*&%=<>!?|~^@]/;
|
44
|
+
var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/;
|
45
|
+
|
46
|
+
function readRegexp(stream) {
|
47
|
+
var escaped = false, next, inSet = false;
|
48
|
+
while ((next = stream.next()) != null) {
|
49
|
+
if (!escaped) {
|
50
|
+
if (next == "/" && !inSet) return;
|
51
|
+
if (next == "[") inSet = true;
|
52
|
+
else if (inSet && next == "]") inSet = false;
|
53
|
+
}
|
54
|
+
escaped = !escaped && next == "\\";
|
55
|
+
}
|
56
|
+
}
|
57
|
+
|
58
|
+
// Used as scratch variables to communicate multiple values without
|
59
|
+
// consing up tons of objects.
|
60
|
+
var type, content;
|
61
|
+
function ret(tp, style, cont) {
|
62
|
+
type = tp; content = cont;
|
63
|
+
return style;
|
64
|
+
}
|
65
|
+
function tokenBase(stream, state) {
|
66
|
+
var ch = stream.next();
|
67
|
+
if (ch == '"' || ch == "'") {
|
68
|
+
state.tokenize = tokenString(ch);
|
69
|
+
return state.tokenize(stream, state);
|
70
|
+
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
71
|
+
return ret("number", "number");
|
72
|
+
} else if (ch == "." && stream.match("..")) {
|
73
|
+
return ret("spread", "meta");
|
74
|
+
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
75
|
+
return ret(ch);
|
76
|
+
} else if (ch == "=" && stream.eat(">")) {
|
77
|
+
return ret("=>", "operator");
|
78
|
+
} else if (ch == "0" && stream.match(/^(?:x[\da-f]+|o[0-7]+|b[01]+)n?/i)) {
|
79
|
+
return ret("number", "number");
|
80
|
+
} else if (/\d/.test(ch)) {
|
81
|
+
stream.match(/^\d*(?:n|(?:\.\d*)?(?:[eE][+\-]?\d+)?)?/);
|
82
|
+
return ret("number", "number");
|
83
|
+
} else if (ch == "/") {
|
84
|
+
if (stream.eat("*")) {
|
85
|
+
state.tokenize = tokenComment;
|
86
|
+
return tokenComment(stream, state);
|
87
|
+
} else if (stream.eat("/")) {
|
88
|
+
stream.skipToEnd();
|
89
|
+
return ret("comment", "comment");
|
90
|
+
} else if (expressionAllowed(stream, state, 1)) {
|
91
|
+
readRegexp(stream);
|
92
|
+
stream.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/);
|
93
|
+
return ret("regexp", "string-2");
|
94
|
+
} else {
|
95
|
+
stream.eat("=");
|
96
|
+
return ret("operator", "operator", stream.current());
|
97
|
+
}
|
98
|
+
} else if (ch == "`") {
|
99
|
+
state.tokenize = tokenQuasi;
|
100
|
+
return tokenQuasi(stream, state);
|
101
|
+
} else if (ch == "#") {
|
102
|
+
stream.skipToEnd();
|
103
|
+
return ret("error", "error");
|
104
|
+
} else if (isOperatorChar.test(ch)) {
|
105
|
+
if (ch != ">" || !state.lexical || state.lexical.type != ">") {
|
106
|
+
if (stream.eat("=")) {
|
107
|
+
if (ch == "!" || ch == "=") stream.eat("=")
|
108
|
+
} else if (/[<>*+\-]/.test(ch)) {
|
109
|
+
stream.eat(ch)
|
110
|
+
if (ch == ">") stream.eat(ch)
|
111
|
+
}
|
112
|
+
}
|
113
|
+
return ret("operator", "operator", stream.current());
|
114
|
+
} else if (wordRE.test(ch)) {
|
115
|
+
stream.eatWhile(wordRE);
|
116
|
+
var word = stream.current()
|
117
|
+
if (state.lastType != ".") {
|
118
|
+
if (keywords.propertyIsEnumerable(word)) {
|
119
|
+
var kw = keywords[word]
|
120
|
+
return ret(kw.type, kw.style, word)
|
121
|
+
}
|
122
|
+
if (word == "async" && stream.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/, false))
|
123
|
+
return ret("async", "keyword", word)
|
124
|
+
}
|
125
|
+
return ret("variable", "variable", word)
|
126
|
+
}
|
127
|
+
}
|
128
|
+
|
129
|
+
function tokenString(quote) {
|
130
|
+
return function(stream, state) {
|
131
|
+
var escaped = false, next;
|
132
|
+
if (jsonldMode && stream.peek() == "@" && stream.match(isJsonldKeyword)){
|
133
|
+
state.tokenize = tokenBase;
|
134
|
+
return ret("jsonld-keyword", "meta");
|
135
|
+
}
|
136
|
+
while ((next = stream.next()) != null) {
|
137
|
+
if (next == quote && !escaped) break;
|
138
|
+
escaped = !escaped && next == "\\";
|
139
|
+
}
|
140
|
+
if (!escaped) state.tokenize = tokenBase;
|
141
|
+
return ret("string", "string");
|
142
|
+
};
|
143
|
+
}
|
144
|
+
|
145
|
+
function tokenComment(stream, state) {
|
146
|
+
var maybeEnd = false, ch;
|
147
|
+
while (ch = stream.next()) {
|
148
|
+
if (ch == "/" && maybeEnd) {
|
149
|
+
state.tokenize = tokenBase;
|
150
|
+
break;
|
151
|
+
}
|
152
|
+
maybeEnd = (ch == "*");
|
153
|
+
}
|
154
|
+
return ret("comment", "comment");
|
155
|
+
}
|
156
|
+
|
157
|
+
function tokenQuasi(stream, state) {
|
158
|
+
var escaped = false, next;
|
159
|
+
while ((next = stream.next()) != null) {
|
160
|
+
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
161
|
+
state.tokenize = tokenBase;
|
162
|
+
break;
|
163
|
+
}
|
164
|
+
escaped = !escaped && next == "\\";
|
165
|
+
}
|
166
|
+
return ret("quasi", "string-2", stream.current());
|
167
|
+
}
|
168
|
+
|
169
|
+
var brackets = "([{}])";
|
170
|
+
// This is a crude lookahead trick to try and notice that we're
|
171
|
+
// parsing the argument patterns for a fat-arrow function before we
|
172
|
+
// actually hit the arrow token. It only works if the arrow is on
|
173
|
+
// the same line as the arguments and there's no strange noise
|
174
|
+
// (comments) in between. Fallback is to only notice when we hit the
|
175
|
+
// arrow, and not declare the arguments as locals for the arrow
|
176
|
+
// body.
|
177
|
+
function findFatArrow(stream, state) {
|
178
|
+
if (state.fatArrowAt) state.fatArrowAt = null;
|
179
|
+
var arrow = stream.string.indexOf("=>", stream.start);
|
180
|
+
if (arrow < 0) return;
|
181
|
+
|
182
|
+
if (isTS) { // Try to skip TypeScript return type declarations after the arguments
|
183
|
+
var m = /:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(stream.string.slice(stream.start, arrow))
|
184
|
+
if (m) arrow = m.index
|
185
|
+
}
|
186
|
+
|
187
|
+
var depth = 0, sawSomething = false;
|
188
|
+
for (var pos = arrow - 1; pos >= 0; --pos) {
|
189
|
+
var ch = stream.string.charAt(pos);
|
190
|
+
var bracket = brackets.indexOf(ch);
|
191
|
+
if (bracket >= 0 && bracket < 3) {
|
192
|
+
if (!depth) { ++pos; break; }
|
193
|
+
if (--depth == 0) { if (ch == "(") sawSomething = true; break; }
|
194
|
+
} else if (bracket >= 3 && bracket < 6) {
|
195
|
+
++depth;
|
196
|
+
} else if (wordRE.test(ch)) {
|
197
|
+
sawSomething = true;
|
198
|
+
} else if (/["'\/]/.test(ch)) {
|
199
|
+
return;
|
200
|
+
} else if (sawSomething && !depth) {
|
201
|
+
++pos;
|
202
|
+
break;
|
203
|
+
}
|
204
|
+
}
|
205
|
+
if (sawSomething && !depth) state.fatArrowAt = pos;
|
206
|
+
}
|
207
|
+
|
208
|
+
// Parser
|
209
|
+
|
210
|
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true, "jsonld-keyword": true};
|
211
|
+
|
212
|
+
function JSLexical(indented, column, type, align, prev, info) {
|
213
|
+
this.indented = indented;
|
214
|
+
this.column = column;
|
215
|
+
this.type = type;
|
216
|
+
this.prev = prev;
|
217
|
+
this.info = info;
|
218
|
+
if (align != null) this.align = align;
|
219
|
+
}
|
220
|
+
|
221
|
+
function inScope(state, varname) {
|
222
|
+
for (var v = state.localVars; v; v = v.next)
|
223
|
+
if (v.name == varname) return true;
|
224
|
+
for (var cx = state.context; cx; cx = cx.prev) {
|
225
|
+
for (var v = cx.vars; v; v = v.next)
|
226
|
+
if (v.name == varname) return true;
|
227
|
+
}
|
228
|
+
}
|
229
|
+
|
230
|
+
function parseJS(state, style, type, content, stream) {
|
231
|
+
var cc = state.cc;
|
232
|
+
// Communicate our context to the combinators.
|
233
|
+
// (Less wasteful than consing up a hundred closures on every call.)
|
234
|
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;
|
235
|
+
|
236
|
+
if (!state.lexical.hasOwnProperty("align"))
|
237
|
+
state.lexical.align = true;
|
238
|
+
|
239
|
+
while(true) {
|
240
|
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
241
|
+
if (combinator(type, content)) {
|
242
|
+
while(cc.length && cc[cc.length - 1].lex)
|
243
|
+
cc.pop()();
|
244
|
+
if (cx.marked) return cx.marked;
|
245
|
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
246
|
+
return style;
|
247
|
+
}
|
248
|
+
}
|
249
|
+
}
|
250
|
+
|
251
|
+
// Combinator utils
|
252
|
+
|
253
|
+
var cx = {state: null, column: null, marked: null, cc: null};
|
254
|
+
function pass() {
|
255
|
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
256
|
+
}
|
257
|
+
function cont() {
|
258
|
+
pass.apply(null, arguments);
|
259
|
+
return true;
|
260
|
+
}
|
261
|
+
function inList(name, list) {
|
262
|
+
for (var v = list; v; v = v.next) if (v.name == name) return true
|
263
|
+
return false;
|
264
|
+
}
|
265
|
+
function register(varname) {
|
266
|
+
var state = cx.state;
|
267
|
+
cx.marked = "def";
|
268
|
+
if (state.context) {
|
269
|
+
if (state.lexical.info == "var" && state.context && state.context.block) {
|
270
|
+
// FIXME function decls are also not block scoped
|
271
|
+
var newContext = registerVarScoped(varname, state.context)
|
272
|
+
if (newContext != null) {
|
273
|
+
state.context = newContext
|
274
|
+
return
|
275
|
+
}
|
276
|
+
} else if (!inList(varname, state.localVars)) {
|
277
|
+
state.localVars = new Var(varname, state.localVars)
|
278
|
+
return
|
279
|
+
}
|
280
|
+
}
|
281
|
+
// Fall through means this is global
|
282
|
+
if (parserConfig.globalVars && !inList(varname, state.globalVars))
|
283
|
+
state.globalVars = new Var(varname, state.globalVars)
|
284
|
+
}
|
285
|
+
function registerVarScoped(varname, context) {
|
286
|
+
if (!context) {
|
287
|
+
return null
|
288
|
+
} else if (context.block) {
|
289
|
+
var inner = registerVarScoped(varname, context.prev)
|
290
|
+
if (!inner) return null
|
291
|
+
if (inner == context.prev) return context
|
292
|
+
return new Context(inner, context.vars, true)
|
293
|
+
} else if (inList(varname, context.vars)) {
|
294
|
+
return context
|
295
|
+
} else {
|
296
|
+
return new Context(context.prev, new Var(varname, context.vars), false)
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
function isModifier(name) {
|
301
|
+
return name == "public" || name == "private" || name == "protected" || name == "abstract" || name == "readonly"
|
302
|
+
}
|
303
|
+
|
304
|
+
// Combinators
|
305
|
+
|
306
|
+
function Context(prev, vars, block) { this.prev = prev; this.vars = vars; this.block = block }
|
307
|
+
function Var(name, next) { this.name = name; this.next = next }
|
308
|
+
|
309
|
+
var defaultVars = new Var("this", new Var("arguments", null))
|
310
|
+
function pushcontext() {
|
311
|
+
cx.state.context = new Context(cx.state.context, cx.state.localVars, false)
|
312
|
+
cx.state.localVars = defaultVars
|
313
|
+
}
|
314
|
+
function pushblockcontext() {
|
315
|
+
cx.state.context = new Context(cx.state.context, cx.state.localVars, true)
|
316
|
+
cx.state.localVars = null
|
317
|
+
}
|
318
|
+
function popcontext() {
|
319
|
+
cx.state.localVars = cx.state.context.vars
|
320
|
+
cx.state.context = cx.state.context.prev
|
321
|
+
}
|
322
|
+
popcontext.lex = true
|
323
|
+
function pushlex(type, info) {
|
324
|
+
var result = function() {
|
325
|
+
var state = cx.state, indent = state.indented;
|
326
|
+
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
327
|
+
else for (var outer = state.lexical; outer && outer.type == ")" && outer.align; outer = outer.prev)
|
328
|
+
indent = outer.indented;
|
329
|
+
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
330
|
+
};
|
331
|
+
result.lex = true;
|
332
|
+
return result;
|
333
|
+
}
|
334
|
+
function poplex() {
|
335
|
+
var state = cx.state;
|
336
|
+
if (state.lexical.prev) {
|
337
|
+
if (state.lexical.type == ")")
|
338
|
+
state.indented = state.lexical.indented;
|
339
|
+
state.lexical = state.lexical.prev;
|
340
|
+
}
|
341
|
+
}
|
342
|
+
poplex.lex = true;
|
343
|
+
|
344
|
+
function expect(wanted) {
|
345
|
+
function exp(type) {
|
346
|
+
if (type == wanted) return cont();
|
347
|
+
else if (wanted == ";" || type == "}" || type == ")" || type == "]") return pass();
|
348
|
+
else return cont(exp);
|
349
|
+
};
|
350
|
+
return exp;
|
351
|
+
}
|
352
|
+
|
353
|
+
function statement(type, value) {
|
354
|
+
if (type == "var") return cont(pushlex("vardef", value), vardef, expect(";"), poplex);
|
355
|
+
if (type == "keyword a") return cont(pushlex("form"), parenExpr, statement, poplex);
|
356
|
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
357
|
+
if (type == "keyword d") return cx.stream.match(/^\s*$/, false) ? cont() : cont(pushlex("stat"), maybeexpression, expect(";"), poplex);
|
358
|
+
if (type == "debugger") return cont(expect(";"));
|
359
|
+
if (type == "{") return cont(pushlex("}"), pushblockcontext, block, poplex, popcontext);
|
360
|
+
if (type == ";") return cont();
|
361
|
+
if (type == "if") {
|
362
|
+
if (cx.state.lexical.info == "else" && cx.state.cc[cx.state.cc.length - 1] == poplex)
|
363
|
+
cx.state.cc.pop()();
|
364
|
+
return cont(pushlex("form"), parenExpr, statement, poplex, maybeelse);
|
365
|
+
}
|
366
|
+
if (type == "function") return cont(functiondef);
|
367
|
+
if (type == "for") return cont(pushlex("form"), forspec, statement, poplex);
|
368
|
+
if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), className, poplex); }
|
369
|
+
if (type == "variable") {
|
370
|
+
if (isTS && value == "declare") {
|
371
|
+
cx.marked = "keyword"
|
372
|
+
return cont(statement)
|
373
|
+
} else if (isTS && (value == "module" || value == "enum" || value == "type") && cx.stream.match(/^\s*\w/, false)) {
|
374
|
+
cx.marked = "keyword"
|
375
|
+
if (value == "enum") return cont(enumdef);
|
376
|
+
else if (value == "type") return cont(typeexpr, expect("operator"), typeexpr, expect(";"));
|
377
|
+
else return cont(pushlex("form"), pattern, expect("{"), pushlex("}"), block, poplex, poplex)
|
378
|
+
} else if (isTS && value == "namespace") {
|
379
|
+
cx.marked = "keyword"
|
380
|
+
return cont(pushlex("form"), expression, block, poplex)
|
381
|
+
} else if (isTS && value == "abstract") {
|
382
|
+
cx.marked = "keyword"
|
383
|
+
return cont(statement)
|
384
|
+
} else {
|
385
|
+
return cont(pushlex("stat"), maybelabel);
|
386
|
+
}
|
387
|
+
}
|
388
|
+
if (type == "switch") return cont(pushlex("form"), parenExpr, expect("{"), pushlex("}", "switch"), pushblockcontext,
|
389
|
+
block, poplex, poplex, popcontext);
|
390
|
+
if (type == "case") return cont(expression, expect(":"));
|
391
|
+
if (type == "default") return cont(expect(":"));
|
392
|
+
if (type == "catch") return cont(pushlex("form"), pushcontext, maybeCatchBinding, statement, poplex, popcontext);
|
393
|
+
if (type == "export") return cont(pushlex("stat"), afterExport, poplex);
|
394
|
+
if (type == "import") return cont(pushlex("stat"), afterImport, poplex);
|
395
|
+
if (type == "async") return cont(statement)
|
396
|
+
if (value == "@") return cont(expression, statement)
|
397
|
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
398
|
+
}
|
399
|
+
function maybeCatchBinding(type) {
|
400
|
+
if (type == "(") return cont(funarg, expect(")"))
|
401
|
+
}
|
402
|
+
function expression(type, value) {
|
403
|
+
return expressionInner(type, value, false);
|
404
|
+
}
|
405
|
+
function expressionNoComma(type, value) {
|
406
|
+
return expressionInner(type, value, true);
|
407
|
+
}
|
408
|
+
function parenExpr(type) {
|
409
|
+
if (type != "(") return pass()
|
410
|
+
return cont(pushlex(")"), expression, expect(")"), poplex)
|
411
|
+
}
|
412
|
+
function expressionInner(type, value, noComma) {
|
413
|
+
if (cx.state.fatArrowAt == cx.stream.start) {
|
414
|
+
var body = noComma ? arrowBodyNoComma : arrowBody;
|
415
|
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, expect("=>"), body, popcontext);
|
416
|
+
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
417
|
+
}
|
418
|
+
|
419
|
+
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
420
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
421
|
+
if (type == "function") return cont(functiondef, maybeop);
|
422
|
+
if (type == "class" || (isTS && value == "interface")) { cx.marked = "keyword"; return cont(pushlex("form"), classExpression, poplex); }
|
423
|
+
if (type == "keyword c" || type == "async") return cont(noComma ? expressionNoComma : expression);
|
424
|
+
if (type == "(") return cont(pushlex(")"), maybeexpression, expect(")"), poplex, maybeop);
|
425
|
+
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
426
|
+
if (type == "[") return cont(pushlex("]"), arrayLiteral, poplex, maybeop);
|
427
|
+
if (type == "{") return contCommasep(objprop, "}", null, maybeop);
|
428
|
+
if (type == "quasi") return pass(quasi, maybeop);
|
429
|
+
if (type == "new") return cont(maybeTarget(noComma));
|
430
|
+
if (type == "import") return cont(expression);
|
431
|
+
return cont();
|
432
|
+
}
|
433
|
+
function maybeexpression(type) {
|
434
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
435
|
+
return pass(expression);
|
436
|
+
}
|
437
|
+
|
438
|
+
function maybeoperatorComma(type, value) {
|
439
|
+
if (type == ",") return cont(expression);
|
440
|
+
return maybeoperatorNoComma(type, value, false);
|
441
|
+
}
|
442
|
+
function maybeoperatorNoComma(type, value, noComma) {
|
443
|
+
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
444
|
+
var expr = noComma == false ? expression : expressionNoComma;
|
445
|
+
if (type == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
446
|
+
if (type == "operator") {
|
447
|
+
if (/\+\+|--/.test(value) || isTS && value == "!") return cont(me);
|
448
|
+
if (isTS && value == "<" && cx.stream.match(/^([^>]|<.*?>)*>\s*\(/, false))
|
449
|
+
return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, me);
|
450
|
+
if (value == "?") return cont(expression, expect(":"), expr);
|
451
|
+
return cont(expr);
|
452
|
+
}
|
453
|
+
if (type == "quasi") { return pass(quasi, me); }
|
454
|
+
if (type == ";") return;
|
455
|
+
if (type == "(") return contCommasep(expressionNoComma, ")", "call", me);
|
456
|
+
if (type == ".") return cont(property, me);
|
457
|
+
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
458
|
+
if (isTS && value == "as") { cx.marked = "keyword"; return cont(typeexpr, me) }
|
459
|
+
if (type == "regexp") {
|
460
|
+
cx.state.lastType = cx.marked = "operator"
|
461
|
+
cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)
|
462
|
+
return cont(expr)
|
463
|
+
}
|
464
|
+
}
|
465
|
+
function quasi(type, value) {
|
466
|
+
if (type != "quasi") return pass();
|
467
|
+
if (value.slice(value.length - 2) != "${") return cont(quasi);
|
468
|
+
return cont(expression, continueQuasi);
|
469
|
+
}
|
470
|
+
function continueQuasi(type) {
|
471
|
+
if (type == "}") {
|
472
|
+
cx.marked = "string-2";
|
473
|
+
cx.state.tokenize = tokenQuasi;
|
474
|
+
return cont(quasi);
|
475
|
+
}
|
476
|
+
}
|
477
|
+
function arrowBody(type) {
|
478
|
+
findFatArrow(cx.stream, cx.state);
|
479
|
+
return pass(type == "{" ? statement : expression);
|
480
|
+
}
|
481
|
+
function arrowBodyNoComma(type) {
|
482
|
+
findFatArrow(cx.stream, cx.state);
|
483
|
+
return pass(type == "{" ? statement : expressionNoComma);
|
484
|
+
}
|
485
|
+
function maybeTarget(noComma) {
|
486
|
+
return function(type) {
|
487
|
+
if (type == ".") return cont(noComma ? targetNoComma : target);
|
488
|
+
else if (type == "variable" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)
|
489
|
+
else return pass(noComma ? expressionNoComma : expression);
|
490
|
+
};
|
491
|
+
}
|
492
|
+
function target(_, value) {
|
493
|
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorComma); }
|
494
|
+
}
|
495
|
+
function targetNoComma(_, value) {
|
496
|
+
if (value == "target") { cx.marked = "keyword"; return cont(maybeoperatorNoComma); }
|
497
|
+
}
|
498
|
+
function maybelabel(type) {
|
499
|
+
if (type == ":") return cont(poplex, statement);
|
500
|
+
return pass(maybeoperatorComma, expect(";"), poplex);
|
501
|
+
}
|
502
|
+
function property(type) {
|
503
|
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
504
|
+
}
|
505
|
+
function objprop(type, value) {
|
506
|
+
if (type == "async") {
|
507
|
+
cx.marked = "property";
|
508
|
+
return cont(objprop);
|
509
|
+
} else if (type == "variable" || cx.style == "keyword") {
|
510
|
+
cx.marked = "property";
|
511
|
+
if (value == "get" || value == "set") return cont(getterSetter);
|
512
|
+
var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params
|
513
|
+
if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\s*:\s*/, false)))
|
514
|
+
cx.state.fatArrowAt = cx.stream.pos + m[0].length
|
515
|
+
return cont(afterprop);
|
516
|
+
} else if (type == "number" || type == "string") {
|
517
|
+
cx.marked = jsonldMode ? "property" : (cx.style + " property");
|
518
|
+
return cont(afterprop);
|
519
|
+
} else if (type == "jsonld-keyword") {
|
520
|
+
return cont(afterprop);
|
521
|
+
} else if (isTS && isModifier(value)) {
|
522
|
+
cx.marked = "keyword"
|
523
|
+
return cont(objprop)
|
524
|
+
} else if (type == "[") {
|
525
|
+
return cont(expression, maybetype, expect("]"), afterprop);
|
526
|
+
} else if (type == "spread") {
|
527
|
+
return cont(expressionNoComma, afterprop);
|
528
|
+
} else if (value == "*") {
|
529
|
+
cx.marked = "keyword";
|
530
|
+
return cont(objprop);
|
531
|
+
} else if (type == ":") {
|
532
|
+
return pass(afterprop)
|
533
|
+
}
|
534
|
+
}
|
535
|
+
function getterSetter(type) {
|
536
|
+
if (type != "variable") return pass(afterprop);
|
537
|
+
cx.marked = "property";
|
538
|
+
return cont(functiondef);
|
539
|
+
}
|
540
|
+
function afterprop(type) {
|
541
|
+
if (type == ":") return cont(expressionNoComma);
|
542
|
+
if (type == "(") return pass(functiondef);
|
543
|
+
}
|
544
|
+
function commasep(what, end, sep) {
|
545
|
+
function proceed(type, value) {
|
546
|
+
if (sep ? sep.indexOf(type) > -1 : type == ",") {
|
547
|
+
var lex = cx.state.lexical;
|
548
|
+
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
549
|
+
return cont(function(type, value) {
|
550
|
+
if (type == end || value == end) return pass()
|
551
|
+
return pass(what)
|
552
|
+
}, proceed);
|
553
|
+
}
|
554
|
+
if (type == end || value == end) return cont();
|
555
|
+
return cont(expect(end));
|
556
|
+
}
|
557
|
+
return function(type, value) {
|
558
|
+
if (type == end || value == end) return cont();
|
559
|
+
return pass(what, proceed);
|
560
|
+
};
|
561
|
+
}
|
562
|
+
function contCommasep(what, end, info) {
|
563
|
+
for (var i = 3; i < arguments.length; i++)
|
564
|
+
cx.cc.push(arguments[i]);
|
565
|
+
return cont(pushlex(end, info), commasep(what, end), poplex);
|
566
|
+
}
|
567
|
+
function block(type) {
|
568
|
+
if (type == "}") return cont();
|
569
|
+
return pass(statement, block);
|
570
|
+
}
|
571
|
+
function maybetype(type, value) {
|
572
|
+
if (isTS) {
|
573
|
+
if (type == ":") return cont(typeexpr);
|
574
|
+
if (value == "?") return cont(maybetype);
|
575
|
+
}
|
576
|
+
}
|
577
|
+
function mayberettype(type) {
|
578
|
+
if (isTS && type == ":") {
|
579
|
+
if (cx.stream.match(/^\s*\w+\s+is\b/, false)) return cont(expression, isKW, typeexpr)
|
580
|
+
else return cont(typeexpr)
|
581
|
+
}
|
582
|
+
}
|
583
|
+
function isKW(_, value) {
|
584
|
+
if (value == "is") {
|
585
|
+
cx.marked = "keyword"
|
586
|
+
return cont()
|
587
|
+
}
|
588
|
+
}
|
589
|
+
function typeexpr(type, value) {
|
590
|
+
if (value == "keyof" || value == "typeof") {
|
591
|
+
cx.marked = "keyword"
|
592
|
+
return cont(value == "keyof" ? typeexpr : expressionNoComma)
|
593
|
+
}
|
594
|
+
if (type == "variable" || value == "void") {
|
595
|
+
cx.marked = "type"
|
596
|
+
return cont(afterType)
|
597
|
+
}
|
598
|
+
if (type == "string" || type == "number" || type == "atom") return cont(afterType);
|
599
|
+
if (type == "[") return cont(pushlex("]"), commasep(typeexpr, "]", ","), poplex, afterType)
|
600
|
+
if (type == "{") return cont(pushlex("}"), commasep(typeprop, "}", ",;"), poplex, afterType)
|
601
|
+
if (type == "(") return cont(commasep(typearg, ")"), maybeReturnType)
|
602
|
+
if (type == "<") return cont(commasep(typeexpr, ">"), typeexpr)
|
603
|
+
}
|
604
|
+
function maybeReturnType(type) {
|
605
|
+
if (type == "=>") return cont(typeexpr)
|
606
|
+
}
|
607
|
+
function typeprop(type, value) {
|
608
|
+
if (type == "variable" || cx.style == "keyword") {
|
609
|
+
cx.marked = "property"
|
610
|
+
return cont(typeprop)
|
611
|
+
} else if (value == "?") {
|
612
|
+
return cont(typeprop)
|
613
|
+
} else if (type == ":") {
|
614
|
+
return cont(typeexpr)
|
615
|
+
} else if (type == "[") {
|
616
|
+
return cont(expression, maybetype, expect("]"), typeprop)
|
617
|
+
}
|
618
|
+
}
|
619
|
+
function typearg(type, value) {
|
620
|
+
if (type == "variable" && cx.stream.match(/^\s*[?:]/, false) || value == "?") return cont(typearg)
|
621
|
+
if (type == ":") return cont(typeexpr)
|
622
|
+
return pass(typeexpr)
|
623
|
+
}
|
624
|
+
function afterType(type, value) {
|
625
|
+
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
626
|
+
if (value == "|" || type == "." || value == "&") return cont(typeexpr)
|
627
|
+
if (type == "[") return cont(expect("]"), afterType)
|
628
|
+
if (value == "extends" || value == "implements") { cx.marked = "keyword"; return cont(typeexpr) }
|
629
|
+
}
|
630
|
+
function maybeTypeArgs(_, value) {
|
631
|
+
if (value == "<") return cont(pushlex(">"), commasep(typeexpr, ">"), poplex, afterType)
|
632
|
+
}
|
633
|
+
function typeparam() {
|
634
|
+
return pass(typeexpr, maybeTypeDefault)
|
635
|
+
}
|
636
|
+
function maybeTypeDefault(_, value) {
|
637
|
+
if (value == "=") return cont(typeexpr)
|
638
|
+
}
|
639
|
+
function vardef(_, value) {
|
640
|
+
if (value == "enum") {cx.marked = "keyword"; return cont(enumdef)}
|
641
|
+
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
642
|
+
}
|
643
|
+
function pattern(type, value) {
|
644
|
+
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(pattern) }
|
645
|
+
if (type == "variable") { register(value); return cont(); }
|
646
|
+
if (type == "spread") return cont(pattern);
|
647
|
+
if (type == "[") return contCommasep(eltpattern, "]");
|
648
|
+
if (type == "{") return contCommasep(proppattern, "}");
|
649
|
+
}
|
650
|
+
function proppattern(type, value) {
|
651
|
+
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
652
|
+
register(value);
|
653
|
+
return cont(maybeAssign);
|
654
|
+
}
|
655
|
+
if (type == "variable") cx.marked = "property";
|
656
|
+
if (type == "spread") return cont(pattern);
|
657
|
+
if (type == "}") return pass();
|
658
|
+
return cont(expect(":"), pattern, maybeAssign);
|
659
|
+
}
|
660
|
+
function eltpattern() {
|
661
|
+
return pass(pattern, maybeAssign)
|
662
|
+
}
|
663
|
+
function maybeAssign(_type, value) {
|
664
|
+
if (value == "=") return cont(expressionNoComma);
|
665
|
+
}
|
666
|
+
function vardefCont(type) {
|
667
|
+
if (type == ",") return cont(vardef);
|
668
|
+
}
|
669
|
+
function maybeelse(type, value) {
|
670
|
+
if (type == "keyword b" && value == "else") return cont(pushlex("form", "else"), statement, poplex);
|
671
|
+
}
|
672
|
+
function forspec(type, value) {
|
673
|
+
if (value == "await") return cont(forspec);
|
674
|
+
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"), poplex);
|
675
|
+
}
|
676
|
+
function forspec1(type) {
|
677
|
+
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
678
|
+
if (type == ";") return cont(forspec2);
|
679
|
+
if (type == "variable") return cont(formaybeinof);
|
680
|
+
return pass(expression, expect(";"), forspec2);
|
681
|
+
}
|
682
|
+
function formaybeinof(_type, value) {
|
683
|
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
684
|
+
return cont(maybeoperatorComma, forspec2);
|
685
|
+
}
|
686
|
+
function forspec2(type, value) {
|
687
|
+
if (type == ";") return cont(forspec3);
|
688
|
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
689
|
+
return pass(expression, expect(";"), forspec3);
|
690
|
+
}
|
691
|
+
function forspec3(type) {
|
692
|
+
if (type != ")") cont(expression);
|
693
|
+
}
|
694
|
+
function functiondef(type, value) {
|
695
|
+
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
696
|
+
if (type == "variable") {register(value); return cont(functiondef);}
|
697
|
+
if (type == "(") return cont(pushcontext, pushlex(")"), commasep(funarg, ")"), poplex, mayberettype, statement, popcontext);
|
698
|
+
if (isTS && value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, functiondef)
|
699
|
+
}
|
700
|
+
function funarg(type, value) {
|
701
|
+
if (value == "@") cont(expression, funarg)
|
702
|
+
if (type == "spread") return cont(funarg);
|
703
|
+
if (isTS && isModifier(value)) { cx.marked = "keyword"; return cont(funarg); }
|
704
|
+
return pass(pattern, maybetype, maybeAssign);
|
705
|
+
}
|
706
|
+
function classExpression(type, value) {
|
707
|
+
// Class expressions may have an optional name.
|
708
|
+
if (type == "variable") return className(type, value);
|
709
|
+
return classNameAfter(type, value);
|
710
|
+
}
|
711
|
+
function className(type, value) {
|
712
|
+
if (type == "variable") {register(value); return cont(classNameAfter);}
|
713
|
+
}
|
714
|
+
function classNameAfter(type, value) {
|
715
|
+
if (value == "<") return cont(pushlex(">"), commasep(typeparam, ">"), poplex, classNameAfter)
|
716
|
+
if (value == "extends" || value == "implements" || (isTS && type == ",")) {
|
717
|
+
if (value == "implements") cx.marked = "keyword";
|
718
|
+
return cont(isTS ? typeexpr : expression, classNameAfter);
|
719
|
+
}
|
720
|
+
if (type == "{") return cont(pushlex("}"), classBody, poplex);
|
721
|
+
}
|
722
|
+
function classBody(type, value) {
|
723
|
+
if (type == "async" ||
|
724
|
+
(type == "variable" &&
|
725
|
+
(value == "static" || value == "get" || value == "set" || (isTS && isModifier(value))) &&
|
726
|
+
cx.stream.match(/^\s+[\w$\xa1-\uffff]/, false))) {
|
727
|
+
cx.marked = "keyword";
|
728
|
+
return cont(classBody);
|
729
|
+
}
|
730
|
+
if (type == "variable" || cx.style == "keyword") {
|
731
|
+
cx.marked = "property";
|
732
|
+
return cont(isTS ? classfield : functiondef, classBody);
|
733
|
+
}
|
734
|
+
if (type == "[")
|
735
|
+
return cont(expression, maybetype, expect("]"), isTS ? classfield : functiondef, classBody)
|
736
|
+
if (value == "*") {
|
737
|
+
cx.marked = "keyword";
|
738
|
+
return cont(classBody);
|
739
|
+
}
|
740
|
+
if (type == ";") return cont(classBody);
|
741
|
+
if (type == "}") return cont();
|
742
|
+
if (value == "@") return cont(expression, classBody)
|
743
|
+
}
|
744
|
+
function classfield(type, value) {
|
745
|
+
if (value == "?") return cont(classfield)
|
746
|
+
if (type == ":") return cont(typeexpr, maybeAssign)
|
747
|
+
if (value == "=") return cont(expressionNoComma)
|
748
|
+
return pass(functiondef)
|
749
|
+
}
|
750
|
+
function afterExport(type, value) {
|
751
|
+
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
752
|
+
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
753
|
+
if (type == "{") return cont(commasep(exportField, "}"), maybeFrom, expect(";"));
|
754
|
+
return pass(statement);
|
755
|
+
}
|
756
|
+
function exportField(type, value) {
|
757
|
+
if (value == "as") { cx.marked = "keyword"; return cont(expect("variable")); }
|
758
|
+
if (type == "variable") return pass(expressionNoComma, exportField);
|
759
|
+
}
|
760
|
+
function afterImport(type) {
|
761
|
+
if (type == "string") return cont();
|
762
|
+
if (type == "(") return pass(expression);
|
763
|
+
return pass(importSpec, maybeMoreImports, maybeFrom);
|
764
|
+
}
|
765
|
+
function importSpec(type, value) {
|
766
|
+
if (type == "{") return contCommasep(importSpec, "}");
|
767
|
+
if (type == "variable") register(value);
|
768
|
+
if (value == "*") cx.marked = "keyword";
|
769
|
+
return cont(maybeAs);
|
770
|
+
}
|
771
|
+
function maybeMoreImports(type) {
|
772
|
+
if (type == ",") return cont(importSpec, maybeMoreImports)
|
773
|
+
}
|
774
|
+
function maybeAs(_type, value) {
|
775
|
+
if (value == "as") { cx.marked = "keyword"; return cont(importSpec); }
|
776
|
+
}
|
777
|
+
function maybeFrom(_type, value) {
|
778
|
+
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
779
|
+
}
|
780
|
+
function arrayLiteral(type) {
|
781
|
+
if (type == "]") return cont();
|
782
|
+
return pass(commasep(expressionNoComma, "]"));
|
783
|
+
}
|
784
|
+
function enumdef() {
|
785
|
+
return pass(pushlex("form"), pattern, expect("{"), pushlex("}"), commasep(enummember, "}"), poplex, poplex)
|
786
|
+
}
|
787
|
+
function enummember() {
|
788
|
+
return pass(pattern, maybeAssign);
|
789
|
+
}
|
790
|
+
|
791
|
+
function isContinuedStatement(state, textAfter) {
|
792
|
+
return state.lastType == "operator" || state.lastType == "," ||
|
793
|
+
isOperatorChar.test(textAfter.charAt(0)) ||
|
794
|
+
/[,.]/.test(textAfter.charAt(0));
|
795
|
+
}
|
796
|
+
|
797
|
+
function expressionAllowed(stream, state, backUp) {
|
798
|
+
return state.tokenize == tokenBase &&
|
799
|
+
/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(state.lastType) ||
|
800
|
+
(state.lastType == "quasi" && /\{\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))
|
801
|
+
}
|
802
|
+
|
803
|
+
// Interface
|
804
|
+
|
805
|
+
return {
|
806
|
+
startState: function(basecolumn) {
|
807
|
+
var state = {
|
808
|
+
tokenize: tokenBase,
|
809
|
+
lastType: "sof",
|
810
|
+
cc: [],
|
811
|
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
812
|
+
localVars: parserConfig.localVars,
|
813
|
+
context: parserConfig.localVars && new Context(null, null, false),
|
814
|
+
indented: basecolumn || 0
|
815
|
+
};
|
816
|
+
if (parserConfig.globalVars && typeof parserConfig.globalVars == "object")
|
817
|
+
state.globalVars = parserConfig.globalVars;
|
818
|
+
return state;
|
819
|
+
},
|
820
|
+
|
821
|
+
token: function(stream, state) {
|
822
|
+
if (stream.sol()) {
|
823
|
+
if (!state.lexical.hasOwnProperty("align"))
|
824
|
+
state.lexical.align = false;
|
825
|
+
state.indented = stream.indentation();
|
826
|
+
findFatArrow(stream, state);
|
827
|
+
}
|
828
|
+
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
829
|
+
var style = state.tokenize(stream, state);
|
830
|
+
if (type == "comment") return style;
|
831
|
+
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
832
|
+
return parseJS(state, style, type, content, stream);
|
833
|
+
},
|
834
|
+
|
835
|
+
indent: function(state, textAfter) {
|
836
|
+
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
837
|
+
if (state.tokenize != tokenBase) return 0;
|
838
|
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top
|
839
|
+
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
840
|
+
if (!/^\s*else\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {
|
841
|
+
var c = state.cc[i];
|
842
|
+
if (c == poplex) lexical = lexical.prev;
|
843
|
+
else if (c != maybeelse) break;
|
844
|
+
}
|
845
|
+
while ((lexical.type == "stat" || lexical.type == "form") &&
|
846
|
+
(firstChar == "}" || ((top = state.cc[state.cc.length - 1]) &&
|
847
|
+
(top == maybeoperatorComma || top == maybeoperatorNoComma) &&
|
848
|
+
!/^[,\.=+\-*:?[\(]/.test(textAfter))))
|
849
|
+
lexical = lexical.prev;
|
850
|
+
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
851
|
+
lexical = lexical.prev;
|
852
|
+
var type = lexical.type, closing = firstChar == type;
|
853
|
+
|
854
|
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info.length + 1 : 0);
|
855
|
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
856
|
+
else if (type == "form") return lexical.indented + indentUnit;
|
857
|
+
else if (type == "stat")
|
858
|
+
return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);
|
859
|
+
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
860
|
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
861
|
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
862
|
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
863
|
+
},
|
864
|
+
|
865
|
+
electricInput: /^\s*(?:case .*?:|default:|\{|\})$/,
|
866
|
+
blockCommentStart: jsonMode ? null : "/*",
|
867
|
+
blockCommentEnd: jsonMode ? null : "*/",
|
868
|
+
blockCommentContinue: jsonMode ? null : " * ",
|
869
|
+
lineComment: jsonMode ? null : "//",
|
870
|
+
fold: "brace",
|
871
|
+
closeBrackets: "()[]{}''\"\"``",
|
872
|
+
|
873
|
+
helperType: jsonMode ? "json" : "javascript",
|
874
|
+
jsonldMode: jsonldMode,
|
875
|
+
jsonMode: jsonMode,
|
876
|
+
|
877
|
+
expressionAllowed: expressionAllowed,
|
878
|
+
|
879
|
+
skipExpression: function(state) {
|
880
|
+
var top = state.cc[state.cc.length - 1]
|
881
|
+
if (top == expression || top == expressionNoComma) state.cc.pop()
|
882
|
+
}
|
883
|
+
};
|
884
|
+
});
|
885
|
+
|
886
|
+
CodeMirror.registerHelper("wordChars", "javascript", /[\w$]/);
|
887
|
+
|
888
|
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
889
|
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
890
|
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
891
|
+
CodeMirror.defineMIME("application/x-javascript", "javascript");
|
892
|
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
893
|
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
894
|
+
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
895
|
+
CodeMirror.defineMIME("application/ld+json", {name: "javascript", jsonld: true});
|
896
|
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
897
|
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|
898
|
+
|
899
|
+
});
|