gump 0.1.6
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.
- checksums.yaml +7 -0
- data/.gitignore +24 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +71 -0
- data/Rakefile +2 -0
- data/bin/gump +37 -0
- data/gump.gemspec +17 -0
- data/lib/gump.rb +50 -0
- data/lib/version.rb +3 -0
- data/server/assets/css/style.css +6949 -0
- data/server/assets/images/arrow.png +0 -0
- data/server/assets/images/logo.png +0 -0
- data/server/assets/js/bootstrap/dist/css/bootstrap-theme.css +347 -0
- data/server/assets/js/bootstrap/dist/css/bootstrap-theme.css.map +1 -0
- data/server/assets/js/bootstrap/dist/css/bootstrap-theme.min.css +7 -0
- data/server/assets/js/bootstrap/dist/css/bootstrap.css +5785 -0
- data/server/assets/js/bootstrap/dist/css/bootstrap.css.map +1 -0
- data/server/assets/js/bootstrap/dist/css/bootstrap.min.css +7 -0
- data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +229 -0
- data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/server/assets/js/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- data/server/assets/js/bootstrap/dist/js/bootstrap.js +1951 -0
- data/server/assets/js/bootstrap/dist/js/bootstrap.min.js +6 -0
- data/server/assets/js/jquery.codemirror/.gitattributes +8 -0
- data/server/assets/js/jquery.codemirror/.gitignore +6 -0
- data/server/assets/js/jquery.codemirror/.travis.yml +3 -0
- data/server/assets/js/jquery.codemirror/AUTHORS +255 -0
- data/server/assets/js/jquery.codemirror/CONTRIBUTING.md +72 -0
- data/server/assets/js/jquery.codemirror/LICENSE +19 -0
- data/server/assets/js/jquery.codemirror/README.md +11 -0
- data/server/assets/js/jquery.codemirror/addon/comment/comment.js +145 -0
- data/server/assets/js/jquery.codemirror/addon/comment/continuecomment.js +54 -0
- data/server/assets/js/jquery.codemirror/addon/dialog/dialog.css +32 -0
- data/server/assets/js/jquery.codemirror/addon/dialog/dialog.js +121 -0
- data/server/assets/js/jquery.codemirror/addon/display/fullscreen.css +6 -0
- data/server/assets/js/jquery.codemirror/addon/display/fullscreen.js +31 -0
- data/server/assets/js/jquery.codemirror/addon/display/placeholder.js +48 -0
- data/server/assets/js/jquery.codemirror/addon/edit/closebrackets.js +82 -0
- data/server/assets/js/jquery.codemirror/addon/edit/closetag.js +89 -0
- data/server/assets/js/jquery.codemirror/addon/edit/continuelist.js +25 -0
- data/server/assets/js/jquery.codemirror/addon/edit/matchbrackets.js +87 -0
- data/server/assets/js/jquery.codemirror/addon/edit/matchtags.js +56 -0
- data/server/assets/js/jquery.codemirror/addon/edit/trailingspace.js +15 -0
- data/server/assets/js/jquery.codemirror/addon/fold/brace-fold.js +93 -0
- data/server/assets/js/jquery.codemirror/addon/fold/comment-fold.js +40 -0
- data/server/assets/js/jquery.codemirror/addon/fold/foldcode.js +75 -0
- data/server/assets/js/jquery.codemirror/addon/fold/foldgutter.css +21 -0
- data/server/assets/js/jquery.codemirror/addon/fold/foldgutter.js +124 -0
- data/server/assets/js/jquery.codemirror/addon/fold/indent-fold.js +30 -0
- data/server/assets/js/jquery.codemirror/addon/fold/xml-fold.js +167 -0
- data/server/assets/js/jquery.codemirror/addon/hint/anyword-hint.js +34 -0
- data/server/assets/js/jquery.codemirror/addon/hint/css-hint.js +50 -0
- data/server/assets/js/jquery.codemirror/addon/hint/html-hint.js +337 -0
- data/server/assets/js/jquery.codemirror/addon/hint/javascript-hint.js +131 -0
- data/server/assets/js/jquery.codemirror/addon/hint/pig-hint.js +121 -0
- data/server/assets/js/jquery.codemirror/addon/hint/python-hint.js +95 -0
- data/server/assets/js/jquery.codemirror/addon/hint/show-hint.css +38 -0
- data/server/assets/js/jquery.codemirror/addon/hint/show-hint.js +286 -0
- data/server/assets/js/jquery.codemirror/addon/hint/sql-hint.js +105 -0
- data/server/assets/js/jquery.codemirror/addon/hint/xml-hint.js +69 -0
- data/server/assets/js/jquery.codemirror/addon/lint/coffeescript-lint.js +27 -0
- data/server/assets/js/jquery.codemirror/addon/lint/css-lint.js +19 -0
- data/server/assets/js/jquery.codemirror/addon/lint/javascript-lint.js +126 -0
- data/server/assets/js/jquery.codemirror/addon/lint/json-lint.js +17 -0
- data/server/assets/js/jquery.codemirror/addon/lint/lint.css +73 -0
- data/server/assets/js/jquery.codemirror/addon/lint/lint.js +203 -0
- data/server/assets/js/jquery.codemirror/addon/merge/dep/diff_match_patch.js +50 -0
- data/server/assets/js/jquery.codemirror/addon/merge/merge.css +92 -0
- data/server/assets/js/jquery.codemirror/addon/merge/merge.js +474 -0
- data/server/assets/js/jquery.codemirror/addon/mode/loadmode.js +51 -0
- data/server/assets/js/jquery.codemirror/addon/mode/multiplex.js +101 -0
- data/server/assets/js/jquery.codemirror/addon/mode/multiplex_test.js +30 -0
- data/server/assets/js/jquery.codemirror/addon/mode/overlay.js +59 -0
- data/server/assets/js/jquery.codemirror/addon/runmode/colorize.js +29 -0
- data/server/assets/js/jquery.codemirror/addon/runmode/runmode-standalone.js +136 -0
- data/server/assets/js/jquery.codemirror/addon/runmode/runmode.js +56 -0
- data/server/assets/js/jquery.codemirror/addon/runmode/runmode.node.js +103 -0
- data/server/assets/js/jquery.codemirror/addon/scroll/scrollpastend.js +34 -0
- data/server/assets/js/jquery.codemirror/addon/search/match-highlighter.js +91 -0
- data/server/assets/js/jquery.codemirror/addon/search/search.js +133 -0
- data/server/assets/js/jquery.codemirror/addon/search/searchcursor.js +143 -0
- data/server/assets/js/jquery.codemirror/addon/selection/active-line.js +39 -0
- data/server/assets/js/jquery.codemirror/addon/selection/mark-selection.js +108 -0
- data/server/assets/js/jquery.codemirror/addon/tern/tern.css +85 -0
- data/server/assets/js/jquery.codemirror/addon/tern/tern.js +632 -0
- data/server/assets/js/jquery.codemirror/addon/tern/worker.js +41 -0
- data/server/assets/js/jquery.codemirror/addon/wrap/hardwrap.js +99 -0
- data/server/assets/js/jquery.codemirror/bin/authors.sh +6 -0
- data/server/assets/js/jquery.codemirror/bin/compress +92 -0
- data/server/assets/js/jquery.codemirror/bin/lint +16 -0
- data/server/assets/js/jquery.codemirror/bin/source-highlight +61 -0
- data/server/assets/js/jquery.codemirror/bower.json +15 -0
- data/server/assets/js/jquery.codemirror/demo/activeline.html +78 -0
- data/server/assets/js/jquery.codemirror/demo/anywordhint.html +79 -0
- data/server/assets/js/jquery.codemirror/demo/bidi.html +74 -0
- data/server/assets/js/jquery.codemirror/demo/btree.html +86 -0
- data/server/assets/js/jquery.codemirror/demo/buffers.html +109 -0
- data/server/assets/js/jquery.codemirror/demo/changemode.html +59 -0
- data/server/assets/js/jquery.codemirror/demo/closebrackets.html +63 -0
- data/server/assets/js/jquery.codemirror/demo/closetag.html +40 -0
- data/server/assets/js/jquery.codemirror/demo/complete.html +80 -0
- data/server/assets/js/jquery.codemirror/demo/emacs.html +75 -0
- data/server/assets/js/jquery.codemirror/demo/folding.html +75 -0
- data/server/assets/js/jquery.codemirror/demo/fullscreen.html +130 -0
- data/server/assets/js/jquery.codemirror/demo/hardwrap.html +69 -0
- data/server/assets/js/jquery.codemirror/demo/html5complete.html +54 -0
- data/server/assets/js/jquery.codemirror/demo/indentwrap.html +58 -0
- data/server/assets/js/jquery.codemirror/demo/lint.html +171 -0
- data/server/assets/js/jquery.codemirror/demo/loadmode.html +49 -0
- data/server/assets/js/jquery.codemirror/demo/marker.html +52 -0
- data/server/assets/js/jquery.codemirror/demo/markselection.html +45 -0
- data/server/assets/js/jquery.codemirror/demo/matchhighlighter.html +47 -0
- data/server/assets/js/jquery.codemirror/demo/matchtags.html +49 -0
- data/server/assets/js/jquery.codemirror/demo/merge.html +82 -0
- data/server/assets/js/jquery.codemirror/demo/multiplex.html +75 -0
- data/server/assets/js/jquery.codemirror/demo/mustache.html +68 -0
- data/server/assets/js/jquery.codemirror/demo/placeholder.html +45 -0
- data/server/assets/js/jquery.codemirror/demo/preview.html +88 -0
- data/server/assets/js/jquery.codemirror/demo/resize.html +58 -0
- data/server/assets/js/jquery.codemirror/demo/runmode.html +62 -0
- data/server/assets/js/jquery.codemirror/demo/search.html +94 -0
- data/server/assets/js/jquery.codemirror/demo/spanaffectswrapping_shim.html +85 -0
- data/server/assets/js/jquery.codemirror/demo/tern.html +129 -0
- data/server/assets/js/jquery.codemirror/demo/theme.html +121 -0
- data/server/assets/js/jquery.codemirror/demo/trailingspace.html +48 -0
- data/server/assets/js/jquery.codemirror/demo/variableheight.html +67 -0
- data/server/assets/js/jquery.codemirror/demo/vim.html +74 -0
- data/server/assets/js/jquery.codemirror/demo/visibletabs.html +62 -0
- data/server/assets/js/jquery.codemirror/demo/widget.html +85 -0
- data/server/assets/js/jquery.codemirror/demo/xmlcomplete.html +116 -0
- data/server/assets/js/jquery.codemirror/index.html +192 -0
- data/server/assets/js/jquery.codemirror/keymap/emacs.js +387 -0
- data/server/assets/js/jquery.codemirror/keymap/extra.js +43 -0
- data/server/assets/js/jquery.codemirror/keymap/vim.js +3703 -0
- data/server/assets/js/jquery.codemirror/lib/codemirror.css +263 -0
- data/server/assets/js/jquery.codemirror/lib/codemirror.js +5944 -0
- data/server/assets/js/jquery.codemirror/mode/apl/apl.js +160 -0
- data/server/assets/js/jquery.codemirror/mode/apl/index.html +72 -0
- data/server/assets/js/jquery.codemirror/mode/asterisk/asterisk.js +183 -0
- data/server/assets/js/jquery.codemirror/mode/asterisk/index.html +154 -0
- data/server/assets/js/jquery.codemirror/mode/clike/clike.js +362 -0
- data/server/assets/js/jquery.codemirror/mode/clike/index.html +195 -0
- data/server/assets/js/jquery.codemirror/mode/clike/scala.html +767 -0
- data/server/assets/js/jquery.codemirror/mode/clojure/clojure.js +224 -0
- data/server/assets/js/jquery.codemirror/mode/clojure/index.html +88 -0
- data/server/assets/js/jquery.codemirror/mode/cobol/cobol.js +240 -0
- data/server/assets/js/jquery.codemirror/mode/cobol/index.html +210 -0
- data/server/assets/js/jquery.codemirror/mode/coffeescript/coffeescript.js +354 -0
- data/server/assets/js/jquery.codemirror/mode/coffeescript/index.html +740 -0
- data/server/assets/js/jquery.codemirror/mode/commonlisp/commonlisp.js +105 -0
- data/server/assets/js/jquery.codemirror/mode/commonlisp/index.html +177 -0
- data/server/assets/js/jquery.codemirror/mode/css/css.js +639 -0
- data/server/assets/js/jquery.codemirror/mode/css/index.html +70 -0
- data/server/assets/js/jquery.codemirror/mode/css/scss.html +157 -0
- data/server/assets/js/jquery.codemirror/mode/css/scss_test.js +93 -0
- data/server/assets/js/jquery.codemirror/mode/css/test.js +142 -0
- data/server/assets/js/jquery.codemirror/mode/d/d.js +205 -0
- data/server/assets/js/jquery.codemirror/mode/d/index.html +273 -0
- data/server/assets/js/jquery.codemirror/mode/diff/diff.js +32 -0
- data/server/assets/js/jquery.codemirror/mode/diff/index.html +117 -0
- data/server/assets/js/jquery.codemirror/mode/dtd/dtd.js +127 -0
- data/server/assets/js/jquery.codemirror/mode/dtd/index.html +89 -0
- data/server/assets/js/jquery.codemirror/mode/ecl/ecl.js +192 -0
- data/server/assets/js/jquery.codemirror/mode/ecl/index.html +52 -0
- data/server/assets/js/jquery.codemirror/mode/eiffel/eiffel.js +147 -0
- data/server/assets/js/jquery.codemirror/mode/eiffel/index.html +430 -0
- data/server/assets/js/jquery.codemirror/mode/erlang/erlang.js +484 -0
- data/server/assets/js/jquery.codemirror/mode/erlang/index.html +75 -0
- data/server/assets/js/jquery.codemirror/mode/fortran/fortran.js +173 -0
- data/server/assets/js/jquery.codemirror/mode/fortran/index.html +81 -0
- data/server/assets/js/jquery.codemirror/mode/gas/gas.js +330 -0
- data/server/assets/js/jquery.codemirror/mode/gas/index.html +68 -0
- data/server/assets/js/jquery.codemirror/mode/gfm/gfm.js +97 -0
- data/server/assets/js/jquery.codemirror/mode/gfm/index.html +82 -0
- data/server/assets/js/jquery.codemirror/mode/gfm/test.js +112 -0
- data/server/assets/js/jquery.codemirror/mode/gherkin/gherkin.js +168 -0
- data/server/assets/js/jquery.codemirror/mode/gherkin/index.html +48 -0
- data/server/assets/js/jquery.codemirror/mode/go/go.js +168 -0
- data/server/assets/js/jquery.codemirror/mode/go/index.html +85 -0
- data/server/assets/js/jquery.codemirror/mode/groovy/groovy.js +211 -0
- data/server/assets/js/jquery.codemirror/mode/groovy/index.html +84 -0
- data/server/assets/js/jquery.codemirror/mode/haml/haml.js +153 -0
- data/server/assets/js/jquery.codemirror/mode/haml/index.html +79 -0
- data/server/assets/js/jquery.codemirror/mode/haml/test.js +94 -0
- data/server/assets/js/jquery.codemirror/mode/haskell/haskell.js +250 -0
- data/server/assets/js/jquery.codemirror/mode/haskell/index.html +73 -0
- data/server/assets/js/jquery.codemirror/mode/haxe/haxe.js +429 -0
- data/server/assets/js/jquery.codemirror/mode/haxe/index.html +103 -0
- data/server/assets/js/jquery.codemirror/mode/htmlembedded/htmlembedded.js +73 -0
- data/server/assets/js/jquery.codemirror/mode/htmlembedded/index.html +60 -0
- data/server/assets/js/jquery.codemirror/mode/htmlmixed/htmlmixed.js +104 -0
- data/server/assets/js/jquery.codemirror/mode/htmlmixed/index.html +85 -0
- data/server/assets/js/jquery.codemirror/mode/http/http.js +98 -0
- data/server/assets/js/jquery.codemirror/mode/http/index.html +45 -0
- data/server/assets/js/jquery.codemirror/mode/index.html +114 -0
- data/server/assets/js/jquery.codemirror/mode/jade/index.html +66 -0
- data/server/assets/js/jquery.codemirror/mode/jade/jade.js +90 -0
- data/server/assets/js/jquery.codemirror/mode/javascript/index.html +107 -0
- data/server/assets/js/jquery.codemirror/mode/javascript/javascript.js +617 -0
- data/server/assets/js/jquery.codemirror/mode/javascript/test.js +72 -0
- data/server/assets/js/jquery.codemirror/mode/javascript/typescript.html +61 -0
- data/server/assets/js/jquery.codemirror/mode/jinja2/index.html +50 -0
- data/server/assets/js/jquery.codemirror/mode/jinja2/jinja2.js +42 -0
- data/server/assets/js/jquery.codemirror/mode/julia/index.html +187 -0
- data/server/assets/js/jquery.codemirror/mode/julia/julia.js +262 -0
- data/server/assets/js/jquery.codemirror/mode/less/index.html +753 -0
- data/server/assets/js/jquery.codemirror/mode/less/less.js +346 -0
- data/server/assets/js/jquery.codemirror/mode/livescript/index.html +459 -0
- data/server/assets/js/jquery.codemirror/mode/livescript/livescript.js +267 -0
- data/server/assets/js/jquery.codemirror/mode/livescript/livescript.ls +266 -0
- data/server/assets/js/jquery.codemirror/mode/lua/index.html +86 -0
- data/server/assets/js/jquery.codemirror/mode/lua/lua.js +144 -0
- data/server/assets/js/jquery.codemirror/mode/markdown/index.html +359 -0
- data/server/assets/js/jquery.codemirror/mode/markdown/markdown.js +560 -0
- data/server/assets/js/jquery.codemirror/mode/markdown/test.js +664 -0
- data/server/assets/js/jquery.codemirror/mode/meta.js +91 -0
- data/server/assets/js/jquery.codemirror/mode/mirc/index.html +161 -0
- data/server/assets/js/jquery.codemirror/mode/mirc/mirc.js +177 -0
- data/server/assets/js/jquery.codemirror/mode/nginx/index.html +181 -0
- data/server/assets/js/jquery.codemirror/mode/nginx/nginx.js +163 -0
- data/server/assets/js/jquery.codemirror/mode/ntriples/index.html +45 -0
- data/server/assets/js/jquery.codemirror/mode/ntriples/ntriples.js +170 -0
- data/server/assets/js/jquery.codemirror/mode/ocaml/index.html +146 -0
- data/server/assets/js/jquery.codemirror/mode/ocaml/ocaml.js +116 -0
- data/server/assets/js/jquery.codemirror/mode/octave/index.html +95 -0
- data/server/assets/js/jquery.codemirror/mode/octave/octave.js +118 -0
- data/server/assets/js/jquery.codemirror/mode/pascal/index.html +61 -0
- data/server/assets/js/jquery.codemirror/mode/pascal/pascal.js +94 -0
- data/server/assets/js/jquery.codemirror/mode/pegjs/index.html +66 -0
- data/server/assets/js/jquery.codemirror/mode/pegjs/pegjs.js +103 -0
- data/server/assets/js/jquery.codemirror/mode/perl/index.html +75 -0
- data/server/assets/js/jquery.codemirror/mode/perl/perl.js +816 -0
- data/server/assets/js/jquery.codemirror/mode/php/index.html +62 -0
- data/server/assets/js/jquery.codemirror/mode/php/php.js +132 -0
- data/server/assets/js/jquery.codemirror/mode/pig/index.html +55 -0
- data/server/assets/js/jquery.codemirror/mode/pig/pig.js +171 -0
- data/server/assets/js/jquery.codemirror/mode/properties/index.html +53 -0
- data/server/assets/js/jquery.codemirror/mode/properties/properties.js +63 -0
- data/server/assets/js/jquery.codemirror/mode/python/index.html +187 -0
- data/server/assets/js/jquery.codemirror/mode/python/python.js +368 -0
- data/server/assets/js/jquery.codemirror/mode/q/index.html +144 -0
- data/server/assets/js/jquery.codemirror/mode/q/q.js +124 -0
- data/server/assets/js/jquery.codemirror/mode/r/index.html +86 -0
- data/server/assets/js/jquery.codemirror/mode/r/r.js +141 -0
- data/server/assets/js/jquery.codemirror/mode/rpm/changes/changes.js +19 -0
- data/server/assets/js/jquery.codemirror/mode/rpm/changes/index.html +67 -0
- data/server/assets/js/jquery.codemirror/mode/rpm/spec/index.html +114 -0
- data/server/assets/js/jquery.codemirror/mode/rpm/spec/spec.css +5 -0
- data/server/assets/js/jquery.codemirror/mode/rpm/spec/spec.js +66 -0
- data/server/assets/js/jquery.codemirror/mode/rst/index.html +534 -0
- data/server/assets/js/jquery.codemirror/mode/rst/rst.js +560 -0
- data/server/assets/js/jquery.codemirror/mode/ruby/index.html +185 -0
- data/server/assets/js/jquery.codemirror/mode/ruby/ruby.js +247 -0
- data/server/assets/js/jquery.codemirror/mode/rust/index.html +61 -0
- data/server/assets/js/jquery.codemirror/mode/rust/rust.js +436 -0
- data/server/assets/js/jquery.codemirror/mode/sass/index.html +66 -0
- data/server/assets/js/jquery.codemirror/mode/sass/sass.js +330 -0
- data/server/assets/js/jquery.codemirror/mode/scheme/index.html +77 -0
- data/server/assets/js/jquery.codemirror/mode/scheme/scheme.js +232 -0
- data/server/assets/js/jquery.codemirror/mode/shell/index.html +66 -0
- data/server/assets/js/jquery.codemirror/mode/shell/shell.js +118 -0
- data/server/assets/js/jquery.codemirror/mode/sieve/index.html +93 -0
- data/server/assets/js/jquery.codemirror/mode/sieve/sieve.js +183 -0
- data/server/assets/js/jquery.codemirror/mode/smalltalk/index.html +68 -0
- data/server/assets/js/jquery.codemirror/mode/smalltalk/smalltalk.js +151 -0
- data/server/assets/js/jquery.codemirror/mode/smarty/index.html +136 -0
- data/server/assets/js/jquery.codemirror/mode/smarty/smarty.js +205 -0
- data/server/assets/js/jquery.codemirror/mode/smartymixed/index.html +114 -0
- data/server/assets/js/jquery.codemirror/mode/smartymixed/smartymixed.js +175 -0
- data/server/assets/js/jquery.codemirror/mode/sparql/index.html +54 -0
- data/server/assets/js/jquery.codemirror/mode/sparql/sparql.js +145 -0
- data/server/assets/js/jquery.codemirror/mode/sql/index.html +75 -0
- data/server/assets/js/jquery.codemirror/mode/sql/sql.js +365 -0
- data/server/assets/js/jquery.codemirror/mode/stex/index.html +110 -0
- data/server/assets/js/jquery.codemirror/mode/stex/stex.js +246 -0
- data/server/assets/js/jquery.codemirror/mode/stex/test.js +120 -0
- data/server/assets/js/jquery.codemirror/mode/tcl/index.html +143 -0
- data/server/assets/js/jquery.codemirror/mode/tcl/tcl.js +131 -0
- data/server/assets/js/jquery.codemirror/mode/tiddlywiki/index.html +155 -0
- data/server/assets/js/jquery.codemirror/mode/tiddlywiki/tiddlywiki.css +14 -0
- data/server/assets/js/jquery.codemirror/mode/tiddlywiki/tiddlywiki.js +353 -0
- data/server/assets/js/jquery.codemirror/mode/tiki/index.html +95 -0
- data/server/assets/js/jquery.codemirror/mode/tiki/tiki.css +26 -0
- data/server/assets/js/jquery.codemirror/mode/tiki/tiki.js +308 -0
- data/server/assets/js/jquery.codemirror/mode/toml/index.html +73 -0
- data/server/assets/js/jquery.codemirror/mode/toml/toml.js +71 -0
- data/server/assets/js/jquery.codemirror/mode/turtle/index.html +51 -0
- data/server/assets/js/jquery.codemirror/mode/turtle/turtle.js +145 -0
- data/server/assets/js/jquery.codemirror/mode/vb/index.html +103 -0
- data/server/assets/js/jquery.codemirror/mode/vb/vb.js +259 -0
- data/server/assets/js/jquery.codemirror/mode/vbscript/index.html +55 -0
- data/server/assets/js/jquery.codemirror/mode/vbscript/vbscript.js +334 -0
- data/server/assets/js/jquery.codemirror/mode/velocity/index.html +119 -0
- data/server/assets/js/jquery.codemirror/mode/velocity/velocity.js +186 -0
- data/server/assets/js/jquery.codemirror/mode/verilog/index.html +132 -0
- data/server/assets/js/jquery.codemirror/mode/verilog/verilog.js +182 -0
- data/server/assets/js/jquery.codemirror/mode/xml/index.html +57 -0
- data/server/assets/js/jquery.codemirror/mode/xml/xml.js +345 -0
- data/server/assets/js/jquery.codemirror/mode/xquery/index.html +210 -0
- data/server/assets/js/jquery.codemirror/mode/xquery/test.js +64 -0
- data/server/assets/js/jquery.codemirror/mode/xquery/xquery.js +432 -0
- data/server/assets/js/jquery.codemirror/mode/yaml/index.html +80 -0
- data/server/assets/js/jquery.codemirror/mode/yaml/yaml.js +97 -0
- data/server/assets/js/jquery.codemirror/mode/z80/index.html +52 -0
- data/server/assets/js/jquery.codemirror/mode/z80/z80.js +85 -0
- data/server/assets/js/jquery.codemirror/package.json +19 -0
- data/server/assets/js/jquery.codemirror/test/comment_test.js +51 -0
- data/server/assets/js/jquery.codemirror/test/doc_test.js +329 -0
- data/server/assets/js/jquery.codemirror/test/driver.js +139 -0
- data/server/assets/js/jquery.codemirror/test/emacs_test.js +135 -0
- data/server/assets/js/jquery.codemirror/test/index.html +209 -0
- data/server/assets/js/jquery.codemirror/test/lint/acorn.js +1593 -0
- data/server/assets/js/jquery.codemirror/test/lint/lint.js +139 -0
- data/server/assets/js/jquery.codemirror/test/lint/walk.js +216 -0
- data/server/assets/js/jquery.codemirror/test/mode_test.css +10 -0
- data/server/assets/js/jquery.codemirror/test/mode_test.js +200 -0
- data/server/assets/js/jquery.codemirror/test/phantom_driver.js +31 -0
- data/server/assets/js/jquery.codemirror/test/run.js +34 -0
- data/server/assets/js/jquery.codemirror/test/test.js +1562 -0
- data/server/assets/js/jquery.codemirror/test/vim_test.js +2391 -0
- data/server/assets/js/jquery.codemirror/theme/3024-day.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/3024-night.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/ambiance-mobile.css +5 -0
- data/server/assets/js/jquery.codemirror/theme/ambiance.css +70 -0
- data/server/assets/js/jquery.codemirror/theme/base16-dark.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/base16-light.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/blackboard.css +28 -0
- data/server/assets/js/jquery.codemirror/theme/cobalt.css +21 -0
- data/server/assets/js/jquery.codemirror/theme/eclipse.css +23 -0
- data/server/assets/js/jquery.codemirror/theme/elegant.css +13 -0
- data/server/assets/js/jquery.codemirror/theme/erlang-dark.css +30 -0
- data/server/assets/js/jquery.codemirror/theme/lesser-dark.css +47 -0
- data/server/assets/js/jquery.codemirror/theme/mbo.css +37 -0
- data/server/assets/js/jquery.codemirror/theme/midnight.css +43 -0
- data/server/assets/js/jquery.codemirror/theme/monokai.css +29 -0
- data/server/assets/js/jquery.codemirror/theme/neat.css +12 -0
- data/server/assets/js/jquery.codemirror/theme/night.css +24 -0
- data/server/assets/js/jquery.codemirror/theme/paraiso-dark.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/paraiso-light.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/rubyblue.css +23 -0
- data/server/assets/js/jquery.codemirror/theme/solarized.css +180 -0
- data/server/assets/js/jquery.codemirror/theme/the-matrix.css +26 -0
- data/server/assets/js/jquery.codemirror/theme/tomorrow-night-eighties.css +34 -0
- data/server/assets/js/jquery.codemirror/theme/twilight.css +28 -0
- data/server/assets/js/jquery.codemirror/theme/vibrant-ink.css +30 -0
- data/server/assets/js/jquery.codemirror/theme/xq-dark.css +49 -0
- data/server/assets/js/jquery.codemirror/theme/xq-light.css +43 -0
- data/server/assets/js/jquery.js +4 -0
- data/server/assets/js/jquery.nanoscroller/jquery.nanoscroller.js +2 -0
- data/server/assets/js/jquery.nanoscroller/nanoscroller.css +49 -0
- data/server/assets/js/tester.js +161 -0
- data/server/config.ru +2 -0
- data/server/server.rb +41 -0
- data/server/views/_content.erb +65 -0
- data/server/views/_sidebar.erb +32 -0
- data/server/views/index.erb +40 -0
- metadata +402 -0
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
|
|
3
|
+
<title>CodeMirror: HTTP mode</title>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<link rel=stylesheet href="../../doc/docs.css">
|
|
6
|
+
|
|
7
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
8
|
+
<script src="../../lib/codemirror.js"></script>
|
|
9
|
+
<script src="http.js"></script>
|
|
10
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
11
|
+
<div id=nav>
|
|
12
|
+
<a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
|
|
13
|
+
|
|
14
|
+
<ul>
|
|
15
|
+
<li><a href="../../index.html">Home</a>
|
|
16
|
+
<li><a href="../../doc/manual.html">Manual</a>
|
|
17
|
+
<li><a href="https://github.com/marijnh/codemirror">Code</a>
|
|
18
|
+
</ul>
|
|
19
|
+
<ul>
|
|
20
|
+
<li><a href="../index.html">Language modes</a>
|
|
21
|
+
<li><a class=active href="#">HTTP</a>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<article>
|
|
26
|
+
<h2>HTTP mode</h2>
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<div><textarea id="code" name="code">
|
|
30
|
+
POST /somewhere HTTP/1.1
|
|
31
|
+
Host: example.com
|
|
32
|
+
If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
|
|
33
|
+
Content-Type: application/x-www-form-urlencoded;
|
|
34
|
+
charset=utf-8
|
|
35
|
+
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/536.11 (KHTML, like Gecko) Ubuntu/12.04 Chromium/20.0.1132.47 Chrome/20.0.1132.47 Safari/536.11
|
|
36
|
+
|
|
37
|
+
This is the request body!
|
|
38
|
+
</textarea></div>
|
|
39
|
+
|
|
40
|
+
<script>
|
|
41
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {});
|
|
42
|
+
</script>
|
|
43
|
+
|
|
44
|
+
<p><strong>MIME types defined:</strong> <code>message/http</code>.</p>
|
|
45
|
+
</article>
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
|
|
3
|
+
<title>CodeMirror: Language Modes</title>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<link rel=stylesheet href="../doc/docs.css">
|
|
6
|
+
|
|
7
|
+
<div id=nav>
|
|
8
|
+
<a href="http://codemirror.net"><img id=logo src="../doc/logo.png"></a>
|
|
9
|
+
|
|
10
|
+
<ul>
|
|
11
|
+
<li><a href="../index.html">Home</a>
|
|
12
|
+
<li><a href="../doc/manual.html">Manual</a>
|
|
13
|
+
<li><a href="https://github.com/marijnh/codemirror">Code</a>
|
|
14
|
+
</ul>
|
|
15
|
+
<ul>
|
|
16
|
+
<li><a class=active href="#">Language modes</a>
|
|
17
|
+
</ul>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<article>
|
|
21
|
+
|
|
22
|
+
<h2>Language modes</h2>
|
|
23
|
+
|
|
24
|
+
<p>This is a list of every mode in the distribution. Each mode lives
|
|
25
|
+
in a subdirectory of the <code>mode/</code> directory, and typically
|
|
26
|
+
defines a single JavaScript file that implements the mode. Loading
|
|
27
|
+
such file will make the language available to CodeMirror, through
|
|
28
|
+
the <a href="manual.html#option_mode"><code>mode</code></a>
|
|
29
|
+
option.</p>
|
|
30
|
+
|
|
31
|
+
<div style="-webkit-columns: 100px 2; -moz-columns: 100px 2; columns: 100px 2;">
|
|
32
|
+
<ul>
|
|
33
|
+
<li><a href="apl/index.html">APL</a></li>
|
|
34
|
+
<li><a href="asterisk/index.html">Asterisk dialplan</a></li>
|
|
35
|
+
<li><a href="clike/index.html">C, C++, C#</a></li>
|
|
36
|
+
<li><a href="clojure/index.html">Clojure</a></li>
|
|
37
|
+
<li><a href="cobol/index.html">COBOL</a></li>
|
|
38
|
+
<li><a href="coffeescript/index.html">CoffeeScript</a></li>
|
|
39
|
+
<li><a href="commonlisp/index.html">Common Lisp</a></li>
|
|
40
|
+
<li><a href="css/index.html">CSS</a></li>
|
|
41
|
+
<li><a href="python/index.html">Cython</a></li>
|
|
42
|
+
<li><a href="d/index.html">D</a></li>
|
|
43
|
+
<li><a href="diff/index.html">diff</a></li>
|
|
44
|
+
<li><a href="dtd/index.html">DTD</a></li>
|
|
45
|
+
<li><a href="ecl/index.html">ECL</a></li>
|
|
46
|
+
<li><a href="eiffel/index.html">Eiffel</a></li>
|
|
47
|
+
<li><a href="erlang/index.html">Erlang</a></li>
|
|
48
|
+
<li><a href="fortran/index.html">Fortran</a></li>
|
|
49
|
+
<li><a href="gas/index.html">Gas</a> (AT&T-style assembly)</li>
|
|
50
|
+
<li><a href="gherkin/index.html">Gherkin</a></li>
|
|
51
|
+
<li><a href="go/index.html">Go</a></li>
|
|
52
|
+
<li><a href="groovy/index.html">Groovy</a></li>
|
|
53
|
+
<li><a href="haml/index.html">HAML</a></li>
|
|
54
|
+
<li><a href="haskell/index.html">Haskell</a></li>
|
|
55
|
+
<li><a href="haxe/index.html">Haxe</a></li>
|
|
56
|
+
<li><a href="htmlembedded/index.html">HTML embedded scripts</a></li>
|
|
57
|
+
<li><a href="htmlmixed/index.html">HTML mixed-mode</a></li>
|
|
58
|
+
<li><a href="http/index.html">HTTP</a></li>
|
|
59
|
+
<li><a href="clike/index.html">Java</a></li>
|
|
60
|
+
<li><a href="jade/index.html">Jade</a></li>
|
|
61
|
+
<li><a href="javascript/index.html">JavaScript</a></li>
|
|
62
|
+
<li><a href="jinja2/index.html">Jinja2</a></li>
|
|
63
|
+
<li><a href="julia/index.html">Julia</a></li>
|
|
64
|
+
<li><a href="less/index.html">LESS</a></li>
|
|
65
|
+
<li><a href="livescript/index.html">LiveScript</a></li>
|
|
66
|
+
<li><a href="lua/index.html">Lua</a></li>
|
|
67
|
+
<li><a href="markdown/index.html">Markdown</a> (<a href="gfm/index.html">GitHub-flavour</a>)</li>
|
|
68
|
+
<li><a href="mirc/index.html">mIRC</a></li>
|
|
69
|
+
<li><a href="nginx/index.html">Nginx</a></li>
|
|
70
|
+
<li><a href="ntriples/index.html">NTriples</a></li>
|
|
71
|
+
<li><a href="ocaml/index.html">OCaml</a></li>
|
|
72
|
+
<li><a href="octave/index.html">Octave</a> (MATLAB)</li>
|
|
73
|
+
<li><a href="pascal/index.html">Pascal</a></li>
|
|
74
|
+
<li><a href="pegjs/index.html">PEG.js</a></li>
|
|
75
|
+
<li><a href="perl/index.html">Perl</a></li>
|
|
76
|
+
<li><a href="php/index.html">PHP</a></li>
|
|
77
|
+
<li><a href="pig/index.html">Pig Latin</a></li>
|
|
78
|
+
<li><a href="properties/index.html">Properties files</a></li>
|
|
79
|
+
<li><a href="python/index.html">Python</a></li>
|
|
80
|
+
<li><a href="q/index.html">Q</a></li>
|
|
81
|
+
<li><a href="r/index.html">R</a></li>
|
|
82
|
+
<li>RPM <a href="rpm/spec/index.html">spec</a> and <a href="rpm/changes/index.html">changelog</a></li>
|
|
83
|
+
<li><a href="rst/index.html">reStructuredText</a></li>
|
|
84
|
+
<li><a href="ruby/index.html">Ruby</a></li>
|
|
85
|
+
<li><a href="rust/index.html">Rust</a></li>
|
|
86
|
+
<li><a href="sass/index.html">Sass</a></li>
|
|
87
|
+
<li><a href="clike/scala.html">Scala</a></li>
|
|
88
|
+
<li><a href="scheme/index.html">Scheme</a></li>
|
|
89
|
+
<li><a href="css/scss.html">SCSS</a></li>
|
|
90
|
+
<li><a href="shell/index.html">Shell</a></li>
|
|
91
|
+
<li><a href="sieve/index.html">Sieve</a></li>
|
|
92
|
+
<li><a href="smalltalk/index.html">Smalltalk</a></li>
|
|
93
|
+
<li><a href="smarty/index.html">Smarty</a></li>
|
|
94
|
+
<li><a href="smartymixed/index.html">Smarty/HTML mixed</a></li>
|
|
95
|
+
<li><a href="sql/index.html">SQL</a> (several dialects)</li>
|
|
96
|
+
<li><a href="sparql/index.html">SPARQL</a></li>
|
|
97
|
+
<li><a href="stex/index.html">sTeX, LaTeX</a></li>
|
|
98
|
+
<li><a href="tcl/index.html">Tcl</a></li>
|
|
99
|
+
<li><a href="tiddlywiki/index.html">Tiddlywiki</a></li>
|
|
100
|
+
<li><a href="tiki/index.html">Tiki wiki</a></li>
|
|
101
|
+
<li><a href="toml/index.html">TOML</a></li>
|
|
102
|
+
<li><a href="turtle/index.html">Turtle</a></li>
|
|
103
|
+
<li><a href="vb/index.html">VB.NET</a></li>
|
|
104
|
+
<li><a href="vbscript/index.html">VBScript</a></li>
|
|
105
|
+
<li><a href="velocity/index.html">Velocity</a></li>
|
|
106
|
+
<li><a href="verilog/index.html">Verilog</a></li>
|
|
107
|
+
<li><a href="xml/index.html">XML/HTML</a></li>
|
|
108
|
+
<li><a href="xquery/index.html">XQuery</a></li>
|
|
109
|
+
<li><a href="yaml/index.html">YAML</a></li>
|
|
110
|
+
<li><a href="z80/index.html">Z80</a></li>
|
|
111
|
+
</ul>
|
|
112
|
+
</div>
|
|
113
|
+
|
|
114
|
+
</article>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
|
|
3
|
+
<title>CodeMirror: Jade Templating Mode</title>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<link rel=stylesheet href="../../doc/docs.css">
|
|
6
|
+
|
|
7
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
8
|
+
<script src="../../lib/codemirror.js"></script>
|
|
9
|
+
<script src="jade.js"></script>
|
|
10
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
11
|
+
<div id=nav>
|
|
12
|
+
<a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
|
|
13
|
+
|
|
14
|
+
<ul>
|
|
15
|
+
<li><a href="../../index.html">Home</a>
|
|
16
|
+
<li><a href="../../doc/manual.html">Manual</a>
|
|
17
|
+
<li><a href="https://github.com/marijnh/codemirror">Code</a>
|
|
18
|
+
</ul>
|
|
19
|
+
<ul>
|
|
20
|
+
<li><a href="../index.html">Language modes</a>
|
|
21
|
+
<li><a class=active href="#">Jade Templating Mode</a>
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<article>
|
|
26
|
+
<h2>Jade Templating Mode</h2>
|
|
27
|
+
<form><textarea id="code" name="code">
|
|
28
|
+
doctype 5
|
|
29
|
+
html
|
|
30
|
+
head
|
|
31
|
+
title= "Jade Templating CodeMirror Mode Example"
|
|
32
|
+
link(rel='stylesheet', href='/css/bootstrap.min.css')
|
|
33
|
+
link(rel='stylesheet', href='/css/index.css')
|
|
34
|
+
script(type='text/javascript', src='/js/jquery-1.9.1.min.js')
|
|
35
|
+
script(type='text/javascript', src='/js/bootstrap.min.js')
|
|
36
|
+
body
|
|
37
|
+
div.header
|
|
38
|
+
h1 Welcome to this Example
|
|
39
|
+
div.spots
|
|
40
|
+
if locals.spots
|
|
41
|
+
each spot in spots
|
|
42
|
+
div.spot.well
|
|
43
|
+
div
|
|
44
|
+
if spot.logo
|
|
45
|
+
img.img-rounded.logo(src=spot.logo)
|
|
46
|
+
else
|
|
47
|
+
img.img-rounded.logo(src="img/placeholder.png")
|
|
48
|
+
h3
|
|
49
|
+
a(href=spot.hash) ##{spot.hash}
|
|
50
|
+
if spot.title
|
|
51
|
+
span.title #{spot.title}
|
|
52
|
+
if spot.desc
|
|
53
|
+
div #{spot.desc}
|
|
54
|
+
else
|
|
55
|
+
h3 There are no spots currently available.
|
|
56
|
+
</textarea></form>
|
|
57
|
+
<script>
|
|
58
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
59
|
+
mode: {name: "jade", alignCDATA: true},
|
|
60
|
+
lineNumbers: true
|
|
61
|
+
});
|
|
62
|
+
</script>
|
|
63
|
+
<h3>The Jade Templating Mode</h3>
|
|
64
|
+
<p> Created by Drew Bratcher. Managed as part of an Adobe Brackets extension at <a href="https://github.com/dbratcher/brackets-jade">https://github.com/dbratcher/brackets-jade</a>.</p>
|
|
65
|
+
<p><strong>MIME type defined:</strong> <code>text/x-jade</code>.</p>
|
|
66
|
+
</article>
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
CodeMirror.defineMode("jade", function () {
|
|
2
|
+
var symbol_regex1 = /^(?:~|!|%|\^|\*|\+|=|\\|:|;|,|\/|\?|&|<|>|\|)/;
|
|
3
|
+
var open_paren_regex = /^(\(|\[)/;
|
|
4
|
+
var close_paren_regex = /^(\)|\])/;
|
|
5
|
+
var keyword_regex1 = /^(if|else|return|var|function|include|doctype|each)/;
|
|
6
|
+
var keyword_regex2 = /^(#|{|}|\.)/;
|
|
7
|
+
var keyword_regex3 = /^(in)/;
|
|
8
|
+
var html_regex1 = /^(html|head|title|meta|link|script|body|br|div|input|span|a|img)/;
|
|
9
|
+
var html_regex2 = /^(h1|h2|h3|h4|h5|p|strong|em)/;
|
|
10
|
+
return {
|
|
11
|
+
startState: function () {
|
|
12
|
+
return {
|
|
13
|
+
inString: false,
|
|
14
|
+
stringType: "",
|
|
15
|
+
beforeTag: true,
|
|
16
|
+
justMatchedKeyword: false,
|
|
17
|
+
afterParen: false
|
|
18
|
+
};
|
|
19
|
+
},
|
|
20
|
+
token: function (stream, state) {
|
|
21
|
+
//check for state changes
|
|
22
|
+
if (!state.inString && ((stream.peek() == '"') || (stream.peek() == "'"))) {
|
|
23
|
+
state.stringType = stream.peek();
|
|
24
|
+
stream.next(); // Skip quote
|
|
25
|
+
state.inString = true; // Update state
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//return state
|
|
29
|
+
if (state.inString) {
|
|
30
|
+
if (stream.skipTo(state.stringType)) { // Quote found on this line
|
|
31
|
+
stream.next(); // Skip quote
|
|
32
|
+
state.inString = false; // Clear flag
|
|
33
|
+
} else {
|
|
34
|
+
stream.skipToEnd(); // Rest of line is string
|
|
35
|
+
}
|
|
36
|
+
state.justMatchedKeyword = false;
|
|
37
|
+
return "string"; // Token style
|
|
38
|
+
} else if (stream.sol() && stream.eatSpace()) {
|
|
39
|
+
if (stream.match(keyword_regex1)) {
|
|
40
|
+
state.justMatchedKeyword = true;
|
|
41
|
+
stream.eatSpace();
|
|
42
|
+
return "keyword";
|
|
43
|
+
}
|
|
44
|
+
if (stream.match(html_regex1) || stream.match(html_regex2)) {
|
|
45
|
+
state.justMatchedKeyword = true;
|
|
46
|
+
return "variable";
|
|
47
|
+
}
|
|
48
|
+
} else if (stream.sol() && stream.match(keyword_regex1)) {
|
|
49
|
+
state.justMatchedKeyword = true;
|
|
50
|
+
stream.eatSpace();
|
|
51
|
+
return "keyword";
|
|
52
|
+
} else if (stream.sol() && (stream.match(html_regex1) || stream.match(html_regex2))) {
|
|
53
|
+
state.justMatchedKeyword = true;
|
|
54
|
+
return "variable";
|
|
55
|
+
} else if (stream.eatSpace()) {
|
|
56
|
+
state.justMatchedKeyword = false;
|
|
57
|
+
if (stream.match(keyword_regex3) && stream.eatSpace()) {
|
|
58
|
+
state.justMatchedKeyword = true;
|
|
59
|
+
return "keyword";
|
|
60
|
+
}
|
|
61
|
+
} else if (stream.match(symbol_regex1)) {
|
|
62
|
+
state.justMatchedKeyword = false;
|
|
63
|
+
return "atom";
|
|
64
|
+
} else if (stream.match(open_paren_regex)) {
|
|
65
|
+
state.afterParen = true;
|
|
66
|
+
state.justMatchedKeyword = true;
|
|
67
|
+
return "def";
|
|
68
|
+
} else if (stream.match(close_paren_regex)) {
|
|
69
|
+
state.afterParen = false;
|
|
70
|
+
state.justMatchedKeyword = true;
|
|
71
|
+
return "def";
|
|
72
|
+
} else if (stream.match(keyword_regex2)) {
|
|
73
|
+
state.justMatchedKeyword = true;
|
|
74
|
+
return "keyword";
|
|
75
|
+
} else if (stream.eatSpace()) {
|
|
76
|
+
state.justMatchedKeyword = false;
|
|
77
|
+
} else {
|
|
78
|
+
stream.next();
|
|
79
|
+
if (state.justMatchedKeyword) {
|
|
80
|
+
return "property";
|
|
81
|
+
} else if (state.afterParen) {
|
|
82
|
+
return "property";
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
CodeMirror.defineMIME('text/x-jade', 'jade');
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
|
|
3
|
+
<title>CodeMirror: JavaScript mode</title>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<link rel=stylesheet href="../../doc/docs.css">
|
|
6
|
+
|
|
7
|
+
<link rel="stylesheet" href="../../lib/codemirror.css">
|
|
8
|
+
<script src="../../lib/codemirror.js"></script>
|
|
9
|
+
<script src="../../addon/edit/matchbrackets.js"></script>
|
|
10
|
+
<script src="../../addon/comment/continuecomment.js"></script>
|
|
11
|
+
<script src="../../addon/comment/comment.js"></script>
|
|
12
|
+
<script src="javascript.js"></script>
|
|
13
|
+
<style type="text/css">.CodeMirror {border-top: 1px solid black; border-bottom: 1px solid black;}</style>
|
|
14
|
+
<div id=nav>
|
|
15
|
+
<a href="http://codemirror.net"><img id=logo src="../../doc/logo.png"></a>
|
|
16
|
+
|
|
17
|
+
<ul>
|
|
18
|
+
<li><a href="../../index.html">Home</a>
|
|
19
|
+
<li><a href="../../doc/manual.html">Manual</a>
|
|
20
|
+
<li><a href="https://github.com/marijnh/codemirror">Code</a>
|
|
21
|
+
</ul>
|
|
22
|
+
<ul>
|
|
23
|
+
<li><a href="../index.html">Language modes</a>
|
|
24
|
+
<li><a class=active href="#">JavaScript</a>
|
|
25
|
+
</ul>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<article>
|
|
29
|
+
<h2>JavaScript mode</h2>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div><textarea id="code" name="code">
|
|
33
|
+
// Demo code (the actual new parser character stream implementation)
|
|
34
|
+
|
|
35
|
+
function StringStream(string) {
|
|
36
|
+
this.pos = 0;
|
|
37
|
+
this.string = string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
StringStream.prototype = {
|
|
41
|
+
done: function() {return this.pos >= this.string.length;},
|
|
42
|
+
peek: function() {return this.string.charAt(this.pos);},
|
|
43
|
+
next: function() {
|
|
44
|
+
if (this.pos < this.string.length)
|
|
45
|
+
return this.string.charAt(this.pos++);
|
|
46
|
+
},
|
|
47
|
+
eat: function(match) {
|
|
48
|
+
var ch = this.string.charAt(this.pos);
|
|
49
|
+
if (typeof match == "string") var ok = ch == match;
|
|
50
|
+
else var ok = ch && match.test ? match.test(ch) : match(ch);
|
|
51
|
+
if (ok) {this.pos++; return ch;}
|
|
52
|
+
},
|
|
53
|
+
eatWhile: function(match) {
|
|
54
|
+
var start = this.pos;
|
|
55
|
+
while (this.eat(match));
|
|
56
|
+
if (this.pos > start) return this.string.slice(start, this.pos);
|
|
57
|
+
},
|
|
58
|
+
backUp: function(n) {this.pos -= n;},
|
|
59
|
+
column: function() {return this.pos;},
|
|
60
|
+
eatSpace: function() {
|
|
61
|
+
var start = this.pos;
|
|
62
|
+
while (/\s/.test(this.string.charAt(this.pos))) this.pos++;
|
|
63
|
+
return this.pos - start;
|
|
64
|
+
},
|
|
65
|
+
match: function(pattern, consume, caseInsensitive) {
|
|
66
|
+
if (typeof pattern == "string") {
|
|
67
|
+
function cased(str) {return caseInsensitive ? str.toLowerCase() : str;}
|
|
68
|
+
if (cased(this.string).indexOf(cased(pattern), this.pos) == this.pos) {
|
|
69
|
+
if (consume !== false) this.pos += str.length;
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
var match = this.string.slice(this.pos).match(pattern);
|
|
75
|
+
if (match && consume !== false) this.pos += match[0].length;
|
|
76
|
+
return match;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
</textarea></div>
|
|
81
|
+
|
|
82
|
+
<script>
|
|
83
|
+
var editor = CodeMirror.fromTextArea(document.getElementById("code"), {
|
|
84
|
+
lineNumbers: true,
|
|
85
|
+
matchBrackets: true,
|
|
86
|
+
continueComments: "Enter",
|
|
87
|
+
extraKeys: {"Ctrl-Q": "toggleComment"}
|
|
88
|
+
});
|
|
89
|
+
</script>
|
|
90
|
+
|
|
91
|
+
<p>
|
|
92
|
+
JavaScript mode supports a two configuration
|
|
93
|
+
options:
|
|
94
|
+
<ul>
|
|
95
|
+
<li><code>json</code> which will set the mode to expect JSON
|
|
96
|
+
data rather than a JavaScript program.</li>
|
|
97
|
+
<li><code>typescript</code> which will activate additional
|
|
98
|
+
syntax highlighting and some other things for TypeScript code
|
|
99
|
+
(<a href="typescript.html">demo</a>).</li>
|
|
100
|
+
<li><code>statementIndent</code> which (given a number) will
|
|
101
|
+
determine the amount of indentation to use for statements
|
|
102
|
+
continued on a new line.</li>
|
|
103
|
+
</ul>
|
|
104
|
+
</p>
|
|
105
|
+
|
|
106
|
+
<p><strong>MIME types defined:</strong> <code>text/javascript</code>, <code>application/json</code>, <code>text/typescript</code>, <code>application/typescript</code>.</p>
|
|
107
|
+
</article>
|
|
@@ -0,0 +1,617 @@
|
|
|
1
|
+
// TODO actually recognize syntax of TypeScript constructs
|
|
2
|
+
|
|
3
|
+
CodeMirror.defineMode("javascript", function(config, parserConfig) {
|
|
4
|
+
var indentUnit = config.indentUnit;
|
|
5
|
+
var statementIndent = parserConfig.statementIndent;
|
|
6
|
+
var jsonMode = parserConfig.json;
|
|
7
|
+
var isTS = parserConfig.typescript;
|
|
8
|
+
|
|
9
|
+
// Tokenizer
|
|
10
|
+
|
|
11
|
+
var keywords = function(){
|
|
12
|
+
function kw(type) {return {type: type, style: "keyword"};}
|
|
13
|
+
var A = kw("keyword a"), B = kw("keyword b"), C = kw("keyword c");
|
|
14
|
+
var operator = kw("operator"), atom = {type: "atom", style: "atom"};
|
|
15
|
+
|
|
16
|
+
var jsKeywords = {
|
|
17
|
+
"if": kw("if"), "while": A, "with": A, "else": B, "do": B, "try": B, "finally": B,
|
|
18
|
+
"return": C, "break": C, "continue": C, "new": C, "delete": C, "throw": C,
|
|
19
|
+
"var": kw("var"), "const": kw("var"), "let": kw("var"),
|
|
20
|
+
"function": kw("function"), "catch": kw("catch"),
|
|
21
|
+
"for": kw("for"), "switch": kw("switch"), "case": kw("case"), "default": kw("default"),
|
|
22
|
+
"in": operator, "typeof": operator, "instanceof": operator,
|
|
23
|
+
"true": atom, "false": atom, "null": atom, "undefined": atom, "NaN": atom, "Infinity": atom,
|
|
24
|
+
"this": kw("this"), "module": kw("module"), "class": kw("class"), "super": kw("atom"),
|
|
25
|
+
"yield": C, "export": kw("export"), "import": kw("import"), "extends": C
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// Extend the 'normal' keywords with the TypeScript language extensions
|
|
29
|
+
if (isTS) {
|
|
30
|
+
var type = {type: "variable", style: "variable-3"};
|
|
31
|
+
var tsKeywords = {
|
|
32
|
+
// object-like things
|
|
33
|
+
"interface": kw("interface"),
|
|
34
|
+
"extends": kw("extends"),
|
|
35
|
+
"constructor": kw("constructor"),
|
|
36
|
+
|
|
37
|
+
// scope modifiers
|
|
38
|
+
"public": kw("public"),
|
|
39
|
+
"private": kw("private"),
|
|
40
|
+
"protected": kw("protected"),
|
|
41
|
+
"static": kw("static"),
|
|
42
|
+
|
|
43
|
+
// types
|
|
44
|
+
"string": type, "number": type, "bool": type, "any": type
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
for (var attr in tsKeywords) {
|
|
48
|
+
jsKeywords[attr] = tsKeywords[attr];
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return jsKeywords;
|
|
53
|
+
}();
|
|
54
|
+
|
|
55
|
+
var isOperatorChar = /[+\-*&%=<>!?|~^]/;
|
|
56
|
+
|
|
57
|
+
function nextUntilUnescaped(stream, end) {
|
|
58
|
+
var escaped = false, next;
|
|
59
|
+
while ((next = stream.next()) != null) {
|
|
60
|
+
if (next == end && !escaped)
|
|
61
|
+
return false;
|
|
62
|
+
escaped = !escaped && next == "\\";
|
|
63
|
+
}
|
|
64
|
+
return escaped;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Used as scratch variables to communicate multiple values without
|
|
68
|
+
// consing up tons of objects.
|
|
69
|
+
var type, content;
|
|
70
|
+
function ret(tp, style, cont) {
|
|
71
|
+
type = tp; content = cont;
|
|
72
|
+
return style;
|
|
73
|
+
}
|
|
74
|
+
function tokenBase(stream, state) {
|
|
75
|
+
var ch = stream.next();
|
|
76
|
+
if (ch == '"' || ch == "'") {
|
|
77
|
+
state.tokenize = tokenString(ch);
|
|
78
|
+
return state.tokenize(stream, state);
|
|
79
|
+
} else if (ch == "." && stream.match(/^\d+(?:[eE][+\-]?\d+)?/)) {
|
|
80
|
+
return ret("number", "number");
|
|
81
|
+
} else if (ch == "." && stream.match("..")) {
|
|
82
|
+
return ret("spread", "meta");
|
|
83
|
+
} else if (/[\[\]{}\(\),;\:\.]/.test(ch)) {
|
|
84
|
+
return ret(ch);
|
|
85
|
+
} else if (ch == "=" && stream.eat(">")) {
|
|
86
|
+
return ret("=>");
|
|
87
|
+
} else if (ch == "0" && stream.eat(/x/i)) {
|
|
88
|
+
stream.eatWhile(/[\da-f]/i);
|
|
89
|
+
return ret("number", "number");
|
|
90
|
+
} else if (/\d/.test(ch)) {
|
|
91
|
+
stream.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/);
|
|
92
|
+
return ret("number", "number");
|
|
93
|
+
} else if (ch == "/") {
|
|
94
|
+
if (stream.eat("*")) {
|
|
95
|
+
state.tokenize = tokenComment;
|
|
96
|
+
return tokenComment(stream, state);
|
|
97
|
+
} else if (stream.eat("/")) {
|
|
98
|
+
stream.skipToEnd();
|
|
99
|
+
return ret("comment", "comment");
|
|
100
|
+
} else if (state.lastType == "operator" || state.lastType == "keyword c" ||
|
|
101
|
+
state.lastType == "sof" || /^[\[{}\(,;:]$/.test(state.lastType)) {
|
|
102
|
+
nextUntilUnescaped(stream, "/");
|
|
103
|
+
stream.eatWhile(/[gimy]/); // 'y' is "sticky" option in Mozilla
|
|
104
|
+
return ret("regexp", "string-2");
|
|
105
|
+
} else {
|
|
106
|
+
stream.eatWhile(isOperatorChar);
|
|
107
|
+
return ret("operator", null, stream.current());
|
|
108
|
+
}
|
|
109
|
+
} else if (ch == "`") {
|
|
110
|
+
state.tokenize = tokenQuasi;
|
|
111
|
+
return tokenQuasi(stream, state);
|
|
112
|
+
} else if (ch == "#") {
|
|
113
|
+
stream.skipToEnd();
|
|
114
|
+
return ret("error", "error");
|
|
115
|
+
} else if (isOperatorChar.test(ch)) {
|
|
116
|
+
stream.eatWhile(isOperatorChar);
|
|
117
|
+
return ret("operator", null, stream.current());
|
|
118
|
+
} else {
|
|
119
|
+
stream.eatWhile(/[\w\$_]/);
|
|
120
|
+
var word = stream.current(), known = keywords.propertyIsEnumerable(word) && keywords[word];
|
|
121
|
+
return (known && state.lastType != ".") ? ret(known.type, known.style, word) :
|
|
122
|
+
ret("variable", "variable", word);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function tokenString(quote) {
|
|
127
|
+
return function(stream, state) {
|
|
128
|
+
if (!nextUntilUnescaped(stream, quote))
|
|
129
|
+
state.tokenize = tokenBase;
|
|
130
|
+
return ret("string", "string");
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function tokenComment(stream, state) {
|
|
135
|
+
var maybeEnd = false, ch;
|
|
136
|
+
while (ch = stream.next()) {
|
|
137
|
+
if (ch == "/" && maybeEnd) {
|
|
138
|
+
state.tokenize = tokenBase;
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
maybeEnd = (ch == "*");
|
|
142
|
+
}
|
|
143
|
+
return ret("comment", "comment");
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
function tokenQuasi(stream, state) {
|
|
147
|
+
var escaped = false, next;
|
|
148
|
+
while ((next = stream.next()) != null) {
|
|
149
|
+
if (!escaped && (next == "`" || next == "$" && stream.eat("{"))) {
|
|
150
|
+
state.tokenize = tokenBase;
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
escaped = !escaped && next == "\\";
|
|
154
|
+
}
|
|
155
|
+
return ret("quasi", "string-2", stream.current());
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
var brackets = "([{}])";
|
|
159
|
+
// This is a crude lookahead trick to try and notice that we're
|
|
160
|
+
// parsing the argument patterns for a fat-arrow function before we
|
|
161
|
+
// actually hit the arrow token. It only works if the arrow is on
|
|
162
|
+
// the same line as the arguments and there's no strange noise
|
|
163
|
+
// (comments) in between. Fallback is to only notice when we hit the
|
|
164
|
+
// arrow, and not declare the arguments as locals for the arrow
|
|
165
|
+
// body.
|
|
166
|
+
function findFatArrow(stream, state) {
|
|
167
|
+
if (state.fatArrowAt) state.fatArrowAt = null;
|
|
168
|
+
var arrow = stream.string.indexOf("=>", stream.start);
|
|
169
|
+
if (arrow < 0) return;
|
|
170
|
+
|
|
171
|
+
var depth = 0, sawSomething = false;
|
|
172
|
+
for (var pos = arrow - 1; pos >= 0; --pos) {
|
|
173
|
+
var ch = stream.string.charAt(pos);
|
|
174
|
+
var bracket = brackets.indexOf(ch);
|
|
175
|
+
if (bracket >= 0 && bracket < 3) {
|
|
176
|
+
if (!depth) { ++pos; break; }
|
|
177
|
+
if (--depth == 0) break;
|
|
178
|
+
} else if (bracket >= 3 && bracket < 6) {
|
|
179
|
+
++depth;
|
|
180
|
+
} else if (/[$\w]/.test(ch)) {
|
|
181
|
+
sawSomething = true;
|
|
182
|
+
} else if (sawSomething && !depth) {
|
|
183
|
+
++pos;
|
|
184
|
+
break;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
if (sawSomething && !depth) state.fatArrowAt = pos;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// Parser
|
|
191
|
+
|
|
192
|
+
var atomicTypes = {"atom": true, "number": true, "variable": true, "string": true, "regexp": true, "this": true};
|
|
193
|
+
|
|
194
|
+
function JSLexical(indented, column, type, align, prev, info) {
|
|
195
|
+
this.indented = indented;
|
|
196
|
+
this.column = column;
|
|
197
|
+
this.type = type;
|
|
198
|
+
this.prev = prev;
|
|
199
|
+
this.info = info;
|
|
200
|
+
if (align != null) this.align = align;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function inScope(state, varname) {
|
|
204
|
+
for (var v = state.localVars; v; v = v.next)
|
|
205
|
+
if (v.name == varname) return true;
|
|
206
|
+
for (var cx = state.context; cx; cx = cx.prev) {
|
|
207
|
+
for (var v = cx.vars; v; v = v.next)
|
|
208
|
+
if (v.name == varname) return true;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
function parseJS(state, style, type, content, stream) {
|
|
213
|
+
var cc = state.cc;
|
|
214
|
+
// Communicate our context to the combinators.
|
|
215
|
+
// (Less wasteful than consing up a hundred closures on every call.)
|
|
216
|
+
cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc;
|
|
217
|
+
|
|
218
|
+
if (!state.lexical.hasOwnProperty("align"))
|
|
219
|
+
state.lexical.align = true;
|
|
220
|
+
|
|
221
|
+
while(true) {
|
|
222
|
+
var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;
|
|
223
|
+
if (combinator(type, content)) {
|
|
224
|
+
while(cc.length && cc[cc.length - 1].lex)
|
|
225
|
+
cc.pop()();
|
|
226
|
+
if (cx.marked) return cx.marked;
|
|
227
|
+
if (type == "variable" && inScope(state, content)) return "variable-2";
|
|
228
|
+
return style;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// Combinator utils
|
|
234
|
+
|
|
235
|
+
var cx = {state: null, column: null, marked: null, cc: null};
|
|
236
|
+
function pass() {
|
|
237
|
+
for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
|
|
238
|
+
}
|
|
239
|
+
function cont() {
|
|
240
|
+
pass.apply(null, arguments);
|
|
241
|
+
return true;
|
|
242
|
+
}
|
|
243
|
+
function register(varname) {
|
|
244
|
+
function inList(list) {
|
|
245
|
+
for (var v = list; v; v = v.next)
|
|
246
|
+
if (v.name == varname) return true;
|
|
247
|
+
return false;
|
|
248
|
+
}
|
|
249
|
+
var state = cx.state;
|
|
250
|
+
if (state.context) {
|
|
251
|
+
cx.marked = "def";
|
|
252
|
+
if (inList(state.localVars)) return;
|
|
253
|
+
state.localVars = {name: varname, next: state.localVars};
|
|
254
|
+
} else {
|
|
255
|
+
if (inList(state.globalVars)) return;
|
|
256
|
+
if (parserConfig.globalVars)
|
|
257
|
+
state.globalVars = {name: varname, next: state.globalVars};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
// Combinators
|
|
262
|
+
|
|
263
|
+
var defaultVars = {name: "this", next: {name: "arguments"}};
|
|
264
|
+
function pushcontext() {
|
|
265
|
+
cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};
|
|
266
|
+
cx.state.localVars = defaultVars;
|
|
267
|
+
}
|
|
268
|
+
function popcontext() {
|
|
269
|
+
cx.state.localVars = cx.state.context.vars;
|
|
270
|
+
cx.state.context = cx.state.context.prev;
|
|
271
|
+
}
|
|
272
|
+
function pushlex(type, info) {
|
|
273
|
+
var result = function() {
|
|
274
|
+
var state = cx.state, indent = state.indented;
|
|
275
|
+
if (state.lexical.type == "stat") indent = state.lexical.indented;
|
|
276
|
+
state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);
|
|
277
|
+
};
|
|
278
|
+
result.lex = true;
|
|
279
|
+
return result;
|
|
280
|
+
}
|
|
281
|
+
function poplex() {
|
|
282
|
+
var state = cx.state;
|
|
283
|
+
if (state.lexical.prev) {
|
|
284
|
+
if (state.lexical.type == ")")
|
|
285
|
+
state.indented = state.lexical.indented;
|
|
286
|
+
state.lexical = state.lexical.prev;
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
poplex.lex = true;
|
|
290
|
+
|
|
291
|
+
function expect(wanted) {
|
|
292
|
+
return function(type) {
|
|
293
|
+
if (type == wanted) return cont();
|
|
294
|
+
else if (wanted == ";") return pass();
|
|
295
|
+
else return cont(arguments.callee);
|
|
296
|
+
};
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
function statement(type, value) {
|
|
300
|
+
if (type == "var") return cont(pushlex("vardef", value.length), vardef, expect(";"), poplex);
|
|
301
|
+
if (type == "keyword a") return cont(pushlex("form"), expression, statement, poplex);
|
|
302
|
+
if (type == "keyword b") return cont(pushlex("form"), statement, poplex);
|
|
303
|
+
if (type == "{") return cont(pushlex("}"), block, poplex);
|
|
304
|
+
if (type == ";") return cont();
|
|
305
|
+
if (type == "if") return cont(pushlex("form"), expression, statement, poplex, maybeelse);
|
|
306
|
+
if (type == "function") return cont(functiondef);
|
|
307
|
+
if (type == "for") return cont(pushlex("form"), forspec, poplex, statement, poplex);
|
|
308
|
+
if (type == "variable") return cont(pushlex("stat"), maybelabel);
|
|
309
|
+
if (type == "switch") return cont(pushlex("form"), expression, pushlex("}", "switch"), expect("{"),
|
|
310
|
+
block, poplex, poplex);
|
|
311
|
+
if (type == "case") return cont(expression, expect(":"));
|
|
312
|
+
if (type == "default") return cont(expect(":"));
|
|
313
|
+
if (type == "catch") return cont(pushlex("form"), pushcontext, expect("("), funarg, expect(")"),
|
|
314
|
+
statement, poplex, popcontext);
|
|
315
|
+
if (type == "module") return cont(pushlex("form"), pushcontext, afterModule, popcontext, poplex);
|
|
316
|
+
if (type == "class") return cont(pushlex("form"), className, objlit, poplex);
|
|
317
|
+
if (type == "export") return cont(pushlex("form"), afterExport, poplex);
|
|
318
|
+
if (type == "import") return cont(pushlex("form"), afterImport, poplex);
|
|
319
|
+
return pass(pushlex("stat"), expression, expect(";"), poplex);
|
|
320
|
+
}
|
|
321
|
+
function expression(type) {
|
|
322
|
+
return expressionInner(type, false);
|
|
323
|
+
}
|
|
324
|
+
function expressionNoComma(type) {
|
|
325
|
+
return expressionInner(type, true);
|
|
326
|
+
}
|
|
327
|
+
function expressionInner(type, noComma) {
|
|
328
|
+
if (cx.state.fatArrowAt == cx.stream.start) {
|
|
329
|
+
var body = noComma ? arrowBodyNoComma : arrowBody;
|
|
330
|
+
if (type == "(") return cont(pushcontext, commasep(pattern, ")"), expect("=>"), body, popcontext);
|
|
331
|
+
else if (type == "variable") return pass(pushcontext, pattern, expect("=>"), body, popcontext);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;
|
|
335
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);
|
|
336
|
+
if (type == "function") return cont(functiondef);
|
|
337
|
+
if (type == "keyword c") return cont(noComma ? maybeexpressionNoComma : maybeexpression);
|
|
338
|
+
if (type == "(") return cont(pushlex(")"), maybeexpression, comprehension, expect(")"), poplex, maybeop);
|
|
339
|
+
if (type == "operator" || type == "spread") return cont(noComma ? expressionNoComma : expression);
|
|
340
|
+
if (type == "[") return cont(pushlex("]"), expressionNoComma, maybeArrayComprehension, poplex, maybeop);
|
|
341
|
+
if (type == "{") return cont(commasep(objprop, "}"), maybeop);
|
|
342
|
+
return cont();
|
|
343
|
+
}
|
|
344
|
+
function maybeexpression(type) {
|
|
345
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
|
346
|
+
return pass(expression);
|
|
347
|
+
}
|
|
348
|
+
function maybeexpressionNoComma(type) {
|
|
349
|
+
if (type.match(/[;\}\)\],]/)) return pass();
|
|
350
|
+
return pass(expressionNoComma);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
function maybeoperatorComma(type, value) {
|
|
354
|
+
if (type == ",") return cont(expression);
|
|
355
|
+
return maybeoperatorNoComma(type, value, false);
|
|
356
|
+
}
|
|
357
|
+
function maybeoperatorNoComma(type, value, noComma) {
|
|
358
|
+
var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;
|
|
359
|
+
var expr = noComma == false ? expression : expressionNoComma;
|
|
360
|
+
if (value == "=>") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);
|
|
361
|
+
if (type == "operator") {
|
|
362
|
+
if (/\+\+|--/.test(value)) return cont(me);
|
|
363
|
+
if (value == "?") return cont(expression, expect(":"), expr);
|
|
364
|
+
return cont(expr);
|
|
365
|
+
}
|
|
366
|
+
if (type == "quasi") { cx.cc.push(me); return quasi(value); }
|
|
367
|
+
if (type == ";") return;
|
|
368
|
+
if (type == "(") return cont(commasep(expressionNoComma, ")", "call"), me);
|
|
369
|
+
if (type == ".") return cont(property, me);
|
|
370
|
+
if (type == "[") return cont(pushlex("]"), maybeexpression, expect("]"), poplex, me);
|
|
371
|
+
}
|
|
372
|
+
function quasi(value) {
|
|
373
|
+
if (!value) debugger;
|
|
374
|
+
if (value.slice(value.length - 2) != "${") return cont();
|
|
375
|
+
return cont(expression, continueQuasi);
|
|
376
|
+
}
|
|
377
|
+
function continueQuasi(type) {
|
|
378
|
+
if (type == "}") {
|
|
379
|
+
cx.marked = "string-2";
|
|
380
|
+
cx.state.tokenize = tokenQuasi;
|
|
381
|
+
return cont();
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
function arrowBody(type) {
|
|
385
|
+
findFatArrow(cx.stream, cx.state);
|
|
386
|
+
if (type == "{") return pass(statement);
|
|
387
|
+
return pass(expression);
|
|
388
|
+
}
|
|
389
|
+
function arrowBodyNoComma(type) {
|
|
390
|
+
findFatArrow(cx.stream, cx.state);
|
|
391
|
+
if (type == "{") return pass(statement);
|
|
392
|
+
return pass(expressionNoComma);
|
|
393
|
+
}
|
|
394
|
+
function maybelabel(type) {
|
|
395
|
+
if (type == ":") return cont(poplex, statement);
|
|
396
|
+
return pass(maybeoperatorComma, expect(";"), poplex);
|
|
397
|
+
}
|
|
398
|
+
function property(type) {
|
|
399
|
+
if (type == "variable") {cx.marked = "property"; return cont();}
|
|
400
|
+
}
|
|
401
|
+
function objprop(type, value) {
|
|
402
|
+
if (type == "variable") {
|
|
403
|
+
cx.marked = "property";
|
|
404
|
+
if (value == "get" || value == "set") return cont(getterSetter);
|
|
405
|
+
} else if (type == "number" || type == "string") {
|
|
406
|
+
cx.marked = type + " property";
|
|
407
|
+
} else if (type == "[") {
|
|
408
|
+
return cont(expression, expect("]"), afterprop);
|
|
409
|
+
}
|
|
410
|
+
if (atomicTypes.hasOwnProperty(type)) return cont(afterprop);
|
|
411
|
+
}
|
|
412
|
+
function getterSetter(type) {
|
|
413
|
+
if (type != "variable") return pass(afterprop);
|
|
414
|
+
cx.marked = "property";
|
|
415
|
+
return cont(functiondef);
|
|
416
|
+
}
|
|
417
|
+
function afterprop(type) {
|
|
418
|
+
if (type == ":") return cont(expressionNoComma);
|
|
419
|
+
if (type == "(") return pass(functiondef);
|
|
420
|
+
}
|
|
421
|
+
function commasep(what, end, info) {
|
|
422
|
+
function proceed(type) {
|
|
423
|
+
if (type == ",") {
|
|
424
|
+
var lex = cx.state.lexical;
|
|
425
|
+
if (lex.info == "call") lex.pos = (lex.pos || 0) + 1;
|
|
426
|
+
return cont(what, proceed);
|
|
427
|
+
}
|
|
428
|
+
if (type == end) return cont();
|
|
429
|
+
return cont(expect(end));
|
|
430
|
+
}
|
|
431
|
+
return function(type) {
|
|
432
|
+
if (type == end) return cont();
|
|
433
|
+
if (info === false) return pass(what, proceed);
|
|
434
|
+
return pass(pushlex(end, info), what, proceed, poplex);
|
|
435
|
+
};
|
|
436
|
+
}
|
|
437
|
+
function block(type) {
|
|
438
|
+
if (type == "}") return cont();
|
|
439
|
+
return pass(statement, block);
|
|
440
|
+
}
|
|
441
|
+
function maybetype(type) {
|
|
442
|
+
if (isTS && type == ":") return cont(typedef);
|
|
443
|
+
}
|
|
444
|
+
function typedef(type) {
|
|
445
|
+
if (type == "variable"){cx.marked = "variable-3"; return cont();}
|
|
446
|
+
}
|
|
447
|
+
function vardef() {
|
|
448
|
+
return pass(pattern, maybetype, maybeAssign, vardefCont);
|
|
449
|
+
}
|
|
450
|
+
function pattern(type, value) {
|
|
451
|
+
if (type == "variable") { register(value); return cont(); }
|
|
452
|
+
if (type == "[") return cont(commasep(pattern, "]"));
|
|
453
|
+
if (type == "{") return cont(commasep(proppattern, "}"));
|
|
454
|
+
}
|
|
455
|
+
function proppattern(type, value) {
|
|
456
|
+
if (type == "variable" && !cx.stream.match(/^\s*:/, false)) {
|
|
457
|
+
register(value);
|
|
458
|
+
return cont(maybeAssign);
|
|
459
|
+
}
|
|
460
|
+
if (type == "variable") cx.marked = "property";
|
|
461
|
+
return cont(expect(":"), pattern, maybeAssign);
|
|
462
|
+
}
|
|
463
|
+
function maybeAssign(_type, value) {
|
|
464
|
+
if (value == "=") return cont(expressionNoComma);
|
|
465
|
+
}
|
|
466
|
+
function vardefCont(type) {
|
|
467
|
+
if (type == ",") return cont(vardef);
|
|
468
|
+
}
|
|
469
|
+
function maybeelse(type, value) {
|
|
470
|
+
if (type == "keyword b" && value == "else") return cont(pushlex("form"), statement, poplex);
|
|
471
|
+
}
|
|
472
|
+
function forspec(type) {
|
|
473
|
+
if (type == "(") return cont(pushlex(")"), forspec1, expect(")"));
|
|
474
|
+
}
|
|
475
|
+
function forspec1(type) {
|
|
476
|
+
if (type == "var") return cont(vardef, expect(";"), forspec2);
|
|
477
|
+
if (type == ";") return cont(forspec2);
|
|
478
|
+
if (type == "variable") return cont(formaybeinof);
|
|
479
|
+
return pass(expression, expect(";"), forspec2);
|
|
480
|
+
}
|
|
481
|
+
function formaybeinof(_type, value) {
|
|
482
|
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
|
483
|
+
return cont(maybeoperatorComma, forspec2);
|
|
484
|
+
}
|
|
485
|
+
function forspec2(type, value) {
|
|
486
|
+
if (type == ";") return cont(forspec3);
|
|
487
|
+
if (value == "in" || value == "of") { cx.marked = "keyword"; return cont(expression); }
|
|
488
|
+
return pass(expression, expect(";"), forspec3);
|
|
489
|
+
}
|
|
490
|
+
function forspec3(type) {
|
|
491
|
+
if (type != ")") cont(expression);
|
|
492
|
+
}
|
|
493
|
+
function functiondef(type, value) {
|
|
494
|
+
if (value == "*") {cx.marked = "keyword"; return cont(functiondef);}
|
|
495
|
+
if (type == "variable") {register(value); return cont(functiondef);}
|
|
496
|
+
if (type == "(") return cont(pushcontext, commasep(funarg, ")"), statement, popcontext);
|
|
497
|
+
}
|
|
498
|
+
function funarg(type) {
|
|
499
|
+
if (type == "spread") return cont(funarg);
|
|
500
|
+
return pass(pattern, maybetype);
|
|
501
|
+
}
|
|
502
|
+
function className(type, value) {
|
|
503
|
+
if (type == "variable") {register(value); return cont(classNameAfter);}
|
|
504
|
+
}
|
|
505
|
+
function classNameAfter(_type, value) {
|
|
506
|
+
if (value == "extends") return cont(expression);
|
|
507
|
+
}
|
|
508
|
+
function objlit(type) {
|
|
509
|
+
if (type == "{") return cont(commasep(objprop, "}"));
|
|
510
|
+
}
|
|
511
|
+
function afterModule(type, value) {
|
|
512
|
+
if (type == "string") return cont(statement);
|
|
513
|
+
if (type == "variable") { register(value); return cont(maybeFrom); }
|
|
514
|
+
}
|
|
515
|
+
function afterExport(_type, value) {
|
|
516
|
+
if (value == "*") { cx.marked = "keyword"; return cont(maybeFrom, expect(";")); }
|
|
517
|
+
if (value == "default") { cx.marked = "keyword"; return cont(expression, expect(";")); }
|
|
518
|
+
return pass(statement);
|
|
519
|
+
}
|
|
520
|
+
function afterImport(type) {
|
|
521
|
+
if (type == "string") return cont();
|
|
522
|
+
return pass(importSpec, maybeFrom);
|
|
523
|
+
}
|
|
524
|
+
function importSpec(type, value) {
|
|
525
|
+
if (type == "{") return cont(commasep(importSpec, "}"));
|
|
526
|
+
if (type == "variable") register(value);
|
|
527
|
+
return cont();
|
|
528
|
+
}
|
|
529
|
+
function maybeFrom(_type, value) {
|
|
530
|
+
if (value == "from") { cx.marked = "keyword"; return cont(expression); }
|
|
531
|
+
}
|
|
532
|
+
function maybeArrayComprehension(type) {
|
|
533
|
+
if (type == "for") return pass(comprehension);
|
|
534
|
+
if (type == ",") return cont(commasep(expressionNoComma, "]", false));
|
|
535
|
+
return pass(commasep(expressionNoComma, "]", false));
|
|
536
|
+
}
|
|
537
|
+
function comprehension(type) {
|
|
538
|
+
if (type == "for") return cont(forspec, comprehension);
|
|
539
|
+
if (type == "if") return cont(expression, comprehension);
|
|
540
|
+
}
|
|
541
|
+
|
|
542
|
+
// Interface
|
|
543
|
+
|
|
544
|
+
return {
|
|
545
|
+
startState: function(basecolumn) {
|
|
546
|
+
var state = {
|
|
547
|
+
tokenize: tokenBase,
|
|
548
|
+
lastType: "sof",
|
|
549
|
+
cc: [],
|
|
550
|
+
lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, "block", false),
|
|
551
|
+
localVars: parserConfig.localVars,
|
|
552
|
+
context: parserConfig.localVars && {vars: parserConfig.localVars},
|
|
553
|
+
indented: 0
|
|
554
|
+
};
|
|
555
|
+
if (parserConfig.globalVars) state.globalVars = parserConfig.globalVars;
|
|
556
|
+
return state;
|
|
557
|
+
},
|
|
558
|
+
|
|
559
|
+
token: function(stream, state) {
|
|
560
|
+
if (stream.sol()) {
|
|
561
|
+
if (!state.lexical.hasOwnProperty("align"))
|
|
562
|
+
state.lexical.align = false;
|
|
563
|
+
state.indented = stream.indentation();
|
|
564
|
+
findFatArrow(stream, state);
|
|
565
|
+
}
|
|
566
|
+
if (state.tokenize != tokenComment && stream.eatSpace()) return null;
|
|
567
|
+
var style = state.tokenize(stream, state);
|
|
568
|
+
if (type == "comment") return style;
|
|
569
|
+
state.lastType = type == "operator" && (content == "++" || content == "--") ? "incdec" : type;
|
|
570
|
+
return parseJS(state, style, type, content, stream);
|
|
571
|
+
},
|
|
572
|
+
|
|
573
|
+
indent: function(state, textAfter) {
|
|
574
|
+
if (state.tokenize == tokenComment) return CodeMirror.Pass;
|
|
575
|
+
if (state.tokenize != tokenBase) return 0;
|
|
576
|
+
var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical;
|
|
577
|
+
// Kludge to prevent 'maybelse' from blocking lexical scope pops
|
|
578
|
+
for (var i = state.cc.length - 1; i >= 0; --i) {
|
|
579
|
+
var c = state.cc[i];
|
|
580
|
+
if (c == poplex) lexical = lexical.prev;
|
|
581
|
+
else if (c != maybeelse) break;
|
|
582
|
+
}
|
|
583
|
+
if (lexical.type == "stat" && firstChar == "}") lexical = lexical.prev;
|
|
584
|
+
if (statementIndent && lexical.type == ")" && lexical.prev.type == "stat")
|
|
585
|
+
lexical = lexical.prev;
|
|
586
|
+
var type = lexical.type, closing = firstChar == type;
|
|
587
|
+
|
|
588
|
+
if (type == "vardef") return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? lexical.info + 1 : 0);
|
|
589
|
+
else if (type == "form" && firstChar == "{") return lexical.indented;
|
|
590
|
+
else if (type == "form") return lexical.indented + indentUnit;
|
|
591
|
+
else if (type == "stat")
|
|
592
|
+
return lexical.indented + (state.lastType == "operator" || state.lastType == "," ? statementIndent || indentUnit : 0);
|
|
593
|
+
else if (lexical.info == "switch" && !closing && parserConfig.doubleIndentSwitch != false)
|
|
594
|
+
return lexical.indented + (/^(?:case|default)\b/.test(textAfter) ? indentUnit : 2 * indentUnit);
|
|
595
|
+
else if (lexical.align) return lexical.column + (closing ? 0 : 1);
|
|
596
|
+
else return lexical.indented + (closing ? 0 : indentUnit);
|
|
597
|
+
},
|
|
598
|
+
|
|
599
|
+
electricChars: ":{}",
|
|
600
|
+
blockCommentStart: jsonMode ? null : "/*",
|
|
601
|
+
blockCommentEnd: jsonMode ? null : "*/",
|
|
602
|
+
lineComment: jsonMode ? null : "//",
|
|
603
|
+
fold: "brace",
|
|
604
|
+
|
|
605
|
+
helperType: jsonMode ? "json" : "javascript",
|
|
606
|
+
jsonMode: jsonMode
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
|
|
610
|
+
CodeMirror.defineMIME("text/javascript", "javascript");
|
|
611
|
+
CodeMirror.defineMIME("text/ecmascript", "javascript");
|
|
612
|
+
CodeMirror.defineMIME("application/javascript", "javascript");
|
|
613
|
+
CodeMirror.defineMIME("application/ecmascript", "javascript");
|
|
614
|
+
CodeMirror.defineMIME("application/json", {name: "javascript", json: true});
|
|
615
|
+
CodeMirror.defineMIME("application/x-json", {name: "javascript", json: true});
|
|
616
|
+
CodeMirror.defineMIME("text/typescript", { name: "javascript", typescript: true });
|
|
617
|
+
CodeMirror.defineMIME("application/typescript", { name: "javascript", typescript: true });
|