gollum 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of gollum might be problematic. Click here for more details.
- data/README.md +44 -7
- data/Rakefile +1 -1
- data/bin/gollum +20 -1
- data/gollum.gemspec +400 -5
- data/lib/gollum.rb +2 -1
- data/lib/gollum/blob_entry.rb +13 -1
- data/lib/gollum/committer.rb +10 -1
- data/lib/gollum/file.rb +15 -2
- data/lib/gollum/file_view.rb +145 -0
- data/lib/gollum/frontend/app.rb +217 -69
- data/lib/gollum/frontend/helpers.rb +21 -0
- data/lib/gollum/frontend/public/gollum/css/_styles.css +121 -0
- data/lib/gollum/frontend/public/gollum/css/editor.css +17 -8
- data/lib/gollum/frontend/public/gollum/css/gollum.css +440 -402
- data/lib/gollum/frontend/public/gollum/css/template.css +540 -289
- data/lib/gollum/frontend/public/gollum/images/dirty-shade.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/document.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/folder-horizontal.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/para.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-16.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-20.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-24.png +0 -0
- data/lib/gollum/frontend/public/gollum/images/pin-32.png +0 -0
- data/lib/gollum/frontend/public/gollum/javascript/editor/gollum.editor.js +31 -7
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/asciidoc.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/creole.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/markdown.js +18 -6
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/org.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/pod.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/editor/langs/textile.js +2 -1
- data/lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js +3 -0
- data/lib/gollum/frontend/public/gollum/javascript/gollum.js +78 -16
- data/lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js +4 -0
- data/lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js +8 -0
- data/lib/gollum/frontend/public/gollum/livepreview/css/custom.css +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/save_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/index.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ace.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor.js +254 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/anchor_test.js +184 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer.js +261 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/background_tokenizer_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/command_manager_test.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js +460 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js +124 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css +327 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png +0 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document.js +617 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/document_test.js +314 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session.js +2419 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/bracket_match.js +252 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/fold_line.js +276 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session/folding.js +759 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/edit_session_test.js +981 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor.js +2163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_change_document_test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_highlight_selected_word_test.js +231 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_navigation_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/editor_text_edit_test.js +562 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static.css +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/static_highlight_test.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/ext/textarea.js +536 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/emacs.js +367 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/hash_handler.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/keybinding.js +143 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/state_handler.js +257 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/textinput.js +315 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/commands.js +556 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/aliases.js +101 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/motions.js +611 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/operators.js +193 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/maps/util.js +134 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/keyboard/vim/registers.js +49 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/cursor.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/gutter.js +187 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/marker.js +214 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text.js +595 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/layer/text_test.js +106 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/browser_focus.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/dom.js +292 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/es5-shim.js +1059 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event.js +317 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/event_emitter_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/fixoldbrowsers.js +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/keys.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/lang.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/net.js +62 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js +98 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xml.js +113 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/xquery.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c9search_highlight_rules.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/c_cpp_highlight_rules.js +180 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/clojure_highlight_rules.js +235 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee.js +121 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/helpers.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/lexer.js +739 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/nodes.js +2756 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser.js +603 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/parser_test.js +68 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/rewriter.js +342 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/scope.js +154 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules.js +227 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_highlight_rules_test.js +72 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee_worker.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_highlight_rules.js +135 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coldfusion_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/csharp_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css.js +110 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css/csslint.js +9014 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules.js +242 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_highlight_rules_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js +66 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js +75 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js +127 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle.js +95 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/cstyle_test.js +92 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/diff.js +76 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js +115 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js +169 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js +262 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js +129 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js +24 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js +183 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js +104 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js +83 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js +74 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js +471 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js +225 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker.js +88 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_worker_test.js +99 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json/json_parse.js +346 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js +111 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js +108 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js +53 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js +122 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js +57 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex_highlight_rules.js +38 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/less_highlight_rules.js +279 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js +220 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js +91 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js +436 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js +81 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js +355 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js +117 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/pgsql_highlight_rules.js +583 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php.js +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/php_highlight_rules.js +1165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/powershell_highlight_rules.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js +147 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js +194 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad.js +132 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scad_highlight_rules.js +168 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala.js +25 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scala_highlight_rules.js +179 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/scss_highlight_rules.js +304 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh.js +144 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js +89 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js +78 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js +100 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js +109 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js +103 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js +82 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js +120 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js +202 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md +6 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js +1686 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js +2993 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js +69 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js +10363 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js +42525 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js +6177 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js +55 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js +86 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js +64 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml_highlight_rules.js +116 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/model/editor.js +70 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_gutter_handler.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/default_handlers.js +354 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/dragdrop.js +105 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/fold_handler.js +71 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_event.js +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/mouse_handler.js +158 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js +163 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js +762 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js +171 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js +696 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js +598 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js +61 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js +2072 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js +278 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js +581 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list.js +230 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_list_test.js +170 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range_test.js +198 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/renderloop.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/requirejs/text.js +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/scrollbar.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search.js +398 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_highlight.js +87 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/search_test.js +451 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection.js +886 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/selection_test.js +472 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/split.js +411 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all.js +42 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/all_browser.js +136 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/assertions.js +63 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/assert.js +313 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/async.js +529 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/index.js +13 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/test.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/asyncjs/utils.js +65 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/benchmark.js +85 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js +10 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js +204 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css +159 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css +118 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.css +119 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds_midnight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/cobalt.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.css +151 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/crimson_editor.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.css +149 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dawn.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.css +182 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/dreamweaver.js +45 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.css +102 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/eclipse.js +48 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.css +133 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/github.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.css +137 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/idle_fingers.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/kr_theme.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.css +140 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.css +146 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/merbivore_soft.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.css +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/mono_industrial.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.css +145 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/monokai.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.css +150 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/pastel_on_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.css +131 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_dark.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.css +130 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/solarized_light.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.css +165 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/textmate.js +47 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_blue.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.css +164 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_bright.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.css +160 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/tomorrow_night_eighties.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.css +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css +141 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js +46 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js +162 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js +219 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js +195 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js +142 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js +107 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js +1402 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js +93 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js +4469 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js +6396 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js +43 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js +138 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js +176 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_sourcemint.js +73 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/jquery.ba-throttle-debounce.min.js +2 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js +456 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/md_sundown.js +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/requirejs.min.js +35 -0
- data/lib/gollum/frontend/public/gollum/livepreview/js/sundown.js +1 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/ace/LICENSE.txt +476 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/bootstraponline_gollum/LICENSE.txt +9 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/debounce/LICENSE-MIT.txt +22 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/gollum/LICENSE.txt +21 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/jquery/MIT-LICENSE.txt +20 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/licenses.txt +59 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/notepages/LICENSE.txt +19 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/requirejs/LICENSE.txt +58 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/retina_display_icon_set/by_sa_3.0_unported_legalcode.txt +359 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sizzle/LICENSE.txt +148 -0
- data/lib/gollum/frontend/public/gollum/livepreview/licenses/sundown/sundown.txt +4 -0
- data/lib/gollum/frontend/public/gollum/livepreview/readme.md +44 -0
- data/lib/gollum/frontend/templates/compare.mustache +9 -9
- data/lib/gollum/frontend/templates/create.mustache +4 -1
- data/lib/gollum/frontend/templates/edit.mustache +6 -3
- data/lib/gollum/frontend/templates/editor.mustache +30 -14
- data/lib/gollum/frontend/templates/file_view.mustache +32 -0
- data/lib/gollum/frontend/templates/history.mustache +8 -8
- data/lib/gollum/frontend/templates/layout.mustache +21 -14
- data/lib/gollum/frontend/templates/page.mustache +37 -14
- data/lib/gollum/frontend/templates/pages.mustache +14 -10
- data/lib/gollum/frontend/templates/search.mustache +2 -2
- data/lib/gollum/frontend/templates/searchbar.mustache +1 -1
- data/lib/gollum/frontend/uri_encode_component.rb +172 -0
- data/lib/gollum/frontend/views/compare.rb +2 -4
- data/lib/gollum/frontend/views/create.rb +5 -0
- data/lib/gollum/frontend/views/edit.rb +12 -0
- data/lib/gollum/frontend/views/file_view.rb +19 -0
- data/lib/gollum/frontend/views/has_page.rb +15 -0
- data/lib/gollum/frontend/views/history.rb +8 -4
- data/lib/gollum/frontend/views/layout.rb +9 -1
- data/lib/gollum/frontend/views/page.rb +37 -10
- data/lib/gollum/frontend/views/pages.rb +48 -0
- data/lib/gollum/git_access.rb +2 -2
- data/lib/gollum/markup.rb +115 -19
- data/lib/gollum/page.rb +79 -9
- data/lib/gollum/tex.rb +319 -42
- data/lib/gollum/wiki.rb +92 -12
- data/licenses/css_tree_menu_thecssninja/license.txt +50 -0
- data/licenses/licenses.txt +23 -0
- data/licenses/unity_asset_pool/COPYRIGHT +286 -0
- data/test/examples/lotr.git/config +1 -1
- data/test/examples/lotr.git/logs/HEAD +4 -0
- data/test/examples/lotr.git/logs/refs/heads/master +4 -0
- data/test/examples/lotr.git/objects/0d/c9016ca928c78d5421a99a53b379b53929221e +0 -0
- data/test/examples/lotr.git/objects/1c/79ddc69707f7b164bc2ea58beb5d8965ff6bd0 +0 -0
- data/test/examples/lotr.git/objects/27/680b0fce1abfbc528e7aa53d92645852d52eb6 +0 -0
- data/test/examples/lotr.git/objects/45/3b250f979c7bd6dfb62640c944c982ae6721ee +0 -0
- data/test/examples/lotr.git/objects/45/f319ee12f2b551b901b22e72602963c366fff1 +0 -0
- data/test/examples/lotr.git/objects/46/a697caf435815bb07bbce947fc2d58be15f087 +0 -0
- data/test/examples/lotr.git/objects/4c/45c2b4e297a726c3d3f66886f35373e48fe1c5 +2 -0
- data/test/examples/lotr.git/objects/4e/023f460ce466e154ca09d8774c79ad5a53fc15 +0 -0
- data/test/examples/lotr.git/objects/62/9aa678272b017a4d136d35e77ac94d80b08dc2 +1 -0
- data/test/examples/lotr.git/objects/6e/48abfc56565574859e081ee58eae655d48cf71 +0 -0
- data/test/examples/lotr.git/objects/7b/60c5a20a501a70f2317fa0ef763e1e2ce22d6b +0 -0
- data/test/examples/lotr.git/objects/7d/981cd984ad589e3cf00d8122170c6f7d685979 +0 -0
- data/test/examples/lotr.git/objects/94/9a9cc3119b9c98817f375e976d2bb5e2a42809 +0 -0
- data/test/examples/lotr.git/objects/9b/e95b960ac388d4e7db55f610f828e9c31344e6 +0 -0
- data/test/examples/lotr.git/objects/b0/de6e794dfdc7ef3400e894225bfe23308aae5c +0 -0
- data/test/examples/lotr.git/objects/b1/6b3d9fad9d78e5a669e7f33d94c96da374eccd +0 -0
- data/test/examples/lotr.git/objects/c9/6a7645db5d4c76389e77cd103ef3ed77d81e4c +0 -0
- data/test/examples/lotr.git/objects/ca/7355dc497e9729fbaf0c0e3f424b86afef5614 +0 -0
- data/test/examples/lotr.git/objects/cf/ea406f5f77afc7fb673a43e97721234385b1bd +2 -0
- data/test/examples/lotr.git/objects/d5/29304506d37f544675244c335d85cab5d29966 +0 -0
- data/test/examples/lotr.git/objects/fb/c5dd7d807707b4a0a97c1182fecfef1eced5df +1 -0
- data/test/examples/lotr.git/objects/fc/3eee516ff72dc9099ba00d4611eb02e5c9e634 +0 -0
- data/test/examples/lotr.git/objects/ff/6f7de62644369380ba73b4e4297c1a2d6f0b66 +0 -0
- data/test/examples/lotr.git/refs/heads/master +1 -1
- data/test/examples/revert.git/COMMIT_EDITMSG +1 -1
- data/test/examples/revert.git/index +0 -0
- data/test/examples/revert.git/logs/HEAD +1 -0
- data/test/examples/revert.git/logs/refs/heads/master +1 -0
- data/test/examples/revert.git/objects/10/2685c42018f802557f05db171f44443e8dacab +0 -0
- data/test/examples/revert.git/objects/8e/83f898e5e16ae400db59dda1017acad540f3aa +0 -0
- data/test/examples/revert.git/objects/ed/6c9f63b98acf73c25b5ffbb38da557d3682023 +3 -0
- data/test/examples/revert.git/refs/heads/master +1 -1
- data/test/file_view/1_file.txt +3 -0
- data/test/file_view/1_file_1_folder.txt +8 -0
- data/test/file_view/1_folder.txt +8 -0
- data/test/file_view/2_files_2_folders.txt +12 -0
- data/test/file_view/2_files_2_folders_1_root.txt +13 -0
- data/test/file_view/nested_folders.txt +28 -0
- data/test/test_app.rb +162 -12
- data/test/test_app_helpers.rb +13 -0
- data/test/test_committer.rb +1 -1
- data/test/test_file_view.rb +102 -0
- data/test/test_git_access.rb +3 -2
- data/test/test_markup.rb +45 -12
- data/test/test_page.rb +65 -1
- data/test/test_page_revert.rb +14 -2
- data/test/test_pages_view.rb +37 -0
- data/test/test_unicode.rb +110 -0
- data/test/test_wiki.rb +51 -4
- metadata +658 -239
- data/lib/gollum/frontend/public/gollum/javascript/jquery.js +0 -7179
@@ -0,0 +1,121 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Ajax.org Code Editor (ACE).
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Ajax.org B.V.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2010
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Satoshi Murakami <murky.satyr AT gmail DOT com>
|
23
|
+
*
|
24
|
+
* Alternatively, the contents of this file may be used under the terms of
|
25
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
26
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
27
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
28
|
+
* of those above. If you wish to allow use of your version of this file only
|
29
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
30
|
+
* use your version of this file under the terms of the MPL, indicate your
|
31
|
+
* decision by deleting the provisions above and replace them with the notice
|
32
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
33
|
+
* the provisions above, a recipient may use your version of this file under
|
34
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
35
|
+
*
|
36
|
+
* ***** END LICENSE BLOCK ***** */
|
37
|
+
|
38
|
+
define(function(require, exports, module) {
|
39
|
+
"use strict";
|
40
|
+
|
41
|
+
var Tokenizer = require("../tokenizer").Tokenizer;
|
42
|
+
var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules;
|
43
|
+
var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent;
|
44
|
+
var PythonFoldMode = require("./folding/coffee").FoldMode;
|
45
|
+
var Range = require("../range").Range;
|
46
|
+
var TextMode = require("./text").Mode;
|
47
|
+
var WorkerClient = require("../worker/worker_client").WorkerClient;
|
48
|
+
var oop = require("../lib/oop");
|
49
|
+
|
50
|
+
function Mode() {
|
51
|
+
this.$tokenizer = new Tokenizer(new Rules().getRules());
|
52
|
+
this.$outdent = new Outdent();
|
53
|
+
this.foldingRules = new PythonFoldMode("=|=>|->|\\s*class [^#]*");
|
54
|
+
}
|
55
|
+
|
56
|
+
oop.inherits(Mode, TextMode);
|
57
|
+
|
58
|
+
(function() {
|
59
|
+
|
60
|
+
var indenter = /(?:[({[=:]|[-=]>|\b(?:else|switch|try|catch(?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$/;
|
61
|
+
var commentLine = /^(\s*)#/;
|
62
|
+
var hereComment = /^\s*###(?!#)/;
|
63
|
+
var indentation = /^\s*/;
|
64
|
+
|
65
|
+
this.getNextLineIndent = function(state, line, tab) {
|
66
|
+
var indent = this.$getIndent(line);
|
67
|
+
var tokens = this.$tokenizer.getLineTokens(line, state).tokens;
|
68
|
+
|
69
|
+
if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') &&
|
70
|
+
state === 'start' && indenter.test(line))
|
71
|
+
indent += tab;
|
72
|
+
return indent;
|
73
|
+
};
|
74
|
+
|
75
|
+
this.toggleCommentLines = function(state, doc, startRow, endRow){
|
76
|
+
console.log("toggle");
|
77
|
+
var range = new Range(0, 0, 0, 0);
|
78
|
+
for (var i = startRow; i <= endRow; ++i) {
|
79
|
+
var line = doc.getLine(i);
|
80
|
+
if (hereComment.test(line))
|
81
|
+
continue;
|
82
|
+
|
83
|
+
if (commentLine.test(line))
|
84
|
+
line = line.replace(commentLine, '$1');
|
85
|
+
else
|
86
|
+
line = line.replace(indentation, '$&#');
|
87
|
+
|
88
|
+
range.end.row = range.start.row = i;
|
89
|
+
range.end.column = line.length + 1;
|
90
|
+
doc.replace(range, line);
|
91
|
+
}
|
92
|
+
};
|
93
|
+
|
94
|
+
this.checkOutdent = function(state, line, input) {
|
95
|
+
return this.$outdent.checkOutdent(line, input);
|
96
|
+
};
|
97
|
+
|
98
|
+
this.autoOutdent = function(state, doc, row) {
|
99
|
+
this.$outdent.autoOutdent(doc, row);
|
100
|
+
};
|
101
|
+
|
102
|
+
this.createWorker = function(session) {
|
103
|
+
var worker = new WorkerClient(["ace"], "worker-coffee.js", "ace/mode/coffee_worker", "Worker");
|
104
|
+
worker.attachToDocument(session.getDocument());
|
105
|
+
|
106
|
+
worker.on("error", function(e) {
|
107
|
+
session.setAnnotations([e.data]);
|
108
|
+
});
|
109
|
+
|
110
|
+
worker.on("ok", function(e) {
|
111
|
+
session.clearAnnotations();
|
112
|
+
});
|
113
|
+
|
114
|
+
return worker;
|
115
|
+
};
|
116
|
+
|
117
|
+
}).call(Mode.prototype);
|
118
|
+
|
119
|
+
exports.Mode = Mode;
|
120
|
+
|
121
|
+
});
|
data/lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/coffee/coffee-script.js
ADDED
@@ -0,0 +1,63 @@
|
|
1
|
+
/* ***** BEGIN LICENSE BLOCK *****
|
2
|
+
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
3
|
+
*
|
4
|
+
* The contents of this file are subject to the Mozilla Public License Version
|
5
|
+
* 1.1 (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
* http://www.mozilla.org/MPL/
|
8
|
+
*
|
9
|
+
* Software distributed under the License is distributed on an "AS IS" basis,
|
10
|
+
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11
|
+
* for the specific language governing rights and limitations under the
|
12
|
+
* License.
|
13
|
+
*
|
14
|
+
* The Original Code is Ajax.org Code Editor (ACE).
|
15
|
+
*
|
16
|
+
* The Initial Developer of the Original Code is
|
17
|
+
* Ajax.org B.V.
|
18
|
+
* Portions created by the Initial Developer are Copyright (C) 2010
|
19
|
+
* the Initial Developer. All Rights Reserved.
|
20
|
+
*
|
21
|
+
* Contributor(s):
|
22
|
+
* Fabian Jakobs <fabian AT ajax DOT org>
|
23
|
+
*
|
24
|
+
* Alternatively, the contents of this file may be used under the terms of
|
25
|
+
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
26
|
+
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
27
|
+
* in which case the provisions of the GPL or the LGPL are applicable instead
|
28
|
+
* of those above. If you wish to allow use of your version of this file only
|
29
|
+
* under the terms of either the GPL or the LGPL, and not to allow others to
|
30
|
+
* use your version of this file under the terms of the MPL, indicate your
|
31
|
+
* decision by deleting the provisions above and replace them with the notice
|
32
|
+
* and other provisions required by the GPL or the LGPL. If you do not delete
|
33
|
+
* the provisions above, a recipient may use your version of this file under
|
34
|
+
* the terms of any one of the MPL, the GPL or the LGPL.
|
35
|
+
*
|
36
|
+
* ***** END LICENSE BLOCK ***** */
|
37
|
+
|
38
|
+
define(function(require, exports, module) {
|
39
|
+
|
40
|
+
var Lexer = require("./lexer").Lexer;
|
41
|
+
var parser = require("./parser");
|
42
|
+
|
43
|
+
var lexer = new Lexer();
|
44
|
+
parser.lexer = {
|
45
|
+
lex: function() {
|
46
|
+
var tag, _ref2;
|
47
|
+
_ref2 = this.tokens[this.pos++] || [''], tag = _ref2[0], this.yytext = _ref2[1], this.yylineno = _ref2[2];
|
48
|
+
return tag;
|
49
|
+
},
|
50
|
+
setInput: function(tokens) {
|
51
|
+
this.tokens = tokens;
|
52
|
+
return this.pos = 0;
|
53
|
+
},
|
54
|
+
upcomingInput: function() {
|
55
|
+
return "";
|
56
|
+
}
|
57
|
+
};
|
58
|
+
parser.yy = require('./nodes');
|
59
|
+
|
60
|
+
exports.parse = function(code) {
|
61
|
+
return parser.parse(lexer.tokenize(code));
|
62
|
+
};
|
63
|
+
});
|
@@ -0,0 +1,100 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2011 Jeremy Ashkenas
|
3
|
+
*
|
4
|
+
* Permission is hereby granted, free of charge, to any person
|
5
|
+
* obtaining a copy of this software and associated documentation
|
6
|
+
* files (the "Software"), to deal in the Software without
|
7
|
+
* restriction, including without limitation the rights to use,
|
8
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
* copies of the Software, and to permit persons to whom the
|
10
|
+
* Software is furnished to do so, subject to the following
|
11
|
+
* conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be
|
14
|
+
* included in all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
define(function(require, exports, module) {
|
27
|
+
// Generated by CoffeeScript 1.2.1-pre
|
28
|
+
|
29
|
+
var extend, flatten;
|
30
|
+
|
31
|
+
exports.starts = function(string, literal, start) {
|
32
|
+
return literal === string.substr(start, literal.length);
|
33
|
+
};
|
34
|
+
|
35
|
+
exports.ends = function(string, literal, back) {
|
36
|
+
var len;
|
37
|
+
len = literal.length;
|
38
|
+
return literal === string.substr(string.length - len - (back || 0), len);
|
39
|
+
};
|
40
|
+
|
41
|
+
exports.compact = function(array) {
|
42
|
+
var item, _i, _len, _results;
|
43
|
+
_results = [];
|
44
|
+
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
45
|
+
item = array[_i];
|
46
|
+
if (item) _results.push(item);
|
47
|
+
}
|
48
|
+
return _results;
|
49
|
+
};
|
50
|
+
|
51
|
+
exports.count = function(string, substr) {
|
52
|
+
var num, pos;
|
53
|
+
num = pos = 0;
|
54
|
+
if (!substr.length) return 1 / 0;
|
55
|
+
while (pos = 1 + string.indexOf(substr, pos)) {
|
56
|
+
num++;
|
57
|
+
}
|
58
|
+
return num;
|
59
|
+
};
|
60
|
+
|
61
|
+
exports.merge = function(options, overrides) {
|
62
|
+
return extend(extend({}, options), overrides);
|
63
|
+
};
|
64
|
+
|
65
|
+
extend = exports.extend = function(object, properties) {
|
66
|
+
var key, val;
|
67
|
+
for (key in properties) {
|
68
|
+
val = properties[key];
|
69
|
+
object[key] = val;
|
70
|
+
}
|
71
|
+
return object;
|
72
|
+
};
|
73
|
+
|
74
|
+
exports.flatten = flatten = function(array) {
|
75
|
+
var element, flattened, _i, _len;
|
76
|
+
flattened = [];
|
77
|
+
for (_i = 0, _len = array.length; _i < _len; _i++) {
|
78
|
+
element = array[_i];
|
79
|
+
if (element instanceof Array) {
|
80
|
+
flattened = flattened.concat(flatten(element));
|
81
|
+
} else {
|
82
|
+
flattened.push(element);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
return flattened;
|
86
|
+
};
|
87
|
+
|
88
|
+
exports.del = function(obj, key) {
|
89
|
+
var val;
|
90
|
+
val = obj[key];
|
91
|
+
delete obj[key];
|
92
|
+
return val;
|
93
|
+
};
|
94
|
+
|
95
|
+
exports.last = function(array, back) {
|
96
|
+
return array[array.length - (back || 0) - 1];
|
97
|
+
};
|
98
|
+
|
99
|
+
|
100
|
+
});
|
@@ -0,0 +1,739 @@
|
|
1
|
+
/*
|
2
|
+
* Copyright (c) 2011 Jeremy Ashkenas
|
3
|
+
*
|
4
|
+
* Permission is hereby granted, free of charge, to any person
|
5
|
+
* obtaining a copy of this software and associated documentation
|
6
|
+
* files (the "Software"), to deal in the Software without
|
7
|
+
* restriction, including without limitation the rights to use,
|
8
|
+
* copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
* copies of the Software, and to permit persons to whom the
|
10
|
+
* Software is furnished to do so, subject to the following
|
11
|
+
* conditions:
|
12
|
+
*
|
13
|
+
* The above copyright notice and this permission notice shall be
|
14
|
+
* included in all copies or substantial portions of the Software.
|
15
|
+
*
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
18
|
+
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
|
20
|
+
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
21
|
+
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
22
|
+
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
23
|
+
* OTHER DEALINGS IN THE SOFTWARE.
|
24
|
+
*/
|
25
|
+
|
26
|
+
define(function(require, exports, module) {
|
27
|
+
// Generated by CoffeeScript 1.2.1-pre
|
28
|
+
|
29
|
+
var BOOL, CALLABLE, CODE, COFFEE_ALIASES, COFFEE_ALIAS_MAP, COFFEE_KEYWORDS, COMMENT, COMPARE, COMPOUND_ASSIGN, HEREDOC, HEREDOC_ILLEGAL, HEREDOC_INDENT, HEREGEX, HEREGEX_OMIT, IDENTIFIER, INDEXABLE, INVERSES, JSTOKEN, JS_FORBIDDEN, JS_KEYWORDS, LINE_BREAK, LINE_CONTINUER, LOGIC, Lexer, MATH, MULTILINER, MULTI_DENT, NOT_REGEX, NOT_SPACED_REGEX, NUMBER, OPERATOR, REGEX, RELATION, RESERVED, Rewriter, SHIFT, SIMPLESTR, STRICT_PROSCRIBED, TRAILING_SPACES, UNARY, WHITESPACE, compact, count, key, last, starts, _ref, _ref1,
|
30
|
+
__indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
31
|
+
|
32
|
+
_ref = require('./rewriter'), Rewriter = _ref.Rewriter, INVERSES = _ref.INVERSES;
|
33
|
+
|
34
|
+
_ref1 = require('./helpers'), count = _ref1.count, starts = _ref1.starts, compact = _ref1.compact, last = _ref1.last;
|
35
|
+
|
36
|
+
exports.Lexer = Lexer = (function() {
|
37
|
+
|
38
|
+
Lexer.name = 'Lexer';
|
39
|
+
|
40
|
+
function Lexer() {}
|
41
|
+
|
42
|
+
Lexer.prototype.tokenize = function(code, opts) {
|
43
|
+
var i, tag;
|
44
|
+
if (opts == null) opts = {};
|
45
|
+
if (WHITESPACE.test(code)) code = "\n" + code;
|
46
|
+
code = code.replace(/\r/g, '').replace(TRAILING_SPACES, '');
|
47
|
+
this.code = code;
|
48
|
+
this.line = opts.line || 0;
|
49
|
+
this.indent = 0;
|
50
|
+
this.indebt = 0;
|
51
|
+
this.outdebt = 0;
|
52
|
+
this.indents = [];
|
53
|
+
this.ends = [];
|
54
|
+
this.tokens = [];
|
55
|
+
i = 0;
|
56
|
+
while (this.chunk = code.slice(i)) {
|
57
|
+
i += this.identifierToken() || this.commentToken() || this.whitespaceToken() || this.lineToken() || this.heredocToken() || this.stringToken() || this.numberToken() || this.regexToken() || this.jsToken() || this.literalToken();
|
58
|
+
}
|
59
|
+
this.closeIndentation();
|
60
|
+
if (tag = this.ends.pop()) this.error("missing " + tag);
|
61
|
+
if (opts.rewrite === false) return this.tokens;
|
62
|
+
return (new Rewriter).rewrite(this.tokens);
|
63
|
+
};
|
64
|
+
|
65
|
+
Lexer.prototype.identifierToken = function() {
|
66
|
+
var colon, forcedIdentifier, id, input, match, prev, tag, _ref2, _ref3;
|
67
|
+
if (!(match = IDENTIFIER.exec(this.chunk))) return 0;
|
68
|
+
input = match[0], id = match[1], colon = match[2];
|
69
|
+
if (id === 'own' && this.tag() === 'FOR') {
|
70
|
+
this.token('OWN', id);
|
71
|
+
return id.length;
|
72
|
+
}
|
73
|
+
forcedIdentifier = colon || (prev = last(this.tokens)) && (((_ref2 = prev[0]) === '.' || _ref2 === '?.' || _ref2 === '::') || !prev.spaced && prev[0] === '@');
|
74
|
+
tag = 'IDENTIFIER';
|
75
|
+
if (!forcedIdentifier && (__indexOf.call(JS_KEYWORDS, id) >= 0 || __indexOf.call(COFFEE_KEYWORDS, id) >= 0)) {
|
76
|
+
tag = id.toUpperCase();
|
77
|
+
if (tag === 'WHEN' && (_ref3 = this.tag(), __indexOf.call(LINE_BREAK, _ref3) >= 0)) {
|
78
|
+
tag = 'LEADING_WHEN';
|
79
|
+
} else if (tag === 'FOR') {
|
80
|
+
this.seenFor = true;
|
81
|
+
} else if (tag === 'UNLESS') {
|
82
|
+
tag = 'IF';
|
83
|
+
} else if (__indexOf.call(UNARY, tag) >= 0) {
|
84
|
+
tag = 'UNARY';
|
85
|
+
} else if (__indexOf.call(RELATION, tag) >= 0) {
|
86
|
+
if (tag !== 'INSTANCEOF' && this.seenFor) {
|
87
|
+
tag = 'FOR' + tag;
|
88
|
+
this.seenFor = false;
|
89
|
+
} else {
|
90
|
+
tag = 'RELATION';
|
91
|
+
if (this.value() === '!') {
|
92
|
+
this.tokens.pop();
|
93
|
+
id = '!' + id;
|
94
|
+
}
|
95
|
+
}
|
96
|
+
}
|
97
|
+
}
|
98
|
+
if (__indexOf.call(JS_FORBIDDEN, id) >= 0) {
|
99
|
+
if (forcedIdentifier) {
|
100
|
+
tag = 'IDENTIFIER';
|
101
|
+
id = new String(id);
|
102
|
+
id.reserved = true;
|
103
|
+
} else if (__indexOf.call(RESERVED, id) >= 0) {
|
104
|
+
this.error("reserved word \"" + id + "\"");
|
105
|
+
}
|
106
|
+
}
|
107
|
+
if (!forcedIdentifier) {
|
108
|
+
if (__indexOf.call(COFFEE_ALIASES, id) >= 0) id = COFFEE_ALIAS_MAP[id];
|
109
|
+
tag = (function() {
|
110
|
+
switch (id) {
|
111
|
+
case '!':
|
112
|
+
return 'UNARY';
|
113
|
+
case '==':
|
114
|
+
case '!=':
|
115
|
+
return 'COMPARE';
|
116
|
+
case '&&':
|
117
|
+
case '||':
|
118
|
+
return 'LOGIC';
|
119
|
+
case 'true':
|
120
|
+
case 'false':
|
121
|
+
case 'null':
|
122
|
+
case 'undefined':
|
123
|
+
return 'BOOL';
|
124
|
+
case 'break':
|
125
|
+
case 'continue':
|
126
|
+
return 'STATEMENT';
|
127
|
+
default:
|
128
|
+
return tag;
|
129
|
+
}
|
130
|
+
})();
|
131
|
+
}
|
132
|
+
this.token(tag, id);
|
133
|
+
if (colon) this.token(':', ':');
|
134
|
+
return input.length;
|
135
|
+
};
|
136
|
+
|
137
|
+
Lexer.prototype.numberToken = function() {
|
138
|
+
var binaryLiteral, lexedLength, match, number, octalLiteral;
|
139
|
+
if (!(match = NUMBER.exec(this.chunk))) return 0;
|
140
|
+
number = match[0];
|
141
|
+
if (/E/.test(number)) {
|
142
|
+
this.error("exponential notation '" + number + "' must be indicated with a lowercase 'e'");
|
143
|
+
} else if (/[BOX]/.test(number)) {
|
144
|
+
this.error("radix prefix '" + number + "' must be lowercase");
|
145
|
+
} else if (/^0[89]/.test(number)) {
|
146
|
+
this.error("decimal literal '" + number + "' must not be prefixed with '0'");
|
147
|
+
} else if (/^0[0-7]/.test(number)) {
|
148
|
+
this.error("octal literal '" + number + "' must be prefixed with '0o'");
|
149
|
+
}
|
150
|
+
lexedLength = number.length;
|
151
|
+
if (octalLiteral = /0o([0-7]+)/.exec(number)) {
|
152
|
+
number = (parseInt(octalLiteral[1], 8)).toString();
|
153
|
+
}
|
154
|
+
if (binaryLiteral = /0b([01]+)/.exec(number)) {
|
155
|
+
number = (parseInt(binaryLiteral[1], 2)).toString();
|
156
|
+
}
|
157
|
+
this.token('NUMBER', number);
|
158
|
+
return lexedLength;
|
159
|
+
};
|
160
|
+
|
161
|
+
Lexer.prototype.stringToken = function() {
|
162
|
+
var match, octalEsc, string;
|
163
|
+
switch (this.chunk.charAt(0)) {
|
164
|
+
case "'":
|
165
|
+
if (!(match = SIMPLESTR.exec(this.chunk))) return 0;
|
166
|
+
this.token('STRING', (string = match[0]).replace(MULTILINER, '\\\n'));
|
167
|
+
break;
|
168
|
+
case '"':
|
169
|
+
if (!(string = this.balancedString(this.chunk, '"'))) return 0;
|
170
|
+
if (0 < string.indexOf('#{', 1)) {
|
171
|
+
this.interpolateString(string.slice(1, -1));
|
172
|
+
} else {
|
173
|
+
this.token('STRING', this.escapeLines(string));
|
174
|
+
}
|
175
|
+
break;
|
176
|
+
default:
|
177
|
+
return 0;
|
178
|
+
}
|
179
|
+
if (octalEsc = /^(?:\\.|[^\\])*\\[0-7]/.test(string)) {
|
180
|
+
this.error("octal escape sequences " + string + " are not allowed");
|
181
|
+
}
|
182
|
+
this.line += count(string, '\n');
|
183
|
+
return string.length;
|
184
|
+
};
|
185
|
+
|
186
|
+
Lexer.prototype.heredocToken = function() {
|
187
|
+
var doc, heredoc, match, quote;
|
188
|
+
if (!(match = HEREDOC.exec(this.chunk))) return 0;
|
189
|
+
heredoc = match[0];
|
190
|
+
quote = heredoc.charAt(0);
|
191
|
+
doc = this.sanitizeHeredoc(match[2], {
|
192
|
+
quote: quote,
|
193
|
+
indent: null
|
194
|
+
});
|
195
|
+
if (quote === '"' && 0 <= doc.indexOf('#{')) {
|
196
|
+
this.interpolateString(doc, {
|
197
|
+
heredoc: true
|
198
|
+
});
|
199
|
+
} else {
|
200
|
+
this.token('STRING', this.makeString(doc, quote, true));
|
201
|
+
}
|
202
|
+
this.line += count(heredoc, '\n');
|
203
|
+
return heredoc.length;
|
204
|
+
};
|
205
|
+
|
206
|
+
Lexer.prototype.commentToken = function() {
|
207
|
+
var comment, here, match;
|
208
|
+
if (!(match = this.chunk.match(COMMENT))) return 0;
|
209
|
+
comment = match[0], here = match[1];
|
210
|
+
if (here) {
|
211
|
+
this.token('HERECOMMENT', this.sanitizeHeredoc(here, {
|
212
|
+
herecomment: true,
|
213
|
+
indent: Array(this.indent + 1).join(' ')
|
214
|
+
}));
|
215
|
+
}
|
216
|
+
this.line += count(comment, '\n');
|
217
|
+
return comment.length;
|
218
|
+
};
|
219
|
+
|
220
|
+
Lexer.prototype.jsToken = function() {
|
221
|
+
var match, script;
|
222
|
+
if (!(this.chunk.charAt(0) === '`' && (match = JSTOKEN.exec(this.chunk)))) {
|
223
|
+
return 0;
|
224
|
+
}
|
225
|
+
this.token('JS', (script = match[0]).slice(1, -1));
|
226
|
+
return script.length;
|
227
|
+
};
|
228
|
+
|
229
|
+
Lexer.prototype.regexToken = function() {
|
230
|
+
var flags, length, match, prev, regex, _ref2, _ref3;
|
231
|
+
if (this.chunk.charAt(0) !== '/') return 0;
|
232
|
+
if (match = HEREGEX.exec(this.chunk)) {
|
233
|
+
length = this.heregexToken(match);
|
234
|
+
this.line += count(match[0], '\n');
|
235
|
+
return length;
|
236
|
+
}
|
237
|
+
prev = last(this.tokens);
|
238
|
+
if (prev && (_ref2 = prev[0], __indexOf.call((prev.spaced ? NOT_REGEX : NOT_SPACED_REGEX), _ref2) >= 0)) {
|
239
|
+
return 0;
|
240
|
+
}
|
241
|
+
if (!(match = REGEX.exec(this.chunk))) return 0;
|
242
|
+
_ref3 = match, match = _ref3[0], regex = _ref3[1], flags = _ref3[2];
|
243
|
+
if (regex.slice(0, 2) === '/*') {
|
244
|
+
this.error('regular expressions cannot begin with `*`');
|
245
|
+
}
|
246
|
+
if (regex === '//') regex = '/(?:)/';
|
247
|
+
this.token('REGEX', "" + regex + flags);
|
248
|
+
return match.length;
|
249
|
+
};
|
250
|
+
|
251
|
+
Lexer.prototype.heregexToken = function(match) {
|
252
|
+
var body, flags, heregex, re, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4, _ref5;
|
253
|
+
heregex = match[0], body = match[1], flags = match[2];
|
254
|
+
if (0 > body.indexOf('#{')) {
|
255
|
+
re = body.replace(HEREGEX_OMIT, '').replace(/\//g, '\\/');
|
256
|
+
if (re.match(/^\*/)) {
|
257
|
+
this.error('regular expressions cannot begin with `*`');
|
258
|
+
}
|
259
|
+
this.token('REGEX', "/" + (re || '(?:)') + "/" + flags);
|
260
|
+
return heregex.length;
|
261
|
+
}
|
262
|
+
this.token('IDENTIFIER', 'RegExp');
|
263
|
+
this.tokens.push(['CALL_START', '(']);
|
264
|
+
tokens = [];
|
265
|
+
_ref2 = this.interpolateString(body, {
|
266
|
+
regex: true
|
267
|
+
});
|
268
|
+
for (_i = 0, _len = _ref2.length; _i < _len; _i++) {
|
269
|
+
_ref3 = _ref2[_i], tag = _ref3[0], value = _ref3[1];
|
270
|
+
if (tag === 'TOKENS') {
|
271
|
+
tokens.push.apply(tokens, value);
|
272
|
+
} else {
|
273
|
+
if (!(value = value.replace(HEREGEX_OMIT, ''))) continue;
|
274
|
+
value = value.replace(/\\/g, '\\\\');
|
275
|
+
tokens.push(['STRING', this.makeString(value, '"', true)]);
|
276
|
+
}
|
277
|
+
tokens.push(['+', '+']);
|
278
|
+
}
|
279
|
+
tokens.pop();
|
280
|
+
if (((_ref4 = tokens[0]) != null ? _ref4[0] : void 0) !== 'STRING') {
|
281
|
+
this.tokens.push(['STRING', '""'], ['+', '+']);
|
282
|
+
}
|
283
|
+
(_ref5 = this.tokens).push.apply(_ref5, tokens);
|
284
|
+
if (flags) this.tokens.push([',', ','], ['STRING', '"' + flags + '"']);
|
285
|
+
this.token(')', ')');
|
286
|
+
return heregex.length;
|
287
|
+
};
|
288
|
+
|
289
|
+
Lexer.prototype.lineToken = function() {
|
290
|
+
var diff, indent, match, noNewlines, prev, size;
|
291
|
+
if (!(match = MULTI_DENT.exec(this.chunk))) return 0;
|
292
|
+
indent = match[0];
|
293
|
+
this.line += count(indent, '\n');
|
294
|
+
this.seenFor = false;
|
295
|
+
prev = last(this.tokens, 1);
|
296
|
+
size = indent.length - 1 - indent.lastIndexOf('\n');
|
297
|
+
noNewlines = this.unfinished();
|
298
|
+
if (size - this.indebt === this.indent) {
|
299
|
+
if (noNewlines) {
|
300
|
+
this.suppressNewlines();
|
301
|
+
} else {
|
302
|
+
this.newlineToken();
|
303
|
+
}
|
304
|
+
return indent.length;
|
305
|
+
}
|
306
|
+
if (size > this.indent) {
|
307
|
+
if (noNewlines) {
|
308
|
+
this.indebt = size - this.indent;
|
309
|
+
this.suppressNewlines();
|
310
|
+
return indent.length;
|
311
|
+
}
|
312
|
+
diff = size - this.indent + this.outdebt;
|
313
|
+
this.token('INDENT', diff);
|
314
|
+
this.indents.push(diff);
|
315
|
+
this.ends.push('OUTDENT');
|
316
|
+
this.outdebt = this.indebt = 0;
|
317
|
+
} else {
|
318
|
+
this.indebt = 0;
|
319
|
+
this.outdentToken(this.indent - size, noNewlines);
|
320
|
+
}
|
321
|
+
this.indent = size;
|
322
|
+
return indent.length;
|
323
|
+
};
|
324
|
+
|
325
|
+
Lexer.prototype.outdentToken = function(moveOut, noNewlines) {
|
326
|
+
var dent, len;
|
327
|
+
while (moveOut > 0) {
|
328
|
+
len = this.indents.length - 1;
|
329
|
+
if (this.indents[len] === void 0) {
|
330
|
+
moveOut = 0;
|
331
|
+
} else if (this.indents[len] === this.outdebt) {
|
332
|
+
moveOut -= this.outdebt;
|
333
|
+
this.outdebt = 0;
|
334
|
+
} else if (this.indents[len] < this.outdebt) {
|
335
|
+
this.outdebt -= this.indents[len];
|
336
|
+
moveOut -= this.indents[len];
|
337
|
+
} else {
|
338
|
+
dent = this.indents.pop() - this.outdebt;
|
339
|
+
moveOut -= dent;
|
340
|
+
this.outdebt = 0;
|
341
|
+
this.pair('OUTDENT');
|
342
|
+
this.token('OUTDENT', dent);
|
343
|
+
}
|
344
|
+
}
|
345
|
+
if (dent) this.outdebt -= moveOut;
|
346
|
+
while (this.value() === ';') {
|
347
|
+
this.tokens.pop();
|
348
|
+
}
|
349
|
+
if (!(this.tag() === 'TERMINATOR' || noNewlines)) {
|
350
|
+
this.token('TERMINATOR', '\n');
|
351
|
+
}
|
352
|
+
return this;
|
353
|
+
};
|
354
|
+
|
355
|
+
Lexer.prototype.whitespaceToken = function() {
|
356
|
+
var match, nline, prev;
|
357
|
+
if (!((match = WHITESPACE.exec(this.chunk)) || (nline = this.chunk.charAt(0) === '\n'))) {
|
358
|
+
return 0;
|
359
|
+
}
|
360
|
+
prev = last(this.tokens);
|
361
|
+
if (prev) prev[match ? 'spaced' : 'newLine'] = true;
|
362
|
+
if (match) {
|
363
|
+
return match[0].length;
|
364
|
+
} else {
|
365
|
+
return 0;
|
366
|
+
}
|
367
|
+
};
|
368
|
+
|
369
|
+
Lexer.prototype.newlineToken = function() {
|
370
|
+
while (this.value() === ';') {
|
371
|
+
this.tokens.pop();
|
372
|
+
}
|
373
|
+
if (this.tag() !== 'TERMINATOR') this.token('TERMINATOR', '\n');
|
374
|
+
return this;
|
375
|
+
};
|
376
|
+
|
377
|
+
Lexer.prototype.suppressNewlines = function() {
|
378
|
+
if (this.value() === '\\') this.tokens.pop();
|
379
|
+
return this;
|
380
|
+
};
|
381
|
+
|
382
|
+
Lexer.prototype.literalToken = function() {
|
383
|
+
var match, prev, tag, value, _ref2, _ref3, _ref4, _ref5;
|
384
|
+
if (match = OPERATOR.exec(this.chunk)) {
|
385
|
+
value = match[0];
|
386
|
+
if (CODE.test(value)) this.tagParameters();
|
387
|
+
} else {
|
388
|
+
value = this.chunk.charAt(0);
|
389
|
+
}
|
390
|
+
tag = value;
|
391
|
+
prev = last(this.tokens);
|
392
|
+
if (value === '=' && prev) {
|
393
|
+
if (!prev[1].reserved && (_ref2 = prev[1], __indexOf.call(JS_FORBIDDEN, _ref2) >= 0)) {
|
394
|
+
this.error("reserved word \"" + (this.value()) + "\" can't be assigned");
|
395
|
+
}
|
396
|
+
if ((_ref3 = prev[1]) === '||' || _ref3 === '&&') {
|
397
|
+
prev[0] = 'COMPOUND_ASSIGN';
|
398
|
+
prev[1] += '=';
|
399
|
+
return value.length;
|
400
|
+
}
|
401
|
+
}
|
402
|
+
if (value === ';') {
|
403
|
+
this.seenFor = false;
|
404
|
+
tag = 'TERMINATOR';
|
405
|
+
} else if (__indexOf.call(MATH, value) >= 0) {
|
406
|
+
tag = 'MATH';
|
407
|
+
} else if (__indexOf.call(COMPARE, value) >= 0) {
|
408
|
+
tag = 'COMPARE';
|
409
|
+
} else if (__indexOf.call(COMPOUND_ASSIGN, value) >= 0) {
|
410
|
+
tag = 'COMPOUND_ASSIGN';
|
411
|
+
} else if (__indexOf.call(UNARY, value) >= 0) {
|
412
|
+
tag = 'UNARY';
|
413
|
+
} else if (__indexOf.call(SHIFT, value) >= 0) {
|
414
|
+
tag = 'SHIFT';
|
415
|
+
} else if (__indexOf.call(LOGIC, value) >= 0 || value === '?' && (prev != null ? prev.spaced : void 0)) {
|
416
|
+
tag = 'LOGIC';
|
417
|
+
} else if (prev && !prev.spaced) {
|
418
|
+
if (value === '(' && (_ref4 = prev[0], __indexOf.call(CALLABLE, _ref4) >= 0)) {
|
419
|
+
if (prev[0] === '?') prev[0] = 'FUNC_EXIST';
|
420
|
+
tag = 'CALL_START';
|
421
|
+
} else if (value === '[' && (_ref5 = prev[0], __indexOf.call(INDEXABLE, _ref5) >= 0)) {
|
422
|
+
tag = 'INDEX_START';
|
423
|
+
switch (prev[0]) {
|
424
|
+
case '?':
|
425
|
+
prev[0] = 'INDEX_SOAK';
|
426
|
+
}
|
427
|
+
}
|
428
|
+
}
|
429
|
+
switch (value) {
|
430
|
+
case '(':
|
431
|
+
case '{':
|
432
|
+
case '[':
|
433
|
+
this.ends.push(INVERSES[value]);
|
434
|
+
break;
|
435
|
+
case ')':
|
436
|
+
case '}':
|
437
|
+
case ']':
|
438
|
+
this.pair(value);
|
439
|
+
}
|
440
|
+
this.token(tag, value);
|
441
|
+
return value.length;
|
442
|
+
};
|
443
|
+
|
444
|
+
Lexer.prototype.sanitizeHeredoc = function(doc, options) {
|
445
|
+
var attempt, herecomment, indent, match, _ref2;
|
446
|
+
indent = options.indent, herecomment = options.herecomment;
|
447
|
+
if (herecomment) {
|
448
|
+
if (HEREDOC_ILLEGAL.test(doc)) {
|
449
|
+
this.error("block comment cannot contain \"*/\", starting");
|
450
|
+
}
|
451
|
+
if (doc.indexOf('\n') <= 0) return doc;
|
452
|
+
} else {
|
453
|
+
while (match = HEREDOC_INDENT.exec(doc)) {
|
454
|
+
attempt = match[1];
|
455
|
+
if (indent === null || (0 < (_ref2 = attempt.length) && _ref2 < indent.length)) {
|
456
|
+
indent = attempt;
|
457
|
+
}
|
458
|
+
}
|
459
|
+
}
|
460
|
+
if (indent) doc = doc.replace(RegExp("\\n" + indent, "g"), '\n');
|
461
|
+
if (!herecomment) doc = doc.replace(/^\n/, '');
|
462
|
+
return doc;
|
463
|
+
};
|
464
|
+
|
465
|
+
Lexer.prototype.tagParameters = function() {
|
466
|
+
var i, stack, tok, tokens;
|
467
|
+
if (this.tag() !== ')') return this;
|
468
|
+
stack = [];
|
469
|
+
tokens = this.tokens;
|
470
|
+
i = tokens.length;
|
471
|
+
tokens[--i][0] = 'PARAM_END';
|
472
|
+
while (tok = tokens[--i]) {
|
473
|
+
switch (tok[0]) {
|
474
|
+
case ')':
|
475
|
+
stack.push(tok);
|
476
|
+
break;
|
477
|
+
case '(':
|
478
|
+
case 'CALL_START':
|
479
|
+
if (stack.length) {
|
480
|
+
stack.pop();
|
481
|
+
} else if (tok[0] === '(') {
|
482
|
+
tok[0] = 'PARAM_START';
|
483
|
+
return this;
|
484
|
+
} else {
|
485
|
+
return this;
|
486
|
+
}
|
487
|
+
}
|
488
|
+
}
|
489
|
+
return this;
|
490
|
+
};
|
491
|
+
|
492
|
+
Lexer.prototype.closeIndentation = function() {
|
493
|
+
return this.outdentToken(this.indent);
|
494
|
+
};
|
495
|
+
|
496
|
+
Lexer.prototype.balancedString = function(str, end) {
|
497
|
+
var continueCount, i, letter, match, prev, stack, _i, _ref2;
|
498
|
+
continueCount = 0;
|
499
|
+
stack = [end];
|
500
|
+
for (i = _i = 1, _ref2 = str.length; 1 <= _ref2 ? _i < _ref2 : _i > _ref2; i = 1 <= _ref2 ? ++_i : --_i) {
|
501
|
+
if (continueCount) {
|
502
|
+
--continueCount;
|
503
|
+
continue;
|
504
|
+
}
|
505
|
+
switch (letter = str.charAt(i)) {
|
506
|
+
case '\\':
|
507
|
+
++continueCount;
|
508
|
+
continue;
|
509
|
+
case end:
|
510
|
+
stack.pop();
|
511
|
+
if (!stack.length) return str.slice(0, i + 1 || 9e9);
|
512
|
+
end = stack[stack.length - 1];
|
513
|
+
continue;
|
514
|
+
}
|
515
|
+
if (end === '}' && (letter === '"' || letter === "'")) {
|
516
|
+
stack.push(end = letter);
|
517
|
+
} else if (end === '}' && letter === '/' && (match = HEREGEX.exec(str.slice(i)) || REGEX.exec(str.slice(i)))) {
|
518
|
+
continueCount += match[0].length - 1;
|
519
|
+
} else if (end === '}' && letter === '{') {
|
520
|
+
stack.push(end = '}');
|
521
|
+
} else if (end === '"' && prev === '#' && letter === '{') {
|
522
|
+
stack.push(end = '}');
|
523
|
+
}
|
524
|
+
prev = letter;
|
525
|
+
}
|
526
|
+
return this.error("missing " + (stack.pop()) + ", starting");
|
527
|
+
};
|
528
|
+
|
529
|
+
Lexer.prototype.interpolateString = function(str, options) {
|
530
|
+
var expr, heredoc, i, inner, interpolated, len, letter, nested, pi, regex, tag, tokens, value, _i, _len, _ref2, _ref3, _ref4;
|
531
|
+
if (options == null) options = {};
|
532
|
+
heredoc = options.heredoc, regex = options.regex;
|
533
|
+
tokens = [];
|
534
|
+
pi = 0;
|
535
|
+
i = -1;
|
536
|
+
while (letter = str.charAt(i += 1)) {
|
537
|
+
if (letter === '\\') {
|
538
|
+
i += 1;
|
539
|
+
continue;
|
540
|
+
}
|
541
|
+
if (!(letter === '#' && str.charAt(i + 1) === '{' && (expr = this.balancedString(str.slice(i + 1), '}')))) {
|
542
|
+
continue;
|
543
|
+
}
|
544
|
+
if (pi < i) tokens.push(['NEOSTRING', str.slice(pi, i)]);
|
545
|
+
inner = expr.slice(1, -1);
|
546
|
+
if (inner.length) {
|
547
|
+
nested = new Lexer().tokenize(inner, {
|
548
|
+
line: this.line,
|
549
|
+
rewrite: false
|
550
|
+
});
|
551
|
+
nested.pop();
|
552
|
+
if (((_ref2 = nested[0]) != null ? _ref2[0] : void 0) === 'TERMINATOR') {
|
553
|
+
nested.shift();
|
554
|
+
}
|
555
|
+
if (len = nested.length) {
|
556
|
+
if (len > 1) {
|
557
|
+
nested.unshift(['(', '(', this.line]);
|
558
|
+
nested.push([')', ')', this.line]);
|
559
|
+
}
|
560
|
+
tokens.push(['TOKENS', nested]);
|
561
|
+
}
|
562
|
+
}
|
563
|
+
i += expr.length;
|
564
|
+
pi = i + 1;
|
565
|
+
}
|
566
|
+
if ((i > pi && pi < str.length)) tokens.push(['NEOSTRING', str.slice(pi)]);
|
567
|
+
if (regex) return tokens;
|
568
|
+
if (!tokens.length) return this.token('STRING', '""');
|
569
|
+
if (tokens[0][0] !== 'NEOSTRING') tokens.unshift(['', '']);
|
570
|
+
if (interpolated = tokens.length > 1) this.token('(', '(');
|
571
|
+
for (i = _i = 0, _len = tokens.length; _i < _len; i = ++_i) {
|
572
|
+
_ref3 = tokens[i], tag = _ref3[0], value = _ref3[1];
|
573
|
+
if (i) this.token('+', '+');
|
574
|
+
if (tag === 'TOKENS') {
|
575
|
+
(_ref4 = this.tokens).push.apply(_ref4, value);
|
576
|
+
} else {
|
577
|
+
this.token('STRING', this.makeString(value, '"', heredoc));
|
578
|
+
}
|
579
|
+
}
|
580
|
+
if (interpolated) this.token(')', ')');
|
581
|
+
return tokens;
|
582
|
+
};
|
583
|
+
|
584
|
+
Lexer.prototype.pair = function(tag) {
|
585
|
+
var size, wanted;
|
586
|
+
if (tag !== (wanted = last(this.ends))) {
|
587
|
+
if ('OUTDENT' !== wanted) this.error("unmatched " + tag);
|
588
|
+
this.indent -= size = last(this.indents);
|
589
|
+
this.outdentToken(size, true);
|
590
|
+
return this.pair(tag);
|
591
|
+
}
|
592
|
+
return this.ends.pop();
|
593
|
+
};
|
594
|
+
|
595
|
+
Lexer.prototype.token = function(tag, value) {
|
596
|
+
return this.tokens.push([tag, value, this.line]);
|
597
|
+
};
|
598
|
+
|
599
|
+
Lexer.prototype.tag = function(index, tag) {
|
600
|
+
var tok;
|
601
|
+
return (tok = last(this.tokens, index)) && (tag ? tok[0] = tag : tok[0]);
|
602
|
+
};
|
603
|
+
|
604
|
+
Lexer.prototype.value = function(index, val) {
|
605
|
+
var tok;
|
606
|
+
return (tok = last(this.tokens, index)) && (val ? tok[1] = val : tok[1]);
|
607
|
+
};
|
608
|
+
|
609
|
+
Lexer.prototype.unfinished = function() {
|
610
|
+
var _ref2;
|
611
|
+
return LINE_CONTINUER.test(this.chunk) || ((_ref2 = this.tag()) === '\\' || _ref2 === '.' || _ref2 === '?.' || _ref2 === 'UNARY' || _ref2 === 'MATH' || _ref2 === '+' || _ref2 === '-' || _ref2 === 'SHIFT' || _ref2 === 'RELATION' || _ref2 === 'COMPARE' || _ref2 === 'LOGIC' || _ref2 === 'THROW' || _ref2 === 'EXTENDS');
|
612
|
+
};
|
613
|
+
|
614
|
+
Lexer.prototype.escapeLines = function(str, heredoc) {
|
615
|
+
return str.replace(MULTILINER, heredoc ? '\\n' : '');
|
616
|
+
};
|
617
|
+
|
618
|
+
Lexer.prototype.makeString = function(body, quote, heredoc) {
|
619
|
+
if (!body) return quote + quote;
|
620
|
+
body = body.replace(/\\([\s\S])/g, function(match, contents) {
|
621
|
+
if (contents === '\n' || contents === quote) {
|
622
|
+
return contents;
|
623
|
+
} else {
|
624
|
+
return match;
|
625
|
+
}
|
626
|
+
});
|
627
|
+
body = body.replace(RegExp("" + quote, "g"), '\\$&');
|
628
|
+
return quote + this.escapeLines(body, heredoc) + quote;
|
629
|
+
};
|
630
|
+
|
631
|
+
Lexer.prototype.error = function(message) {
|
632
|
+
throw SyntaxError("" + message + " on line " + (this.line + 1));
|
633
|
+
};
|
634
|
+
|
635
|
+
return Lexer;
|
636
|
+
|
637
|
+
})();
|
638
|
+
|
639
|
+
JS_KEYWORDS = ['true', 'false', 'null', 'this', 'new', 'delete', 'typeof', 'in', 'instanceof', 'return', 'throw', 'break', 'continue', 'debugger', 'if', 'else', 'switch', 'for', 'while', 'do', 'try', 'catch', 'finally', 'class', 'extends', 'super'];
|
640
|
+
|
641
|
+
COFFEE_KEYWORDS = ['undefined', 'then', 'unless', 'until', 'loop', 'of', 'by', 'when'];
|
642
|
+
|
643
|
+
COFFEE_ALIAS_MAP = {
|
644
|
+
and: '&&',
|
645
|
+
or: '||',
|
646
|
+
is: '==',
|
647
|
+
isnt: '!=',
|
648
|
+
not: '!',
|
649
|
+
yes: 'true',
|
650
|
+
no: 'false',
|
651
|
+
on: 'true',
|
652
|
+
off: 'false'
|
653
|
+
};
|
654
|
+
|
655
|
+
COFFEE_ALIASES = (function() {
|
656
|
+
var _results;
|
657
|
+
_results = [];
|
658
|
+
for (key in COFFEE_ALIAS_MAP) {
|
659
|
+
_results.push(key);
|
660
|
+
}
|
661
|
+
return _results;
|
662
|
+
})();
|
663
|
+
|
664
|
+
COFFEE_KEYWORDS = COFFEE_KEYWORDS.concat(COFFEE_ALIASES);
|
665
|
+
|
666
|
+
RESERVED = ['case', 'default', 'function', 'var', 'void', 'with', 'const', 'let', 'enum', 'export', 'import', 'native', '__hasProp', '__extends', '__slice', '__bind', '__indexOf', 'implements', 'interface', 'let', 'package', 'private', 'protected', 'public', 'static', 'yield'];
|
667
|
+
|
668
|
+
STRICT_PROSCRIBED = ['arguments', 'eval'];
|
669
|
+
|
670
|
+
JS_FORBIDDEN = JS_KEYWORDS.concat(RESERVED).concat(STRICT_PROSCRIBED);
|
671
|
+
|
672
|
+
exports.RESERVED = RESERVED.concat(JS_KEYWORDS).concat(COFFEE_KEYWORDS).concat(STRICT_PROSCRIBED);
|
673
|
+
|
674
|
+
exports.STRICT_PROSCRIBED = STRICT_PROSCRIBED;
|
675
|
+
|
676
|
+
IDENTIFIER = /^([$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)([^\n\S]*:(?!:))?/;
|
677
|
+
|
678
|
+
NUMBER = /^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i;
|
679
|
+
|
680
|
+
HEREDOC = /^("""|''')([\s\S]*?)(?:\n[^\n\S]*)?\1/;
|
681
|
+
|
682
|
+
OPERATOR = /^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>])\2=?|\?\.|\.{2,3})/;
|
683
|
+
|
684
|
+
WHITESPACE = /^[^\n\S]+/;
|
685
|
+
|
686
|
+
COMMENT = /^###([^#][\s\S]*?)(?:###[^\n\S]*|(?:###)?$)|^(?:\s*#(?!##[^#]).*)+/;
|
687
|
+
|
688
|
+
CODE = /^[-=]>/;
|
689
|
+
|
690
|
+
MULTI_DENT = /^(?:\n[^\n\S]*)+/;
|
691
|
+
|
692
|
+
SIMPLESTR = /^'[^\\']*(?:\\.[^\\']*)*'/;
|
693
|
+
|
694
|
+
JSTOKEN = /^`[^\\`]*(?:\\.[^\\`]*)*`/;
|
695
|
+
|
696
|
+
REGEX = /^(\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)([imgy]{0,4})(?!\w)/;
|
697
|
+
|
698
|
+
HEREGEX = /^\/{3}([\s\S]+?)\/{3}([imgy]{0,4})(?!\w)/;
|
699
|
+
|
700
|
+
HEREGEX_OMIT = /\s+(?:#.*)?/g;
|
701
|
+
|
702
|
+
MULTILINER = /\n/g;
|
703
|
+
|
704
|
+
HEREDOC_INDENT = /\n+([^\n\S]*)/g;
|
705
|
+
|
706
|
+
HEREDOC_ILLEGAL = /\*\//;
|
707
|
+
|
708
|
+
LINE_CONTINUER = /^\s*(?:,|\??\.(?![.\d])|::)/;
|
709
|
+
|
710
|
+
TRAILING_SPACES = /\s+$/;
|
711
|
+
|
712
|
+
COMPOUND_ASSIGN = ['-=', '+=', '/=', '*=', '%=', '||=', '&&=', '?=', '<<=', '>>=', '>>>=', '&=', '^=', '|='];
|
713
|
+
|
714
|
+
UNARY = ['!', '~', 'NEW', 'TYPEOF', 'DELETE', 'DO'];
|
715
|
+
|
716
|
+
LOGIC = ['&&', '||', '&', '|', '^'];
|
717
|
+
|
718
|
+
SHIFT = ['<<', '>>', '>>>'];
|
719
|
+
|
720
|
+
COMPARE = ['==', '!=', '<', '>', '<=', '>='];
|
721
|
+
|
722
|
+
MATH = ['*', '/', '%'];
|
723
|
+
|
724
|
+
RELATION = ['IN', 'OF', 'INSTANCEOF'];
|
725
|
+
|
726
|
+
BOOL = ['TRUE', 'FALSE', 'NULL', 'UNDEFINED'];
|
727
|
+
|
728
|
+
NOT_REGEX = ['NUMBER', 'REGEX', 'BOOL', '++', '--', ']'];
|
729
|
+
|
730
|
+
NOT_SPACED_REGEX = NOT_REGEX.concat(')', '}', 'THIS', 'IDENTIFIER', 'STRING');
|
731
|
+
|
732
|
+
CALLABLE = ['IDENTIFIER', 'STRING', 'REGEX', ')', ']', '}', '?', '::', '@', 'THIS', 'SUPER'];
|
733
|
+
|
734
|
+
INDEXABLE = CALLABLE.concat('NUMBER', 'BOOL');
|
735
|
+
|
736
|
+
LINE_BREAK = ['INDENT', 'OUTDENT', 'TERMINATOR'];
|
737
|
+
|
738
|
+
|
739
|
+
});
|