Repository: Kreijstal/ace Branch: master Commit: e78cfb3266b2 Files: 1344 Total size: 15.9 MB Directory structure: gitextract_jdydfuhz/ ├── .gitignore ├── CNAME ├── CONTRIBUTING.md ├── ChangeLog.txt ├── LICENSE ├── Makefile ├── Makefile.dryice.js ├── Readme.md ├── api/ │ ├── ace.html │ ├── anchor.html │ ├── background_tokenizer.html │ ├── command_manager.html │ ├── document.html │ ├── edit_session.html │ ├── editor.html │ ├── index.html │ ├── placeholder.html │ ├── range.html │ ├── renderloop.html │ ├── resources/ │ │ ├── csses/ │ │ │ └── ace_api.css │ │ └── javascripts/ │ │ ├── bbq.js │ │ ├── bootstrap.js │ │ ├── clicker.js │ │ ├── disqus-ext.js │ │ ├── jquery-scrollspy.js │ │ ├── jquery.collapse.js │ │ ├── jquery.cookie.js │ │ ├── plugins.js │ │ ├── prettify-extension.js │ │ ├── prettify.js │ │ └── ux.js │ ├── scrollbar.html │ ├── search.html │ ├── selection.html │ ├── split.html │ ├── token_iterator.html │ ├── tokenizer.html │ ├── undomanager.html │ └── virtual_renderer.html ├── build_support/ │ ├── bookmarklet.html │ ├── editor.html │ ├── mini_require.js │ └── style.css ├── demo/ │ ├── autocompletion.html │ ├── autoresize.html │ ├── emmet.html │ ├── ie7.html │ ├── keyboard_shortcuts.html │ ├── kitchen-sink/ │ │ ├── demo.js │ │ ├── dev_util.js │ │ ├── doclist.js │ │ ├── docs/ │ │ │ ├── Dockerfile │ │ │ ├── Haxe.hx │ │ │ ├── Jack.jack │ │ │ ├── Makefile │ │ │ ├── Nix.nix │ │ │ ├── abap.abap │ │ │ ├── abc.abc │ │ │ ├── actionscript.as │ │ │ ├── ada.ada │ │ │ ├── asciidoc.asciidoc │ │ │ ├── assembly_x86.asm │ │ │ ├── autohotkey.ahk │ │ │ ├── batchfile.bat │ │ │ ├── bro.bro │ │ │ ├── c9search.c9search_results │ │ │ ├── c_cpp.cpp │ │ │ ├── cirru.cirru │ │ │ ├── clojure.clj │ │ │ ├── cobol.CBL │ │ │ ├── coffee.coffee │ │ │ ├── coldfusion.cfm │ │ │ ├── csharp.cs │ │ │ ├── csound_document.csd │ │ │ ├── csound_orchestra.orc │ │ │ ├── csound_score.sco │ │ │ ├── css.css │ │ │ ├── curly.curly │ │ │ ├── d.d │ │ │ ├── dart.dart │ │ │ ├── diff.diff │ │ │ ├── dot.dot │ │ │ ├── drools.drl │ │ │ ├── eiffel.e │ │ │ ├── ejs.ejs │ │ │ ├── elixir.ex │ │ │ ├── elm.elm │ │ │ ├── erlang.erl │ │ │ ├── forth.frt │ │ │ ├── fortran.f90 │ │ │ ├── ftl.ftl │ │ │ ├── gcode.gcode │ │ │ ├── gherkin.feature │ │ │ ├── glsl.glsl │ │ │ ├── gobstones.gbs │ │ │ ├── golang.go │ │ │ ├── graphqlschema.gql │ │ │ ├── groovy.groovy │ │ │ ├── haml.haml │ │ │ ├── handlebars.hbs │ │ │ ├── haskell.hs │ │ │ ├── haskell_cabal.cabal │ │ │ ├── hjson.hjson │ │ │ ├── htaccess │ │ │ ├── html.html │ │ │ ├── html_elixir.eex │ │ │ ├── html_ruby.erb │ │ │ ├── ini.ini │ │ │ ├── io.io │ │ │ ├── jade.jade │ │ │ ├── java.java │ │ │ ├── javascript.js │ │ │ ├── json.json │ │ │ ├── jsoniq.jq │ │ │ ├── jsp.jsp │ │ │ ├── jssm.jssm │ │ │ ├── jsx.jsx │ │ │ ├── julia.jl │ │ │ ├── kotlin.kt │ │ │ ├── latex.tex │ │ │ ├── less.less │ │ │ ├── liquid.liquid │ │ │ ├── lisp.lisp │ │ │ ├── livescript.ls │ │ │ ├── logiql.logic │ │ │ ├── lsl.lsl │ │ │ ├── lua.lua │ │ │ ├── luapage.lp │ │ │ ├── lucene.lucene │ │ │ ├── markdown.md │ │ │ ├── mask.mask │ │ │ ├── matlab.matlab │ │ │ ├── maze.mz │ │ │ ├── mel.mel │ │ │ ├── mixal.mixal │ │ │ ├── mushcode.mc │ │ │ ├── mysql.mysql │ │ │ ├── nsis.nsi │ │ │ ├── objectivec.m │ │ │ ├── ocaml.ml │ │ │ ├── pascal.pas │ │ │ ├── perl.pl │ │ │ ├── pgsql.pgsql │ │ │ ├── php.php │ │ │ ├── pig.pig │ │ │ ├── plaintext.txt │ │ │ ├── powershell.ps1 │ │ │ ├── praat.praat │ │ │ ├── prolog.plg │ │ │ ├── properties.properties │ │ │ ├── protobuf.proto │ │ │ ├── python.py │ │ │ ├── r.r │ │ │ ├── razor.cshtml │ │ │ ├── rdoc.Rd │ │ │ ├── red.red │ │ │ ├── rhtml.Rhtml │ │ │ ├── rst.rst │ │ │ ├── ruby.rb │ │ │ ├── rust.rs │ │ │ ├── sass.sass │ │ │ ├── scad.scad │ │ │ ├── scala.scala │ │ │ ├── scheme.scm │ │ │ ├── scss.scss │ │ │ ├── sh.sh │ │ │ ├── sjs.sjs │ │ │ ├── smarty.smarty │ │ │ ├── snippets.snippets │ │ │ ├── soy_template.soy │ │ │ ├── space.space │ │ │ ├── sparql.rq │ │ │ ├── sql.sql │ │ │ ├── sqlserver.sqlserver │ │ │ ├── stylus.styl │ │ │ ├── swift.swift │ │ │ ├── tcl.tcl │ │ │ ├── tex.tex │ │ │ ├── textile.textile │ │ │ ├── toml.toml │ │ │ ├── tsx.tsx │ │ │ ├── turtle.ttl │ │ │ ├── twig.twig │ │ │ ├── typescript.ts │ │ │ ├── vala.vala │ │ │ ├── vbscript.vbs │ │ │ ├── velocity.vm │ │ │ ├── verilog.v │ │ │ ├── vhdl.vhd │ │ │ ├── wollok.wlk │ │ │ ├── xml.xml │ │ │ ├── xquery.xq │ │ │ └── yaml.yaml │ │ ├── file_drop.js │ │ ├── inline_editor.js │ │ ├── layout.js │ │ ├── require.js │ │ ├── styles.css │ │ ├── token_tooltip.js │ │ └── util.js │ ├── modelist.html │ ├── r.js/ │ │ ├── build.js │ │ └── editor.html │ ├── requirejs+build.html │ ├── scrollable-page.html │ ├── settings_menu.html │ ├── show_own_source.js │ ├── static-highlighter/ │ │ ├── client.html │ │ └── server.js │ ├── static-highlighter.html │ ├── statusbar.html │ └── xml.xml ├── doc/ │ ├── README.md │ ├── additionalObjs.json │ ├── build.js │ ├── index.md │ ├── package.json │ ├── site/ │ │ ├── iphone.css │ │ ├── js/ │ │ │ ├── ga.js │ │ │ └── main.js │ │ └── style.css │ └── template/ │ ├── jade/ │ │ ├── common_layout.jade │ │ ├── layout.jade │ │ └── lib.jade │ └── resources/ │ ├── csses/ │ │ └── ace_api.css │ └── javascripts/ │ ├── bbq.js │ ├── bootstrap.js │ ├── clicker.js │ ├── disqus-ext.js │ ├── jquery-scrollspy.js │ ├── jquery.collapse.js │ ├── jquery.cookie.js │ ├── plugins.js │ ├── prettify-extension.js │ ├── prettify.js │ └── ux.js ├── experiments/ │ ├── animate_folding.html │ ├── basic_animation.html │ ├── capture.html │ ├── cut_copy.html │ ├── debug_mem_leak.html │ ├── dom.html │ ├── triple_click.html │ ├── worker.html │ └── worker.js ├── index.html ├── kitchen-sink.html ├── lib/ │ └── ace/ │ ├── ace.js │ ├── anchor.js │ ├── anchor_test.js │ ├── apply_delta.js │ ├── autocomplete/ │ │ ├── popup.js │ │ ├── text_completer.js │ │ └── util.js │ ├── autocomplete.js │ ├── background_tokenizer.js │ ├── background_tokenizer_test.js │ ├── bidihandler.js │ ├── clipboard.js │ ├── commands/ │ │ ├── command_manager.js │ │ ├── command_manager_test.js │ │ ├── default_commands.js │ │ ├── incremental_search_commands.js │ │ ├── multi_select_commands.js │ │ └── occur_commands.js │ ├── config.js │ ├── config_test.js │ ├── css/ │ │ └── editor.css │ ├── document.js │ ├── document_test.js │ ├── edit_session/ │ │ ├── bracket_match.js │ │ ├── fold.js │ │ ├── fold_line.js │ │ └── folding.js │ ├── edit_session.js │ ├── edit_session_test.js │ ├── editor.js │ ├── editor_change_document_test.js │ ├── editor_highlight_selected_word_test.js │ ├── editor_navigation_test.js │ ├── editor_text_edit_test.js │ ├── ext/ │ │ ├── beautify/ │ │ │ └── php_rules.js │ │ ├── beautify.js │ │ ├── elastic_tabstops_lite.js │ │ ├── emmet.js │ │ ├── error_marker.js │ │ ├── keybinding_menu.js │ │ ├── language_tools.js │ │ ├── linking.js │ │ ├── menu_tools/ │ │ │ ├── add_editor_menu_options.js │ │ │ ├── element_generator.js │ │ │ ├── generate_settings_menu.js │ │ │ ├── get_editor_keyboard_shortcuts.js │ │ │ ├── get_set_functions.js │ │ │ ├── overlay_page.js │ │ │ └── settings_menu.css │ │ ├── modelist.js │ │ ├── searchbox.css │ │ ├── searchbox.js │ │ ├── settings_menu.js │ │ ├── spellcheck.js │ │ ├── split.js │ │ ├── static.css │ │ ├── static_highlight.js │ │ ├── static_highlight_test.js │ │ ├── statusbar.js │ │ ├── textarea.js │ │ ├── themelist.js │ │ ├── whitespace.js │ │ └── whitespace_test.js │ ├── incremental_search.js │ ├── incremental_search_test.js │ ├── keyboard/ │ │ ├── emacs.js │ │ ├── emacs_test.js │ │ ├── hash_handler.js │ │ ├── keybinding.js │ │ ├── keybinding_test.js │ │ ├── state_handler.js │ │ ├── textarea.js │ │ ├── textinput.js │ │ ├── textinput_ios.js │ │ ├── vim.js │ │ └── vim_test.js │ ├── layer/ │ │ ├── cursor.js │ │ ├── font_metrics.js │ │ ├── gutter.js │ │ ├── marker.js │ │ ├── text.js │ │ └── text_test.js │ ├── lib/ │ │ ├── app_config.js │ │ ├── bidiutil.js │ │ ├── dom.js │ │ ├── es5-shim.js │ │ ├── event.js │ │ ├── event_emitter.js │ │ ├── event_emitter_test.js │ │ ├── fixoldbrowsers.js │ │ ├── keys.js │ │ ├── lang.js │ │ ├── net.js │ │ ├── oop.js │ │ ├── regexp.js │ │ └── useragent.js │ ├── line_widgets.js │ ├── mode/ │ │ ├── _test/ │ │ │ ├── Readme.md │ │ │ ├── highlight_rules_test.js │ │ │ ├── package.json │ │ │ ├── text_asciidoc.txt │ │ │ ├── text_coffee.txt │ │ │ ├── text_coldfusion.txt │ │ │ ├── text_curly.txt │ │ │ ├── text_ejs.txt │ │ │ ├── text_gobstones.txt │ │ │ ├── text_html.txt │ │ │ ├── text_javascript.txt │ │ │ ├── text_livescript.txt │ │ │ ├── text_lucene.txt │ │ │ ├── text_markdown.txt │ │ │ ├── text_php.txt │ │ │ ├── text_ruby.txt │ │ │ ├── text_rust.txt │ │ │ ├── text_wollok.txt │ │ │ ├── text_xml.txt │ │ │ ├── tokens_abap.json │ │ │ ├── tokens_abc.json │ │ │ ├── tokens_actionscript.json │ │ │ ├── tokens_ada.json │ │ │ ├── tokens_asciidoc.json │ │ │ ├── tokens_assembly_x86.json │ │ │ ├── tokens_autohotkey.json │ │ │ ├── tokens_batchfile.json │ │ │ ├── tokens_c9search.json │ │ │ ├── tokens_c_cpp.json │ │ │ ├── tokens_cirru.json │ │ │ ├── tokens_clojure.json │ │ │ ├── tokens_cobol.json │ │ │ ├── tokens_coffee.json │ │ │ ├── tokens_coldfusion.json │ │ │ ├── tokens_csharp.json │ │ │ ├── tokens_csound_document.json │ │ │ ├── tokens_csound_orchestra.json │ │ │ ├── tokens_csound_score.json │ │ │ ├── tokens_css.json │ │ │ ├── tokens_curly.json │ │ │ ├── tokens_d.json │ │ │ ├── tokens_dart.json │ │ │ ├── tokens_diff.json │ │ │ ├── tokens_dot.json │ │ │ ├── tokens_drools.json │ │ │ ├── tokens_eiffel.json │ │ │ ├── tokens_ejs.json │ │ │ ├── tokens_elixir.json │ │ │ ├── tokens_elm.json │ │ │ ├── tokens_erlang.json │ │ │ ├── tokens_forth.json │ │ │ ├── tokens_fortran.json │ │ │ ├── tokens_ftl.json │ │ │ ├── tokens_gcode.json │ │ │ ├── tokens_gherkin.json │ │ │ ├── tokens_gitignore.json │ │ │ ├── tokens_glsl.json │ │ │ ├── tokens_gobstones.json │ │ │ ├── tokens_golang.json │ │ │ ├── tokens_groovy.json │ │ │ ├── tokens_haml.json │ │ │ ├── tokens_handlebars.json │ │ │ ├── tokens_haskell.json │ │ │ ├── tokens_haxe.json │ │ │ ├── tokens_html.json │ │ │ ├── tokens_html_elixir.json │ │ │ ├── tokens_html_ruby.json │ │ │ ├── tokens_ini.json │ │ │ ├── tokens_io.json │ │ │ ├── tokens_jack.json │ │ │ ├── tokens_jade.json │ │ │ ├── tokens_java.json │ │ │ ├── tokens_javascript.json │ │ │ ├── tokens_json.json │ │ │ ├── tokens_jsoniq.json │ │ │ ├── tokens_jsp.json │ │ │ ├── tokens_jsx.json │ │ │ ├── tokens_julia.json │ │ │ ├── tokens_latex.json │ │ │ ├── tokens_less.json │ │ │ ├── tokens_liquid.json │ │ │ ├── tokens_lisp.json │ │ │ ├── tokens_livescript.json │ │ │ ├── tokens_logiql.json │ │ │ ├── tokens_lsl.json │ │ │ ├── tokens_lua.json │ │ │ ├── tokens_luapage.json │ │ │ ├── tokens_lucene.json │ │ │ ├── tokens_markdown.json │ │ │ ├── tokens_mask.json │ │ │ ├── tokens_matlab.json │ │ │ ├── tokens_maze.json │ │ │ ├── tokens_mel.json │ │ │ ├── tokens_mixal.json │ │ │ ├── tokens_mushcode.json │ │ │ ├── tokens_mysql.json │ │ │ ├── tokens_nix.json │ │ │ ├── tokens_nsis.json │ │ │ ├── tokens_objectivec.json │ │ │ ├── tokens_ocaml.json │ │ │ ├── tokens_pascal.json │ │ │ ├── tokens_perl.json │ │ │ ├── tokens_pgsql.json │ │ │ ├── tokens_php.json │ │ │ ├── tokens_powershell.json │ │ │ ├── tokens_praat.json │ │ │ ├── tokens_prolog.json │ │ │ ├── tokens_properties.json │ │ │ ├── tokens_protobuf.json │ │ │ ├── tokens_python.json │ │ │ ├── tokens_r.json │ │ │ ├── tokens_razor.json │ │ │ ├── tokens_rdoc.json │ │ │ ├── tokens_rhtml.json │ │ │ ├── tokens_ruby.json │ │ │ ├── tokens_rust.json │ │ │ ├── tokens_sass.json │ │ │ ├── tokens_scad.json │ │ │ ├── tokens_scala.json │ │ │ ├── tokens_scheme.json │ │ │ ├── tokens_scss.json │ │ │ ├── tokens_sh.json │ │ │ ├── tokens_sjs.json │ │ │ ├── tokens_smarty.json │ │ │ ├── tokens_snippets.json │ │ │ ├── tokens_soy_template.json │ │ │ ├── tokens_space.json │ │ │ ├── tokens_sql.json │ │ │ ├── tokens_sqlserver.json │ │ │ ├── tokens_stylus.json │ │ │ ├── tokens_svg.json │ │ │ ├── tokens_swift.json │ │ │ ├── tokens_tcl.json │ │ │ ├── tokens_tex.json │ │ │ ├── tokens_text.json │ │ │ ├── tokens_textile.json │ │ │ ├── tokens_toml.json │ │ │ ├── tokens_tsx.json │ │ │ ├── tokens_twig.json │ │ │ ├── tokens_typescript.json │ │ │ ├── tokens_vala.json │ │ │ ├── tokens_vbscript.json │ │ │ ├── tokens_velocity.json │ │ │ ├── tokens_verilog.json │ │ │ ├── tokens_vhdl.json │ │ │ ├── tokens_wollok.json │ │ │ ├── tokens_xml.json │ │ │ ├── tokens_xquery.json │ │ │ └── tokens_yaml.json │ │ ├── abap.js │ │ ├── abap_highlight_rules.js │ │ ├── abc.js │ │ ├── abc_highlight_rules.js │ │ ├── actionscript.js │ │ ├── actionscript_highlight_rules.js │ │ ├── ada.js │ │ ├── ada_highlight_rules.js │ │ ├── apache_conf.js │ │ ├── apache_conf_highlight_rules.js │ │ ├── applescript.js │ │ ├── applescript_highlight_rules.js │ │ ├── asciidoc.js │ │ ├── asciidoc_highlight_rules.js │ │ ├── assembly_x86.js │ │ ├── assembly_x86_highlight_rules.js │ │ ├── autohotkey.js │ │ ├── autohotkey_highlight_rules.js │ │ ├── batchfile.js │ │ ├── batchfile_highlight_rules.js │ │ ├── behaviour/ │ │ │ ├── behaviour_test.js │ │ │ ├── css.js │ │ │ ├── cstyle.js │ │ │ ├── html.js │ │ │ ├── xml.js │ │ │ └── xquery.js │ │ ├── behaviour.js │ │ ├── bro.js │ │ ├── bro_highlight_rules.js │ │ ├── c9search.js │ │ ├── c9search_highlight_rules.js │ │ ├── c_cpp.js │ │ ├── c_cpp_highlight_rules.js │ │ ├── cirru.js │ │ ├── cirru_highlight_rules.js │ │ ├── clojure.js │ │ ├── clojure_highlight_rules.js │ │ ├── cobol.js │ │ ├── cobol_highlight_rules.js │ │ ├── coffee/ │ │ │ ├── coffee.js │ │ │ └── parser_test.js │ │ ├── coffee.js │ │ ├── coffee_highlight_rules.js │ │ ├── coffee_worker.js │ │ ├── coldfusion.js │ │ ├── coldfusion_highlight_rules.js │ │ ├── coldfusion_test.js │ │ ├── csharp.js │ │ ├── csharp_highlight_rules.js │ │ ├── csound_document.js │ │ ├── csound_document_highlight_rules.js │ │ ├── csound_orchestra.js │ │ ├── csound_orchestra_highlight_rules.js │ │ ├── csound_preprocessor_highlight_rules.js │ │ ├── csound_score.js │ │ ├── csound_score_highlight_rules.js │ │ ├── css/ │ │ │ └── csslint.js │ │ ├── css.js │ │ ├── css_completions.js │ │ ├── css_highlight_rules.js │ │ ├── css_test.js │ │ ├── css_worker.js │ │ ├── css_worker_test.js │ │ ├── curly.js │ │ ├── curly_highlight_rules.js │ │ ├── d.js │ │ ├── d_highlight_rules.js │ │ ├── dart.js │ │ ├── dart_highlight_rules.js │ │ ├── diff.js │ │ ├── diff_highlight_rules.js │ │ ├── django.js │ │ ├── doc_comment_highlight_rules.js │ │ ├── dockerfile.js │ │ ├── dockerfile_highlight_rules.js │ │ ├── dot.js │ │ ├── dot_highlight_rules.js │ │ ├── drools.js │ │ ├── drools_highlight_rules.js │ │ ├── eiffel.js │ │ ├── eiffel_highlight_rules.js │ │ ├── ejs.js │ │ ├── elixir.js │ │ ├── elixir_highlight_rules.js │ │ ├── elm.js │ │ ├── elm_highlight_rules.js │ │ ├── erlang.js │ │ ├── erlang_highlight_rules.js │ │ ├── folding/ │ │ │ ├── asciidoc.js │ │ │ ├── c9search.js │ │ │ ├── coffee.js │ │ │ ├── coffee_test.js │ │ │ ├── csharp.js │ │ │ ├── cstyle.js │ │ │ ├── cstyle_test.js │ │ │ ├── diff.js │ │ │ ├── drools.js │ │ │ ├── fold_mode.js │ │ │ ├── haskell_cabal.js │ │ │ ├── html.js │ │ │ ├── html_test.js │ │ │ ├── ini.js │ │ │ ├── latex.js │ │ │ ├── lua.js │ │ │ ├── markdown.js │ │ │ ├── mixed.js │ │ │ ├── pythonic.js │ │ │ ├── pythonic_test.js │ │ │ ├── sqlserver.js │ │ │ ├── velocity.js │ │ │ ├── xml.js │ │ │ └── xml_test.js │ │ ├── forth.js │ │ ├── forth_highlight_rules.js │ │ ├── fortran.js │ │ ├── fortran_highlight_rules.js │ │ ├── ftl.js │ │ ├── ftl_highlight_rules.js │ │ ├── gcode.js │ │ ├── gcode_highlight_rules.js │ │ ├── gherkin.js │ │ ├── gherkin_highlight_rules.js │ │ ├── gitignore.js │ │ ├── gitignore_highlight_rules.js │ │ ├── glsl.js │ │ ├── glsl_highlight_rules.js │ │ ├── gobstones.js │ │ ├── gobstones_highlight_rules.js │ │ ├── golang.js │ │ ├── golang_highlight_rules.js │ │ ├── graphqlschema.js │ │ ├── graphqlschema_highlight_rules.js │ │ ├── groovy.js │ │ ├── groovy_highlight_rules.js │ │ ├── haml.js │ │ ├── haml_highlight_rules.js │ │ ├── handlebars.js │ │ ├── handlebars_highlight_rules.js │ │ ├── haskell.js │ │ ├── haskell_cabal.js │ │ ├── haskell_cabal_highlight_rules.js │ │ ├── haskell_highlight_rules.js │ │ ├── haxe.js │ │ ├── haxe_highlight_rules.js │ │ ├── hjson.js │ │ ├── hjson_highlight_rules.js │ │ ├── html/ │ │ │ └── saxparser.js │ │ ├── html.js │ │ ├── html_completions.js │ │ ├── html_elixir.js │ │ ├── html_elixir_highlight_rules.js │ │ ├── html_highlight_rules.js │ │ ├── html_ruby.js │ │ ├── html_ruby_highlight_rules.js │ │ ├── html_test.js │ │ ├── html_worker.js │ │ ├── ini.js │ │ ├── ini_highlight_rules.js │ │ ├── io.js │ │ ├── io_highlight_rules.js │ │ ├── jack.js │ │ ├── jack_highlight_rules.js │ │ ├── jade.js │ │ ├── jade_highlight_rules.js │ │ ├── java.js │ │ ├── java_highlight_rules.js │ │ ├── javascript/ │ │ │ └── jshint.js │ │ ├── javascript.js │ │ ├── javascript_highlight_rules.js │ │ ├── javascript_test.js │ │ ├── javascript_worker.js │ │ ├── javascript_worker_test.js │ │ ├── js_regex_highlight_rules.js │ │ ├── json/ │ │ │ └── json_parse.js │ │ ├── json.js │ │ ├── json_highlight_rules.js │ │ ├── json_worker.js │ │ ├── json_worker_test.js │ │ ├── jsoniq.js │ │ ├── jsp.js │ │ ├── jsp_highlight_rules.js │ │ ├── jssm.js │ │ ├── jssm_highlight_rules.js │ │ ├── jsx.js │ │ ├── jsx_highlight_rules.js │ │ ├── julia.js │ │ ├── julia_highlight_rules.js │ │ ├── kotlin.js │ │ ├── kotlin_highlight_rules.js │ │ ├── latex.js │ │ ├── latex_highlight_rules.js │ │ ├── less.js │ │ ├── less_highlight_rules.js │ │ ├── liquid.js │ │ ├── liquid_highlight_rules.js │ │ ├── lisp.js │ │ ├── lisp_highlight_rules.js │ │ ├── livescript.js │ │ ├── logiql.js │ │ ├── logiql_highlight_rules.js │ │ ├── logiql_test.js │ │ ├── lsl.js │ │ ├── lsl_highlight_rules.js │ │ ├── lua/ │ │ │ └── luaparse.js │ │ ├── lua.js │ │ ├── lua_highlight_rules.js │ │ ├── lua_worker.js │ │ ├── luapage.js │ │ ├── luapage_highlight_rules.js │ │ ├── lucene.js │ │ ├── lucene_highlight_rules.js │ │ ├── makefile.js │ │ ├── makefile_highlight_rules.js │ │ ├── markdown.js │ │ ├── markdown_highlight_rules.js │ │ ├── mask.js │ │ ├── mask_highlight_rules.js │ │ ├── matching_brace_outdent.js │ │ ├── matching_parens_outdent.js │ │ ├── matlab.js │ │ ├── matlab_highlight_rules.js │ │ ├── maze.js │ │ ├── maze_highlight_rules.js │ │ ├── mel.js │ │ ├── mel_highlight_rules.js │ │ ├── mixal.js │ │ ├── mixal_highlight_rules.js │ │ ├── mushcode.js │ │ ├── mushcode_highlight_rules.js │ │ ├── mysql.js │ │ ├── mysql_highlight_rules.js │ │ ├── nix.js │ │ ├── nix_highlight_rules.js │ │ ├── nsis.js │ │ ├── nsis_highlight_rules.js │ │ ├── objectivec.js │ │ ├── objectivec_highlight_rules.js │ │ ├── ocaml.js │ │ ├── ocaml_highlight_rules.js │ │ ├── pascal.js │ │ ├── pascal_highlight_rules.js │ │ ├── perl.js │ │ ├── perl_highlight_rules.js │ │ ├── pgsql.js │ │ ├── pgsql_highlight_rules.js │ │ ├── php/ │ │ │ └── php.js │ │ ├── php.js │ │ ├── php_completions.js │ │ ├── php_highlight_rules.js │ │ ├── php_test.js │ │ ├── php_worker.js │ │ ├── pig.js │ │ ├── pig_highlight_rules.js │ │ ├── plain_text.js │ │ ├── plain_text_test.js │ │ ├── powershell.js │ │ ├── powershell_highlight_rules.js │ │ ├── praat.js │ │ ├── praat_highlight_rules.js │ │ ├── prolog.js │ │ ├── prolog_highlight_rules.js │ │ ├── properties.js │ │ ├── properties_highlight_rules.js │ │ ├── protobuf.js │ │ ├── protobuf_highlight_rules.js │ │ ├── python.js │ │ ├── python_highlight_rules.js │ │ ├── python_test.js │ │ ├── r.js │ │ ├── r_highlight_rules.js │ │ ├── razor.js │ │ ├── razor_completions.js │ │ ├── razor_highlight_rules.js │ │ ├── rdoc.js │ │ ├── rdoc_highlight_rules.js │ │ ├── red.js │ │ ├── red_highlight_rules.js │ │ ├── rhtml.js │ │ ├── rhtml_highlight_rules.js │ │ ├── rst.js │ │ ├── rst_highlight_rules.js │ │ ├── ruby.js │ │ ├── ruby_highlight_rules.js │ │ ├── ruby_test.js │ │ ├── rust.js │ │ ├── rust_highlight_rules.js │ │ ├── sass.js │ │ ├── sass_highlight_rules.js │ │ ├── scad.js │ │ ├── scad_highlight_rules.js │ │ ├── scala.js │ │ ├── scala_highlight_rules.js │ │ ├── scheme.js │ │ ├── scheme_highlight_rules.js │ │ ├── scss.js │ │ ├── scss_highlight_rules.js │ │ ├── sh.js │ │ ├── sh_highlight_rules.js │ │ ├── sjs.js │ │ ├── sjs_highlight_rules.js │ │ ├── smarty.js │ │ ├── smarty_highlight_rules.js │ │ ├── snippets.js │ │ ├── soy_template.js │ │ ├── soy_template_highlight_rules.js │ │ ├── space.js │ │ ├── space_highlight_rules.js │ │ ├── sparql.js │ │ ├── sparql_highlight_rules.js │ │ ├── sql.js │ │ ├── sql_highlight_rules.js │ │ ├── sqlserver.js │ │ ├── sqlserver_highlight_rules.js │ │ ├── stylus.js │ │ ├── stylus_highlight_rules.js │ │ ├── svg.js │ │ ├── svg_highlight_rules.js │ │ ├── swift.js │ │ ├── swift_highlight_rules.js │ │ ├── tcl.js │ │ ├── tcl_highlight_rules.js │ │ ├── tex.js │ │ ├── tex_highlight_rules.js │ │ ├── text.js │ │ ├── text_highlight_rules.js │ │ ├── text_test.js │ │ ├── textile.js │ │ ├── textile_highlight_rules.js │ │ ├── toml.js │ │ ├── toml_highlight_rules.js │ │ ├── tsx.js │ │ ├── turtle.js │ │ ├── turtle_highlight_rules.js │ │ ├── twig.js │ │ ├── twig_highlight_rules.js │ │ ├── typescript.js │ │ ├── typescript_highlight_rules.js │ │ ├── vala.js │ │ ├── vala_highlight_rules.js │ │ ├── vbscript.js │ │ ├── vbscript_highlight_rules.js │ │ ├── velocity.js │ │ ├── velocity_highlight_rules.js │ │ ├── verilog.js │ │ ├── verilog_highlight_rules.js │ │ ├── vhdl.js │ │ ├── vhdl_highlight_rules.js │ │ ├── wollok.js │ │ ├── wollok_highlight_rules.js │ │ ├── xml/ │ │ │ ├── dom-parser.js │ │ │ ├── dom.js │ │ │ └── sax.js │ │ ├── xml.js │ │ ├── xml_highlight_rules.js │ │ ├── xml_test.js │ │ ├── xml_worker.js │ │ ├── xquery/ │ │ │ ├── Readme.md │ │ │ ├── jsoniq_lexer.js │ │ │ ├── xqlint.js │ │ │ └── xquery_lexer.js │ │ ├── xquery.js │ │ ├── xquery_worker.js │ │ ├── yaml.js │ │ └── yaml_highlight_rules.js │ ├── model/ │ │ └── editor.js │ ├── mouse/ │ │ ├── default_gutter_handler.js │ │ ├── default_handlers.js │ │ ├── dragdrop_handler.js │ │ ├── fold_handler.js │ │ ├── mouse_event.js │ │ ├── mouse_handler.js │ │ ├── mouse_handler_test.js │ │ └── multi_select_handler.js │ ├── multi_select.js │ ├── multi_select_test.js │ ├── occur.js │ ├── occur_test.js │ ├── placeholder.js │ ├── placeholder_test.js │ ├── range.js │ ├── range_list.js │ ├── range_list_test.js │ ├── range_test.js │ ├── renderloop.js │ ├── requirejs/ │ │ ├── text.js │ │ └── text_build.js │ ├── scrollbar.js │ ├── search.js │ ├── search_highlight.js │ ├── search_test.js │ ├── selection.js │ ├── selection_test.js │ ├── snippets/ │ │ ├── _.snippets │ │ ├── _all_modes.js │ │ ├── _all_modes.snippets │ │ ├── abap.js │ │ ├── abap.snippets │ │ ├── abc.js │ │ ├── abc.snippets │ │ ├── actionscript.js │ │ ├── actionscript.snippets │ │ ├── ada.js │ │ ├── ada.snippets │ │ ├── all_modes.js │ │ ├── all_modes.snippets │ │ ├── apache.snippets │ │ ├── apache_conf.js │ │ ├── apache_conf.snippets │ │ ├── applescript.js │ │ ├── applescript.snippets │ │ ├── asciidoc.js │ │ ├── asciidoc.snippets │ │ ├── assembly_x86.js │ │ ├── assembly_x86.snippets │ │ ├── autohotkey.js │ │ ├── autohotkey.snippets │ │ ├── autoit.snippets │ │ ├── batchfile.js │ │ ├── batchfile.snippets │ │ ├── bro.js │ │ ├── c.snippets │ │ ├── c9search.js │ │ ├── c9search.snippets │ │ ├── c_cpp.js │ │ ├── c_cpp.snippets │ │ ├── chef.snippets │ │ ├── cirru.js │ │ ├── cirru.snippets │ │ ├── clojure.js │ │ ├── clojure.snippets │ │ ├── cmake.snippets │ │ ├── cobol.js │ │ ├── cobol.snippets │ │ ├── coffee.js │ │ ├── coffee.snippets │ │ ├── coldfusion.js │ │ ├── coldfusion.snippets │ │ ├── cs.snippets │ │ ├── csharp.js │ │ ├── csharp.snippets │ │ ├── csound_document.js │ │ ├── csound_document.snippets │ │ ├── csound_orchestra.js │ │ ├── csound_orchestra.snippets │ │ ├── csound_score.js │ │ ├── csound_score.snippets │ │ ├── css.js │ │ ├── css.snippets │ │ ├── curly.js │ │ ├── curly.snippets │ │ ├── d.js │ │ ├── d.snippets │ │ ├── dart.js │ │ ├── dart.snippets │ │ ├── diff.js │ │ ├── diff.snippets │ │ ├── django.js │ │ ├── django.snippets │ │ ├── dockerfile.js │ │ ├── dockerfile.snippets │ │ ├── dot.js │ │ ├── dot.snippets │ │ ├── drools.js │ │ ├── drools.snippets │ │ ├── dummy.js │ │ ├── dummy_syntax.js │ │ ├── eiffel.js │ │ ├── eiffel.snippets │ │ ├── ejs.js │ │ ├── ejs.snippets │ │ ├── elixir.js │ │ ├── elixir.snippets │ │ ├── elm.js │ │ ├── elm.snippets │ │ ├── erlang.js │ │ ├── erlang.snippets │ │ ├── eruby.snippets │ │ ├── falcon.snippets │ │ ├── forth.js │ │ ├── forth.snippets │ │ ├── ftl.js │ │ ├── ftl.snippets │ │ ├── gcode.js │ │ ├── gcode.snippets │ │ ├── gherkin.js │ │ ├── gherkin.snippets │ │ ├── gitignore.js │ │ ├── gitignore.snippets │ │ ├── glsl.js │ │ ├── glsl.snippets │ │ ├── go.snippets │ │ ├── gobstones.js │ │ ├── gobstones.snippets │ │ ├── golang.js │ │ ├── golang.snippets │ │ ├── graphqlschema.js │ │ ├── graphqlschema.snippets │ │ ├── groovy.js │ │ ├── groovy.snippets │ │ ├── haml.js │ │ ├── haml.snippets │ │ ├── handlebars.js │ │ ├── handlebars.snippets │ │ ├── haskell.js │ │ ├── haskell.snippets │ │ ├── haxe.js │ │ ├── haxe.snippets │ │ ├── hjson.js │ │ ├── html.js │ │ ├── html.snippets │ │ ├── html_elixir.js │ │ ├── html_elixir.snippets │ │ ├── html_ruby.js │ │ ├── html_ruby.snippets │ │ ├── htmldjango.snippets │ │ ├── htmltornado.snippets │ │ ├── ini.js │ │ ├── ini.snippets │ │ ├── io.js │ │ ├── io.snippets │ │ ├── jack.js │ │ ├── jack.snippets │ │ ├── jade.js │ │ ├── jade.snippets │ │ ├── java.js │ │ ├── java.snippets │ │ ├── javascript-jquery.snippets │ │ ├── javascript.js │ │ ├── javascript.snippets │ │ ├── json.js │ │ ├── json.snippets │ │ ├── jsoniq.js │ │ ├── jsoniq.snippets │ │ ├── jsp.js │ │ ├── jsp.snippets │ │ ├── jssm.js │ │ ├── jssm.snippets │ │ ├── jsx.js │ │ ├── jsx.snippets │ │ ├── julia.js │ │ ├── julia.snippets │ │ ├── kotlin.js │ │ ├── latex.js │ │ ├── latex.snippets │ │ ├── ledger.snippets │ │ ├── less.js │ │ ├── less.snippets │ │ ├── liquid.js │ │ ├── liquid.snippets │ │ ├── lisp.js │ │ ├── lisp.snippets │ │ ├── livescript.js │ │ ├── livescript.snippets │ │ ├── logiql.js │ │ ├── logiql.snippets │ │ ├── lsl.js │ │ ├── lsl.snippets │ │ ├── lua.js │ │ ├── lua.snippets │ │ ├── luapage.js │ │ ├── luapage.snippets │ │ ├── lucene.js │ │ ├── lucene.snippets │ │ ├── makefile.js │ │ ├── makefile.snippets │ │ ├── mako.snippets │ │ ├── markdown.js │ │ ├── markdown.snippets │ │ ├── matlab.js │ │ ├── matlab.snippets │ │ ├── maze.js │ │ ├── maze.snippets │ │ ├── mel.js │ │ ├── mel.snippets │ │ ├── mushcode.js │ │ ├── mushcode.snippets │ │ ├── mushcode_high_rules.js │ │ ├── mushcode_high_rules.snippets │ │ ├── mysql.js │ │ ├── mysql.snippets │ │ ├── nix.js │ │ ├── nix.snippets │ │ ├── nsis.js │ │ ├── objc.snippets │ │ ├── objectivec.js │ │ ├── objectivec.snippets │ │ ├── ocaml.js │ │ ├── ocaml.snippets │ │ ├── pascal.js │ │ ├── pascal.snippets │ │ ├── perl.js │ │ ├── perl.snippets │ │ ├── pgsql.js │ │ ├── pgsql.snippets │ │ ├── php.js │ │ ├── php.snippets │ │ ├── plain_text.js │ │ ├── plain_text.snippets │ │ ├── powershell.js │ │ ├── powershell.snippets │ │ ├── praat.js │ │ ├── praat.snippets │ │ ├── prolog.js │ │ ├── prolog.snippets │ │ ├── properties.js │ │ ├── properties.snippets │ │ ├── protobuf.js │ │ ├── protobuf.snippets │ │ ├── python.js │ │ ├── python.snippets │ │ ├── r.js │ │ ├── r.snippets │ │ ├── razor.js │ │ ├── razor.snippets │ │ ├── rdoc.js │ │ ├── rdoc.snippets │ │ ├── red.js │ │ ├── red.snippets │ │ ├── rhtml.js │ │ ├── rhtml.snippets │ │ ├── rst.snippets │ │ ├── ruby.js │ │ ├── ruby.snippets │ │ ├── rust.js │ │ ├── rust.snippets │ │ ├── sass.js │ │ ├── sass.snippets │ │ ├── scad.js │ │ ├── scad.snippets │ │ ├── scala.js │ │ ├── scala.snippets │ │ ├── scheme.js │ │ ├── scheme.snippets │ │ ├── scss.js │ │ ├── scss.snippets │ │ ├── sh.js │ │ ├── sh.snippets │ │ ├── sjs.js │ │ ├── sjs.snippets │ │ ├── smarty.js │ │ ├── smarty.snippets │ │ ├── snippets.js │ │ ├── snippets.snippets │ │ ├── soy_template.js │ │ ├── soy_template.snippets │ │ ├── space.js │ │ ├── space.snippets │ │ ├── sparql.js │ │ ├── sql.js │ │ ├── sql.snippets │ │ ├── sqlserver.js │ │ ├── sqlserver.snippets │ │ ├── stylus.js │ │ ├── stylus.snippets │ │ ├── svg.js │ │ ├── svg.snippets │ │ ├── tcl.js │ │ ├── tcl.snippets │ │ ├── tex.js │ │ ├── tex.snippets │ │ ├── text.js │ │ ├── text.snippets │ │ ├── textile.js │ │ ├── textile.snippets │ │ ├── tmsnippet.snippets │ │ ├── toml.js │ │ ├── toml.snippets │ │ ├── turtle.js │ │ ├── twig.js │ │ ├── twig.snippets │ │ ├── typescript.js │ │ ├── typescript.snippets │ │ ├── vala.js │ │ ├── vala.snippets │ │ ├── vbscript.js │ │ ├── vbscript.snippets │ │ ├── velocity.js │ │ ├── velocity.snippets │ │ ├── verilog.js │ │ ├── verilog.snippets │ │ ├── vhdl.js │ │ ├── vhdl.snippets │ │ ├── wollok.js │ │ ├── wollok.snippets │ │ ├── xml.js │ │ ├── xml.snippets │ │ ├── xquery.js │ │ ├── xquery.snippets │ │ ├── xslt.snippets │ │ ├── yaml.js │ │ └── yaml.snippets │ ├── snippets.js │ ├── snippets_test.js │ ├── split.js │ ├── test/ │ │ ├── all.js │ │ ├── all_browser.js │ │ ├── assertions.js │ │ ├── asyncjs/ │ │ │ ├── assert.js │ │ │ ├── async.js │ │ │ ├── index.js │ │ │ ├── test.js │ │ │ └── utils.js │ │ ├── benchmark.js │ │ ├── mockdom.js │ │ ├── mockrenderer.js │ │ └── tests.html │ ├── theme/ │ │ ├── ambiance.css │ │ ├── ambiance.js │ │ ├── chaos.css │ │ ├── chaos.js │ │ ├── chrome.css │ │ ├── chrome.js │ │ ├── clouds.css │ │ ├── clouds.js │ │ ├── clouds_midnight.css │ │ ├── clouds_midnight.js │ │ ├── cobalt.css │ │ ├── cobalt.js │ │ ├── crimson_editor.css │ │ ├── crimson_editor.js │ │ ├── dawn.css │ │ ├── dawn.js │ │ ├── dracula.css │ │ ├── dracula.js │ │ ├── dreamweaver.css │ │ ├── dreamweaver.js │ │ ├── eclipse.css │ │ ├── eclipse.js │ │ ├── github.css │ │ ├── github.js │ │ ├── gob.css │ │ ├── gob.js │ │ ├── gruvbox.css │ │ ├── gruvbox.js │ │ ├── idle_fingers.css │ │ ├── idle_fingers.js │ │ ├── iplastic.css │ │ ├── iplastic.js │ │ ├── katzenmilch.css │ │ ├── katzenmilch.js │ │ ├── kr_theme.css │ │ ├── kr_theme.js │ │ ├── kuroir.css │ │ ├── kuroir.js │ │ ├── merbivore.css │ │ ├── merbivore.js │ │ ├── merbivore_soft.css │ │ ├── merbivore_soft.js │ │ ├── mono_industrial.css │ │ ├── mono_industrial.js │ │ ├── monokai.css │ │ ├── monokai.js │ │ ├── pastel_on_dark.css │ │ ├── pastel_on_dark.js │ │ ├── solarized_dark.css │ │ ├── solarized_dark.js │ │ ├── solarized_light.css │ │ ├── solarized_light.js │ │ ├── sqlserver.css │ │ ├── sqlserver.js │ │ ├── terminal.css │ │ ├── terminal.js │ │ ├── textmate.css │ │ ├── textmate.js │ │ ├── tomorrow.css │ │ ├── tomorrow.js │ │ ├── tomorrow_night.css │ │ ├── tomorrow_night.js │ │ ├── tomorrow_night_blue.css │ │ ├── tomorrow_night_blue.js │ │ ├── tomorrow_night_bright.css │ │ ├── tomorrow_night_bright.js │ │ ├── tomorrow_night_eighties.css │ │ ├── tomorrow_night_eighties.js │ │ ├── twilight.css │ │ ├── twilight.js │ │ ├── vibrant_ink.css │ │ ├── vibrant_ink.js │ │ ├── xcode.css │ │ └── xcode.js │ ├── token_iterator.js │ ├── token_iterator_test.js │ ├── tokenizer.js │ ├── tokenizer_dev.js │ ├── tokenizer_test.js │ ├── tooltip.js │ ├── undomanager.js │ ├── undomanager_test.js │ ├── unicode.js │ ├── virtual_renderer.js │ ├── virtual_renderer_test.js │ └── worker/ │ ├── mirror.js │ ├── worker.js │ ├── worker_client.js │ └── worker_test.js ├── package.json ├── static.js ├── tool/ │ ├── Readme.md │ ├── add_mode.js │ ├── lib.js │ ├── mode_creator.html │ ├── mode_creator.js │ ├── package.json │ ├── perf-test.html │ ├── regexp_tokenizer.js │ ├── regexp_tokenizer_test.js │ ├── release.sh │ ├── templates/ │ │ ├── dummy.JSON-tmLanguage │ │ ├── highlight_rules.js │ │ ├── mode.js │ │ ├── snippets.js │ │ ├── theme.css │ │ └── theme.js │ ├── tmlanguage.js │ ├── tmsnippets.js │ ├── tmtheme.js │ ├── tmthemes/ │ │ ├── Active4D.tmTheme │ │ ├── Amy.tmTheme │ │ ├── Blackboard.tmTheme │ │ ├── Clouds.tmTheme │ │ ├── Cobalt.tmTheme │ │ ├── Dawn.tmTheme │ │ ├── Dreamweaver.tmTheme │ │ ├── Eiffel.tmTheme │ │ ├── GitHub.tmTheme │ │ ├── IDLE.tmTheme │ │ ├── Katzenmilch.tmTheme │ │ ├── LAZY.tmTheme │ │ ├── LICENSE │ │ ├── Merbivore.tmTheme │ │ ├── Monokai.tmTheme │ │ ├── Solarized-dark.tmTheme │ │ ├── Solarized-light.tmTheme │ │ ├── SpaceCadet.tmTheme │ │ ├── Sunburst.tmTheme │ │ ├── Tomorrow-Night-Blue.tmTheme │ │ ├── Tomorrow-Night-Bright.tmTheme │ │ ├── Tomorrow-Night-Eighties.tmTheme │ │ ├── Tomorrow-Night.tmTheme │ │ ├── Tomorrow.tmTheme │ │ ├── Twilight.tmTheme │ │ ├── Xcode_default.tmTheme │ │ ├── Zenburnesque.tmTheme │ │ ├── iPlastic.tmTheme │ │ ├── idleFingers.tmTheme │ │ ├── krTheme.tmTheme │ │ └── monoindustrial.tmTheme │ ├── unicode.js │ ├── update_deps.js │ └── wrap_keyword_regexp.js └── version.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Junk that could exist anywhere: .DS_Store *.swp *.tmp *~ # Project files that should not be in the repo .* \#* !/.gitignore .*.gz *.tmTheme.js # A handy place to put stuff that git should ignore: /ignore/ node_modules/ jam/ * * .git-ref npm-debug.log deps/ ================================================ FILE: CNAME ================================================ ace.c9.io ================================================ FILE: CONTRIBUTING.md ================================================ Contributing ------------ Ace is a community project and wouldn't be what it is without contributions! We actively encourage and support contributions. The Ace source code is released under the BSD License. This license is very simple, and is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement: 1. [The Individual CLA](https://docs.google.com/a/c9.io/forms/d/1MfmfrxqD_PNlNsuK0lC2KSelRLxGLGfh_wEcG0ijVvo/viewform): use this version if you're working on the Cloud9 SDK or open source projects in your spare time, or can clearly claim ownership of copyright in what you'll be submitting. 2. [The Corporate CLA](https://docs.google.com/a/c9.io/forms/d/1vFejn4111GdnCNuQ6BfnJDaxdsUEMD4KCo1ayovAfu0/viewform): have your corporate lawyer review and submit this if your company is going to be contributing to the Cloud9 SDK and/or open source projects. If you want to contribute to the Cloud9 SDK and/or open source projects please go to the online form, fill it out and submit it. Happy coding, Cloud9 ================================================ FILE: ChangeLog.txt ================================================ 2017.10.17 Version 1.2.9 * added support for bidirectional text, with monospace font (Alex Shensis) * added support for emoji 😊 * new language modes - Red (Toomas Vooglaid) - CSound (Nathan Whetsell) - JSSM (John Haugeland) * New Themes - Dracula (Austin Schwartz) 2017.07.02 Version 1.2.8 * Fixed small bugs in searchbox and autocompleter 2017.06.18 Version 1.2.7 * Added Support for arrow keys on external IPad keyboard (Emanuele Tamponi) * added match counter to searchbox extension - implemented higlighting of multiline strings in yaml mode (Maxim Trushin) - improved haml syntax highlighter (Andrés Álvarez) 2016.12.03 Version 1.2.6 * Fixed IME handling on new Chrome * Support for php 7 in the syntax checker 2016.08.16 Version 1.2.5 * Fixed regression in noconflict mode 2016.07.27 Version 1.2.4 * Maintenance release with several new modes and small bugfixes 2016.01.17 Version 1.2.3 * Bugfixes - fix memory leak in setSession (Tyler Stalder) - double click not working on linux/mac * new language modes - reStructuredText (Robin Jarry) - NSIS (Jan T. Sott) 2015.10.28 Version 1.2.1 * new language modes - Swift - JSX 2015.07.11 Version 1.2.0 * New Features - Indented soft wrap (danyaPostfactum) - Rounded borders on selections * API Changes - unified delta types `{start, end, action, lines}` (Alden Daniels https://github.com/ajaxorg/ace/pull/1745) - "change" event listeners on session and editor get delta objects directly * new language modes - SQLServer (Morgan Yarbrough) 2015.04.03 Version 1.1.9 - Small Enhancements and Bugfixes 2014.11.08 Version 1.1.8 * API Changes - `editor.commands.commandKeyBinding` now contains direct map from keys to commands instead of grouping them by hashid * New Features - Improved autoindent for html and php modes (Adam Jimenez) - Find All from searchbox (Colton Voege) * new language modes - Elixir, Elm 2014.09.21 Version 1.1.7 * Bugfixes - fix several bugs in autocompletion - workaround for inaccurate getBoundingClientRect on chrome 37 2014.08.17 Version 1.1.6 * Bugfixes - fix regression in double tap to highlight - Improved Latex Mode (Daniel Felder) * API Changes - editor.destroy destroys editor.session too (call editor.setSession(null) to prevent that) * new language modes - Praat (José Joaquín Atria) - Eiffel (Victorien Elvinger) - G-code (Adam Joseph Cook) 2014.07.09 Version 1.1.5 * Bugfixes - fix regression in autocomplete popup * new language modes - gitignore (Devon Carew) 2014.07.01 Version 1.1.4 * New Features - Highlight matching tags (Adam Jimenez) - Improved jump to matching command (Adam Jimenez) * new language modes - AppleScript (Yaogang Lian) - Vala 2014.03.08 Version 1.1.3 * New Features - Allow syntax checkers to be loaded from CDN (Derk-Jan Hartman) - Add ColdFusion behavior (Abram Adams) - add showLineNumbers option - Add html syntax checker (danyaPostfactum) * new language modes - Gherkin (Patrick Nevels) - Smarty 2013.12.02 Version 1.1.2 * New Features - Accessibility Theme for Ace (Peter Xiao) - use snipetManager for expanding emmet snippets - update jshint to 2.1.4 - improve php syntax checker (jdalegonzalez) - add option for autoresizing - add option for autohiding vertical scrollbar - improvements to highlighting of xml like languages (danyaPostfactum) - add support for autocompletion and snippets (gjtorikyan danyaPostfactum and others) - add option to merge similar changes in undo history - add scrollPastEnd option - use html5 dragndrop for text dragging (danyaPostfactum) * API Changes - fixed typo in HashHandler commmandManager * new language modes - Nix (Zef Hemel) - Protobuf (Zef Hemel) - Soy - Handlebars 2013.06.04 Version 1.1.1 - Improved emacs keybindings (Robert Krahn) - Added markClean, isClean methods to UndoManager (Joonsoo Jeon) - Do not allow `Toggle comments` command to remove spaces from indentation - Softer colors for indent guides in dark themes * new language modes - Ada - Assembly_x86 - Cobol - D - ejs - MATLAB - MySQL - Twig - Verilog 2013.05.01, Version 1.1.0 * API Changes - Default position of the editor container is changed to relative. Add `.ace_editor {position: absolute}` css rule to restore old behavior - Changed default line-height to `normal` to not conflict with bootstrap. Use `line-height: inherit` for old behavior. - Changed marker types accepted by session.addMarker. It now accepts "text"|"line"|"fullLine"|"screenLine" - Internal classnames used by editor were made more consistent - Introduced `editor.setOption/getOption/setOptions/getOptions` methods - Introduced positionToIndex, indexToPosition methods * New Features - Improved emacs mode (chetstone) with Incremental search and Occur modes (Robert Krahn) - Improved ime handling - Searchbox (Vlad Zinculescu) - Added elastic tabstops lite extension (Garen Torikian) - Added extension for whitespace manipulation - Added extension for enabling spellchecking from contextmenu - Added extension for displaying available keyboard shortcuts (Matthew Christopher Kastor-Inare III) - Added extension for displaying options panel (Matthew Christopher Kastor-Inare III) - Added modelist extension (Matthew Christopher Kastor-Inare III) - Improved toggleCommentLines and added ToggleCommentBlock command - `:;` pairing in CSS mode (danyaPostfactum) - Added suppoert for Delete and SelectAll from context menu (danyaPostfactum) - Make wrapping behavior optional - Selective bracket insertion/skipping - Added commands for increase/decrease numbers, sort lines (Vlad Zinculescu) - Folding for Markdown, Lua, LaTeX - Selective bracket insertion/skipping for C-like languages * Many new languages - Scheme (Mu Lei) - Dot (edwardsp) - FreeMarker (nguillaumin) - Tiny Mushcode (h3rb) - Velocity (Ryan Griffith) - TOML (Garen Torikian) - LSL (Nemurimasu Neiro, Builders Brewery) - Curly (Libo Cannici) - vbScript (Jan Jongboom) - R (RStudio) - ABAP - Lucene (Graham Scott) - Haml (Garen Torikian) - Objective-C (Garen Torikian) - Makefile (Garen Torikian) - TypeScript (Garen Torikian) - Lisp (Garen Torikian) - Stylus (Garen Torikian) - Dart (Garen Torikian) * Live syntax checks - PHP (danyaPostfactum) - Lua * New Themes - Chaos - Terminal 2012.09.17, Version 1.0.0 * New Features - Multiple cursors and selections (https://c9.io/site/blog/2012/08/be-an-armenian-warrior-with-block-selection-on-steroids/) - Fold buttons displayed in the gutter - Indent Guides - Completely reworked vim mode (Sergi Mansilla) - Improved emacs keybindings - Autoclosing of html tags (danyaPostfactum) * 20 New language modes - Coldfusion (Russ) - Diff - GLSL (Ed Mackey) - Go (Davide Saurino) - Haxe (Jason O'Neil) - Jade (Garen Torikian) - jsx (Syu Kato) - LaTeX (James Allen) - Less (John Roepke) - Liquid (Bernie Telles) - Lua (Lee Gao) - LuaPage (Choonster) - Markdown (Chris Spencer) - PostgreSQL (John DeSoi) - Powershell (John Kane) - Sh (Richo Healey) - SQL (Jonathan Camile) - Tcl (Cristoph Hochreiner) - XQuery (William Candillion) - Yaml (Meg Sharkey) * Live syntax checks - for XQuery and JSON * New Themes - Ambiance (Irakli Gozalishvili) - Dreamweaver (Adam Jimenez) - Github (bootstraponline) - Tommorrow themes (https://github.com/chriskempson/tomorrow-theme) - XCode * Many Small Enhancements and Bugfixes 2011.08.02, Version 0.2.0 * Split view (Julian Viereck) - split editor area horizontally or vertivally to show two files at the same time * Code Folding (Julian Viereck) - Unstructured code folding - Will be the basis for language aware folding * Mode behaviours (Chris Spencer) - Adds mode specific hooks which allow transformations of entered text - Autoclosing of braces, paranthesis and quotation marks in C style modes - Autoclosing of angular brackets in XML style modes * New language modes - Clojure (Carin Meier) - C# (Rob Conery) - Groovy (Ben Tilford) - Scala (Ben Tilford) - JSON - OCaml (Sergi Mansilla) - Perl (Panagiotis Astithas) - SCSS/SASS (Andreas Madsen) - SVG - Textile (Kelley van Evert) - SCAD (Jacob Hansson) * Live syntax checks - Lint for CSS using CSS Lint - CoffeeScript * New Themes - Crimson Editor (iebuggy) - Merbivore (Michael Schwartz) - Merbivore soft (Michael Schwartz) - Solarized dark/light (David Alan Hjelle) - Vibrant Ink (Michael Schwartz) * Small Features/Enhancements - Lots of render performance optimizations (Harutyun Amirjanyan) - Improved Ruby highlighting (Chris Wanstrath, Trent Ogren) - Improved PHP highlighting (Thomas Hruska) - Improved CSS highlighting (Sean Kellogg) - Clicks which cause the editor to be focused don't reset the selection - Make padding text layer specific so that print margin and active line highlight are not affected (Irakli Gozalishvili) - Added setFontSize method - Improved vi keybindings (Trent Ogren) - When unfocused make cursor transparent instead of removing it (Harutyun Amirjanyan) - Support for matching groups in tokenizer with arrays of tokens (Chris Spencer) * Bug fixes - Add support for the new OSX scroll bars - Properly highlight JavaScript regexp literals - Proper handling of unicode characters in JavaScript identifiers - Fix remove lines command on last line (Harutyun Amirjanyan) - Fix scroll wheel sluggishness in Safari - Make keyboard infrastructure route keys like []^$ the right way (Julian Viereck) 2011.02.14, Version 0.1.6 * Floating Anchors - An Anchor is a floating pointer in the document. - Whenever text is inserted or deleted before the cursor, the position of the cursor is updated - Usesd for the cursor and selection - Basis for bookmarks, multiple cursors and snippets in the future * Extensive support for Cocoa style keybindings on the Mac * New commands: - center selection in viewport - remove to end/start of line - split line - transpose letters * Refator markers - Custom code can be used to render markers - Markers can be in front or behind the text - Markers are now stored in the session (was in the renderer) * Lots of IE8 fixes including copy, cut and selections * Unit tests can also be run in the browser * Soft wrap can adapt to the width of the editor (Mike Ratcliffe, Joe Cheng) * Add minimal node server server.js to run the Ace demo in Chrome * The top level editor.html demo has been renamed to index.html * Bug fixes - Fixed gotoLine to consider wrapped lines when calculating where to scroll to (James Allen) - Fixed isues when the editor was scrolled in the web page (Eric Allam) - Highlighting of Python string literals - Syntax rule for PHP comments 2011.02.08, Version 0.1.5 * Add Coffeescript Mode (Satoshi Murakami) * Fix word wrap bug (Julian Viereck) * Fix packaged version of the Eclipse mode * Loading of workers is more robust * Fix "click selection" * Allow tokizing empty lines (Daniel Krech) * Make PageUp/Down behavior more consistent with native OS (Joe Cheng) 2011.02.04, Version 0.1.4 * Add C/C++ mode contributed by Gastón Kleiman * Fix exception in key input 2011.02.04, Version 0.1.3 * Let the packaged version play nice with requireJS * Add Ruby mode contributed by Shlomo Zalman Heigh * Add Java mode contributed by Tom Tasche * Fix annotation bug * Changing a document added a new empty line at the end ================================================ FILE: LICENSE ================================================ Copyright (c) 2010, Ajax.org B.V. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. * Neither the name of Ajax.org B.V. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ================================================ FILE: Makefile ================================================ .PHONY : doc build clean dist pre_build: git rev-parse HEAD > .git-ref mkdir -p build/src mkdir -p build/demo/kitchen-sink mkdir -p build/textarea/src cp -r demo/kitchen-sink/styles.css build/demo/kitchen-sink/styles.css cp demo/kitchen-sink/logo.png build/demo/kitchen-sink/logo.png cp -r doc/site/images build/textarea build: pre_build ./Makefile.dryice.js normal ./Makefile.dryice.js demo # Minimal build: call Makefile.dryice.js only if our sources changed basic: build/src/ace.js build/src/ace.js : ${wildcard lib/*} \ ${wildcard lib/*/*} \ ${wildcard lib/*/*/*} \ ${wildcard lib/*/*/*/*} \ ${wildcard lib/*/*/*/*/*} \ ${wildcard lib/*/*/*/*/*/*} ./Makefile.dryice.js doc: cd doc;\ (test -d node_modules && npm update) || npm install;\ node build.js clean: rm -rf build rm -rf ace-* rm -f ace-*.tgz ace.tgz: build mv build ace-`./version.js`/ cp Readme.md ace-`./version.js`/ cp LICENSE ace-`./version.js`/ tar cvfz ace-`./version.js`.tgz ace-`./version.js`/ dist: clean build ace.tgz ================================================ FILE: Makefile.dryice.js ================================================ #!/usr/bin/env node /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ var fs = require("fs"); var path = require("path"); var copy = require('architect-build/copy'); var build = require('architect-build/build'); var ACE_HOME = __dirname; var BUILD_DIR = ACE_HOME + "/build"; var CACHE = {}; function main(args) { if (args.indexOf("updateModes") !== -1) { return updateModes(); } var type = "minimal"; args = args.map(function(x) { if (x[0] == "-" && x[1] != "-") return "-" + x; return x; }).filter(Boolean); if (args[2] && (args[2][0] != "-" || args[2].indexOf("h") != -1)) type = args[2]; var i = args.indexOf("--target"); if (i != -1 && args[i+1]) BUILD_DIR = args[i+1]; if (args.indexOf("--h") == -1) { if (type == "minimal") { buildAce({ compress: args.indexOf("--m") != -1, noconflict: args.indexOf("--nc") != -1, shrinkwrap: args.indexOf("--s") != -1 }); } else if (type == "normal") { ace(); } else if (type == "demo") { demo(); } else if (type == "full") { ace(); demo(); } else if (type == "highlighter") { // TODO } } } function showHelp(type) { console.log("--- Ace Dryice Build Tool ---"); console.log(""); console.log("Options:"); console.log(" minimal Places necessary Ace files out in build dir; uses configuration flags below [default]"); console.log(" normal Runs four Ace builds--minimal, minimal-noconflict, minimal-min, and minimal-noconflict-min"); console.log(" demo Runs demo build of Ace"); console.log(" full all of above"); console.log(" highlighter "); console.log("args:"); console.log(" --target ./path path to build folder"); console.log("flags:"); console.log(" --h print this help"); console.log(" --m minify"); console.log(" --nc namespace require"); console.log(" --s shrinkwrap (combines all output files into one)"); console.log(""); if (type) console.log(" output for " + type + " generated in " + BUILD_DIR); } function ace() { console.log('# ace License | Readme | Changelog ---------'); copy.file(ACE_HOME + "/build_support/editor.html", BUILD_DIR + "/editor.html"); copy.file(ACE_HOME + "/LICENSE", BUILD_DIR + "/LICENSE"); copy.file(ACE_HOME + "/ChangeLog.txt", BUILD_DIR + "/ChangeLog.txt"); console.log('# ace ---------'); for (var i = 0; i < 4; i++) buildAce({compress: i & 2, noconflict: i & 1, check: true}); } function demo() { console.log('# kitchen sink ---------'); var version = "", ref = ""; try { version = JSON.parse(fs.readFileSync(ACE_HOME + "/package.json")).version; ref = fs.readFileSync(ACE_HOME + "/.git-ref").toString(); } catch(e) {} function changeComments(data) { return (data .replace("doc/site/images/ace-logo.png", "demo/kitchen-sink/ace-logo.png") .replace(//g, "") .replace(/PACKAGE\-\->|")} function script(str) {result.push('')} scripts.forEach(function(s) { s = s.replace(/"/g, ""); if (s == "ace/ace") { comment("load ace"); script("ace"); } else { var extName = s.match(/[^/]*$/)[0]; comment("load ace " + extName + " extension"); script("ext-" + extName); } }); result.push(" ``` With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g. ```css #editor { position: absolute; width: 500px; height: 400px; } ``` To change the theme simply include the Theme's JavaScript file ```html ``` and configure the editor to use the theme: ```javascript editor.setTheme("ace/theme/twilight"); ``` By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file: ```html ``` The mode can then be used like this: ```javascript var JavaScriptMode = ace.require("ace/mode/javascript").Mode; editor.session.setMode(new JavaScriptMode()); ``` to destroy editor use ```javascript editor.destroy(); editor.container.remove(); ``` Documentation ------------- Additional usage information, including events to listen to and extending syntax highlighters, can be found [on the main Ace website](http://ace.c9.io). You can also find API documentation at [http://ace.c9.io/#nav=api](http://ace.c9.io/#nav=api). Also check out the sample code for the kitchen sink [demo app](https://github.com/ajaxorg/ace/blob/master/demo/kitchen-sink/demo.js). If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss), or at `irc.freenode.net#ace`. Running Ace ----------- After the checkout Ace works out of the box. No build step is required. To try it out, simply start the bundled mini HTTP server using Node.JS ```bash node ./static.js ``` The editor can then be opened at http://localhost:8888/kitchen-sink.html. To open the editor with a file:/// URL see [the wiki](https://github.com/ajaxorg/ace/wiki/Running-Ace-from-file). Building Ace ----------- You do not generally need to build ACE. The [ace-builds repository](https://github.com/ajaxorg/ace-builds/) endeavours to maintain the latest build, and you can just copy one of _src*_ subdirectories somewhere into your project. However, all you need is Node.js and npm installed to package ACE. Just run `npm install` in the ace folder to install dependencies: ```bash npm install node ./Makefile.dryice.js ``` To package Ace, we use the dryice build tool developed by the Mozilla Skywriter team. Call `node Makefile.dryice.js` on the command-line to start the packing. This build script accepts the following options ```bash -m minify build files with uglify-js -nc namespace require and define calls with "ace" -bm builds the bookmarklet version --target ./path specify relative path for output folder (default value is "./build") ``` To generate all the files in the ace-builds repository, run `node Makefile.dryice.js full --target ../ace-builds` Running the Unit Tests ---------------------- The Ace unit tests can run on node.js. Assuming you have already done `npm install`, just call: ```bash node lib/ace/test/all.js ``` You can also run the tests in your browser by serving: http://localhost:8888/lib/ace/test/tests.html This makes debugging failing tests way more easier. Contributing ----------------------------- Ace is a community project and wouldn't be what it is without contributions! We actively encourage and support contributions. The Ace source code is released under the BSD License. This license is very simple, and is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. For more information on our contributing guidelines, see [CONTRIBUTING.md](https://github.com/ajaxorg/ace/blob/master/CONTRIBUTING.md). Continuous Integration status ----------------------------- This project is tested with [Travis CI](http://travis-ci.org) [![Build Status](https://secure.travis-ci.org/ajaxorg/ace.png?branch=master)](http://travis-ci.org/ajaxorg/ace) ================================================ FILE: api/ace.html ================================================

The main class required to set up an Ace instance in the browser.

Methods

Creates a new EditSession, and returns the associated Document.

Creates a new EditSession, and returns the associated Document.

Arguments

textDocument | String

Required. If text is a Document, it associates the EditSession with it. Otherwise, a new Document is created, with the initial text

modeTextMode

Required. The initial language mode to use for the document

Embeds the Ace editor into the DOM, at the element provided by el.

Embeds the Ace editor into the DOM, at the element provided by el.

Arguments

elString | DOMElement

Required. Either the id of an element, or the element itself

Provides access to require in packed noconflict mode

Provides access to require in packed noconflict mode

Arguments

moduleNameString

Required.

================================================ FILE: api/anchor.html ================================================

Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.

Constructors

Creates a new Anchor and associates it with a document.

Creates a new Anchor and associates it with a document.

Arguments

docDocument

Required. The document to associate with the anchor

rowNumber

Required. The starting row position

columnNumber

Required. The starting column position

Events

    • Anchor.on("change", function(Object e))

Fires whenever the anchor position changes.

Fires whenever the anchor position changes.

Both of these objects have a row and column property corresponding to the position.

Events that can trigger this function include setPosition().

Arguments

eObject

Required. An object containing information about the anchor position. It has two properties:

  • old: An object describing the old Anchor position
  • value: An object describing the new Anchor position

Methods

    • Anchor.detach()

When called, the 'change' event listener is removed.

When called, the 'change' event listener is removed.

Returns the current document.

Returns the current document.

Returns an object identifying the row and column position of the current anchor.

Returns an object identifying the row and column position of the current anchor.

    • Anchor.onChange()
    • Undocumented

Sets the anchor position to the specified row and column. If noClip is true, the position is not clipped.

Sets the anchor position to the specified row and column. If noClip is true, the position is not clipped.

Arguments

rowNumber

Required. The row index to move the anchor to

columnNumber

Required. The column index to move the anchor to

noClipBoolean

Required. Identifies if you want the position to be clipped

================================================ FILE: api/background_tokenizer.html ================================================

Tokenizes the current Document in the background, and caches the tokenized rows for future use.

If a certain row is changed, everything below that row is re-tokenized.

Constructors

Creates a new BackgroundTokenizer object.

Creates a new BackgroundTokenizer object.

Arguments

tokenizerTokenizer

Required. The tokenizer to use

editorEditor

Required. The editor to associate with

Events

    • BackgroundTokenizer.on("update", function(Object e))

Fires whenever the background tokeniziers between a range of rows are going to be updated.

Fires whenever the background tokeniziers between a range of rows are going to be updated.

Arguments

eObject

Required. An object containing two properties, first and last, which indicate the rows of the region being updated.

Methods

    • BackgroundTokenizer.fireUpdateEvent(Number firstRow, Number lastRow)

Emits the 'update' event. firstRow and lastRow are used to define the boundaries of the region to be updated.

Emits the 'update' event. firstRow and lastRow are used to define the boundaries of the region to be updated.

Arguments

firstRowNumber

Required. The starting row region

lastRowNumber

Required. The final row region

    • BackgroundTokenizer.getState(Number row)

Returns the state of tokenization at the end of a row.

Returns the state of tokenization at the end of a row.

Arguments

rowNumber

Required. The row to get state at

    • BackgroundTokenizer.getTokens(Number row)

Gives list of tokens of the row. (tokens are cached)

Gives list of tokens of the row. (tokens are cached)

Arguments

rowNumber

Required. The row to get tokens at

    • BackgroundTokenizer.setDocument(Document doc)

Sets a new document to associate with this object.

Sets a new document to associate with this object.

Arguments

docDocument

Required. The new document to associate with

    • BackgroundTokenizer.setTokenizer(Tokenizer tokenizer)

Sets a new tokenizer for this object.

Sets a new tokenizer for this object.

Arguments

tokenizerTokenizer

Required. The new tokenizer to use

    • BackgroundTokenizer.start(Number startRow)

Starts tokenizing at the row indicated.

Starts tokenizing at the row indicated.

Arguments

startRowNumber

Required. The row to start at

    • BackgroundTokenizer.stop()

Stops tokenizing.

Stops tokenizing.

================================================ FILE: api/command_manager.html ================================================

CommandManager

new CommandManager(platform, commands)

================================================ FILE: api/document.html ================================================

Contains the text of the document. Document can be attached to several EditSessions.

At its core, Documents are just an array of strings, with each row in the document matching up to the array index.

Constructors

Creates a new Document. If text is included, the Document contains those strings; otherwise, it's empty.

Creates a new Document. If text is included, the Document contains those strings; otherwise, it's empty.

Arguments

textString | Array

Required. The starting text

Events

    • Document.on("change", function(Object e))

Fires whenever the document changes.

Fires whenever the document changes.

Several methods trigger different "change" events. Below is a list of each action type, followed by each property that's also available:

Arguments

eObject

Required. Contains at least one property called "action". "action" indicates the action that triggered the change. Each action also has a set of additional properties.

Methods

    • Document.applyDeltas(Object deltas)

Applies all the changes previously accumulated. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.

Applies all the changes previously accumulated. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.

Arguments

deltasObject

Required.

Creates a new Anchor to define a floating point in the document.

Creates a new Anchor to define a floating point in the document.

Arguments

rowNumber

Required. The row number to use

columnNumber

Required. The column number to use

    • Document.getAllLines()

Returns all lines in the document as string array.

Returns all lines in the document as string array. Warning: The caller should not modify this array!

    • Document.getLength()

Returns the number of rows in the document.

Returns the number of rows in the document.

    • Document.getLine(Number row)

Returns a verbatim copy of the given line as it is in the document

Returns a verbatim copy of the given line as it is in the document

Arguments

rowNumber

Required. The row index to retrieve

Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.

Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.

Arguments

firstRowNumber

Required. The first row index to retrieve

lastRowNumber

Required. The final row index to retrieve

    • Document.getNewLineCharacter()

Returns the newline character that's being used, depending on the value of newLineMode.

Returns the newline character that's being used, depending on the value of newLineMode.

    • Document.getNewLineMode()

Returns the type of newlines being used; either windows, unix, or auto

Returns the type of newlines being used; either windows, unix, or auto

    • Document.getTextRange(Range range)

Given a range within the document, this function returns all the text within that range as a single string.

Given a range within the document, this function returns all the text within that range as a single string.

Arguments

rangeRange

Required. The range to work with

    • Document.getValue()

Returns all the lines in the document as a single string, split by the new line character.

Returns all the lines in the document as a single string, split by the new line character.

Converts an index position in a document to a {row, column} object.

Converts an index position in a document to a {row, column} object.

Index refers to the "absolute position" of a character in the document. For example:

var x = 0; // 10 characters, plus one for newline
var y = -1;

Here, y is an index 15: 11 characters for the first row, and 5 characters until y in the second.

Arguments

indexNumber

Required. An index to convert

startRowNumber

Required. =0 The row from which to start the conversion

Inserts a block of text and the indicated position.

Inserts a block of text and the indicated position.

Arguments

positionObject

Required. The position to start inserting at

textString

Required. A chunk of text to insert

Inserts text into the position at the current row. This method also triggers the 'change' event.

Inserts text into the position at the current row. This method also triggers the 'change' event.

Arguments

positionObject

Required. The position to insert at

textString

Required. A chunk of text

Inserts the elements in lines into the document, starting at the row index given by row. This method also triggers the 'change' event.

Inserts the elements in lines into the document, starting at the row index given by row. This method also triggers the 'change' event.

Arguments

rowNumber

Required. The index of the row to insert at

linesArray

Required. An array of strings

Inserts a new line into the document at the current row's position. This method also triggers the 'change' event.

Inserts a new line into the document at the current row's position. This method also triggers the 'change' event.

Arguments

positionObject

Required. The position to insert at

    • Document.isNewLine(String text)

Returns true if text is a newline character (either \r\n, \r, or \n).

Returns true if text is a newline character (either \r\n, \r, or \n).

Arguments

textString

Required. The text to check

Converts the {row, column} position in a document to the character's index.

Converts the {row, column} position in a document to the character's index.

Index refers to the "absolute position" of a character in the document. For example:

var x = 0; // 10 characters, plus one for newline
var y = -1;

Here, y is an index 15: 11 characters for the first row, and 5 characters until y in the second.

Arguments

posObject

Required. The {row, column} to convert

startRowNumber

Required. =0 The row from which to start the conversion

Removes the range from the document.

Removes the range from the document.

Arguments

rangeRange

Required. A specified Range to remove

Removes the specified columns from the row. This method also triggers the 'change' event.

Removes the specified columns from the row. This method also triggers the 'change' event.

Arguments

rowNumber

Required. The row to remove from

startColumnNumber

Required. The column to start removing at

endColumnNumber

Required. The column to stop removing at

Removes a range of full lines. This method also triggers the 'change' event.

Removes a range of full lines. This method also triggers the 'change' event.

Arguments

firstRowNumber

Required. The first row to be removed

lastRowNumber

Required. The last row to be removed

    • Document.removeNewLine(Number row)

Removes the new line between row and the row immediately following it. This method also triggers the 'change' event.

Removes the new line between row and the row immediately following it. This method also triggers the 'change' event.

Arguments

rowNumber

Required. The row to check

Replaces a range in the document with the new text.

Replaces a range in the document with the new text.

Arguments

rangeRange

Required. A specified Range to replace

textString

Required. The new text to use as a replacement

    • Document.revertDeltas(Object deltas)

Reverts any changes previously applied. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.

Reverts any changes previously applied. These can be either 'includeText', 'insertLines', 'removeText', and 'removeLines'.

Arguments

deltasObject

Required.

    • Document.setNewLineMode(String newLineMode)

Sets the new line mode.

Sets the new line mode.

Arguments

newLineModeString

Required. The newline mode to use; can be either windows, unix, or auto

    • Document.setValue(String text)

Replaces all the lines in the current Document with the value of text.

Replaces all the lines in the current Document with the value of text.

Arguments

textString

Required. The text to use

================================================ FILE: api/edit_session.html ================================================

EditSession

Stores all the data about Editor state providing easy way to change editors state.

EditSession can be attached to only one Document. Same Document can be attached to several EditSessions.

Constructors

Sets up a new EditSession and associates it with the given Document and TextMode.

Sets up a new EditSession and associates it with the given Document and TextMode.

Arguments

textDocument | String

Required. If text is a Document, it associates the EditSession with it. Otherwise, a new Document is created, with the initial text

modeTextMode

Required. The initial language mode to use for the document

Events

    • EditSession.on("change", function(Object e))

Emitted when the document changes.

Emitted when the document changes.

Arguments

eObject

Required. An object containing a delta of information about the change.

    • EditSession.on("changeBackMarker", function())

Emitted when a back marker changes.

Emitted when a back marker changes.

    • EditSession.on("changeBreakpoint", function())

Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change.

Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change.

    • EditSession.on("changeFold", function())

Emitted when a code fold is added or removed.

Emitted when a code fold is added or removed.

    • EditSession.on("changeFrontMarker", function())

Emitted when a front marker changes.

Emitted when a front marker changes.

    • EditSession.on("changeMode", function())

Emitted when the current mode changes.

Emitted when the current mode changes.

    • EditSession.on("changeScrollLeft", function(Number scrollLeft))

Emitted when the scroll left changes.

Emitted when the scroll left changes.

Arguments

scrollLeftNumber

Required. The new scroll left value

    • EditSession.on("changeScrollTop", function(Number scrollTop))

Emitted when the scroll top changes.

Emitted when the scroll top changes.

Arguments

scrollTopNumber

Required. The new scroll top value

    • EditSession.on("changeWrapLimit", function())

Emitted when the wrapping limit changes.

Emitted when the wrapping limit changes.

    • EditSession.on("changeWrapMode", function())

Emitted when the wrap mode changes.

Emitted when the wrap mode changes.

    • EditSession.on("tokenizerUpdate", function(Object e))

Emitted when a background tokenizer asynchronously processes new rows.

Emitted when a background tokenizer asynchronously processes new rows.

Arguments

eObject

Required. An object containing one property, "data", that contains information about the changing rows

Methods

Adds a dynamic marker to the session.

Adds a dynamic marker to the session.

Arguments

markerObject

Required. Object with update method

inFrontBoolean

Required. Set to true to establish a front marker

    • EditSession.addGutterDecoration(Number row, String className)

Adds className to the row, to be used for CSS stylings and whatnot.

Adds className to the row, to be used for CSS stylings and whatnot.

Arguments

rowNumber

Required. The row number

classNameString

Required. The class to add

Adds a new marker to the given Range. If inFront is true, a front marker is defined, and the 'changeFrontMarker' event fires; otherwise, the 'changeBackMarker' event fires.

Adds a new marker to the given Range. If inFront is true, a front marker is defined, and the 'changeFrontMarker' event fires; otherwise, the 'changeBackMarker' event fires.

Arguments

rangeRange

Required. Define the range of the marker

clazzString

Required. Set the CSS class for the marker

typeFunction | String

Required. Identify the type of the marker

inFrontBoolean

Required. Set to true to establish a front marker

    • EditSession.clearAnnotations()

Clears all the annotations for this session. This function also triggers the 'changeAnnotation' event.

Clears all the annotations for this session. This function also triggers the 'changeAnnotation' event.

    • EditSession.clearBreakpoint(Number row)

Removes a breakpoint on the row number given by rows. This function also emits the 'changeBreakpoint' event.

Removes a breakpoint on the row number given by rows. This function also emits the 'changeBreakpoint' event.

Arguments

rowNumber

Required. A row index

    • EditSession.clearBreakpoints()

Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint' event.

Removes all breakpoints on the rows. This function also emites the 'changeBreakpoint' event.

For the given document row and column, returns the screen column.

For the given document row and column, returns the screen column.

Arguments

rowNumber

Required.

docColumnNumber

Required.

Converts document coordinates to screen coordinates. This takes into account code folding, word wrap, tab size, and any other visual modifications.

Converts document coordinates to screen coordinates. This takes into account code folding, word wrap, tab size, and any other visual modifications.

Arguments

docRowNumber

Required. The document row to check

docColumnNumber

Required. The document column to check

    • EditSession.documentToScreenRow(Number docRow, Number docColumn)

For the given document row and column, returns the screen row.

For the given document row and column, returns the screen row.

Arguments

docRowNumber

Required.

docColumnNumber

Required.

Duplicates all the text between firstRow and lastRow.

Duplicates all the text between firstRow and lastRow.

Arguments

firstRowNumber

Required. The starting row to duplicate

lastRowNumber

Required. The final row to duplicate

    • EditSession.getAnnotations()

Returns the annotations for the EditSession.

Returns the annotations for the EditSession.

Gets the range of a word, including its right whitespace.

Gets the range of a word, including its right whitespace.

Arguments

rowNumber

Required. The row number to start from

columnNumber

Required. The column number to start from

    • EditSession.getBreakpoints()

Returns an array of numbers, indicating which rows have breakpoints.

Returns an array of numbers, indicating which rows have breakpoints.

Returns the Document associated with this session.

Returns the Document associated with this session.

    • EditSession.getDocumentLastRowColumn(Number docRow, Number docColumn)

For the given document row and column, this returns the column position of the last screen row.

For the given document row and column, this returns the column position of the last screen row.

Arguments

docRowNumber

Required.

docColumnNumber

Required.

    • EditSession.getDocumentLastRowColumnPosition(Number docRow, Number docColumn)

For the given document row and column, this returns the document position of the last row.

For the given document row and column, this returns the document position of the last row.

Arguments

docRowNumber

Required.

docColumnNumber

Required.

    • EditSession.getLength()

Returns the number of rows in the document.

Returns the number of rows in the document.

Returns a verbatim copy of the given line as it is in the document

Returns a verbatim copy of the given line as it is in the document

Arguments

rowNumber

Required. The row to retrieve from

Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.

Returns an array of strings of the rows between firstRow and lastRow. This function is inclusive of lastRow.

Arguments

firstRowNumber

Required. The first row index to retrieve

lastRowNumber

Required. The final row index to retrieve

Returns an array containing the IDs of all the markers, either front or back.

Returns an array containing the IDs of all the markers, either front or back.

Arguments

inFrontBoolean

Required. If true, indicates you only want front markers; false indicates only back markers

Returns the current text mode.

Returns the current text mode.

    • EditSession.getNewLineMode()

Returns the current new line mode.

Returns the current new line mode.

    • EditSession.getOverwrite()

Returns true if overwrites are enabled; false otherwise.

Returns true if overwrites are enabled; false otherwise.

Returns number of screenrows in a wrapped line.

Returns number of screenrows in a wrapped line.

Arguments

rowNumber

Required. The row number to check

For the given row, this returns the split data.

For the given row, this returns the split data.

Arguments

rowObject

Required.

    • EditSession.getScreenLastRowColumn(Number screenRow)

Returns the position (on screen) for the last character in the provided screen row.

Returns the position (on screen) for the last character in the provided screen row.

Arguments

screenRowNumber

Required. The screen row to check

    • EditSession.getScreenLength()

Returns the length of the screen.

Returns the length of the screen.

The distance to the next tab stop at the specified screen column.

The distance to the next tab stop at the specified screen column.

Arguments

screenColumnNumber

Required. The screen column to check

    • EditSession.getScreenWidth()

Returns the width of the screen.

Returns the width of the screen.

    • EditSession.getScrollLeft()

Returns the value of the distance between the left of the editor and the leftmost part of the visible content.

Returns the value of the distance between the left of the editor and the leftmost part of the visible content.

    • EditSession.getScrollTop()

Returns the value of the distance between the top of the editor and the topmost part of the visible content.

Returns the value of the distance between the top of the editor and the topmost part of the visible content.

    • EditSession.getSelection()

Returns selection object.

Returns selection object.

    • EditSession.getState(Number row)

Returns the state of tokenization at the end of a row.

Returns the state of tokenization at the end of a row.

Arguments

rowNumber

Required. The row to start at

    • EditSession.getTabSize()

Returns the current tab size.

Returns the current tab size.

    • EditSession.getTabString()

Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by getTabSize()); otherwise it's simply '\t'.

Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by getTabSize()); otherwise it's simply '\t'.

Given a range within the document, this function returns all the text within that range as a single string.

Given a range within the document, this function returns all the text within that range as a single string.

Arguments

rangeRange

Required. The range to work with

Returns an object indicating the token at the current row. The object has two properties: index and start.

Returns an object indicating the token at the current row. The object has two properties: index and start.

Arguments

rowNumber

Required. The row number to retrieve from

columnNumber

Required. The column number to retrieve from

    • EditSession.getTokens(Number row)

Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.

Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.

Arguments

rowNumber

Required. The row to start at

    • EditSession.getUndoManager()

Returns the current undo manager.

Returns the current undo manager.

    • EditSession.getUseSoftTabs()

Returns true if soft tabs are being used, false otherwise.

Returns true if soft tabs are being used, false otherwise.

    • EditSession.getUseWorker()

Returns true if workers are being used.

Returns true if workers are being used.

    • EditSession.getUseWrapMode()

Returns true if wrap mode is being used; false otherwise.

Returns true if wrap mode is being used; false otherwise.

    • EditSession.getValue()

Returns the current Document as a string.

Returns the current Document as a string.

Given a starting row and column, this method returns the Range of the first word boundary it finds.

Given a starting row and column, this method returns the Range of the first word boundary it finds.

Arguments

rowNumber

Required. The row to start at

columnNumber

Required. The column to start at

    • EditSession.getWrapLimit()

Returns the value of wrap limit.

Returns the value of wrap limit.

    • EditSession.getWrapLimitRange()

Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:

Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this:

{ min: wrapLimitRange_min, max: wrapLimitRange_max }

    • EditSession.highlight()
    • Undocumented
    • EditSession.highlightLines()
    • Undocumented

Indents all the rows, from startRow to endRow (inclusive), by prefixing each row with the token in indentString.

Indents all the rows, from startRow to endRow (inclusive), by prefixing each row with the token in indentString.

If indentString contains the '\t' character, it's replaced by whatever is defined by getTabString().

Arguments

startRowNumber

Required. Starting row

endRowNumber

Required. Ending row

indentStringString

Required. The indent token

Inserts a block of text and the indicated position.

Inserts a block of text and the indicated position.

Arguments

positionObject

Required. The position {row, column} to start inserting at

textString

Required. A chunk of text to insert

    • EditSession.isTabStop(Object position)

Returns true if the character at the position is a soft tab.

Returns true if the character at the position is a soft tab.

Arguments

positionObject

Required. The position to check

Shifts all the lines in the document down one, starting from firstRow and ending at lastRow.

Shifts all the lines in the document down one, starting from firstRow and ending at lastRow.

Arguments

firstRowNumber

Required. The starting row to move down

lastRowNumber

Required. The final row to move down

Shifts all the lines in the document up one, starting from firstRow and ending at lastRow.

Shifts all the lines in the document up one, starting from firstRow and ending at lastRow.

Arguments

firstRowNumber

Required. The starting row to move up

lastRowNumber

Required. The final row to move up

Moves a range of text from the given range to the given position. toPosition is an object that looks like this:

   { row: newRowLocation, column: newColumnLocation }

Moves a range of text from the given range to the given position. toPosition is an object that looks like this:

   { row: newRowLocation, column: newColumnLocation }

Arguments

fromRangeRange

Required. The range of text you want moved within the document

toPositionObject

Required. The location (row and column) where you want to move the text to

    • EditSession.onChange()
    • Undocumented
    • EditSession.onChangeFold()
    • Undocumented
    • EditSession.onReloadTokenizer(Object e)

Reloads all the tokens on the current session. This function calls BackgroundTokenizer.start () to all the rows; it also emits the 'tokenizerUpdate' event.

Reloads all the tokens on the current session. This function calls BackgroundTokenizer.start () to all the rows; it also emits the 'tokenizerUpdate' event.

Arguments

eObject

Required.

    • EditSession.outdentRows(Range range)

Outdents all the rows defined by the start and end properties of range.

Outdents all the rows defined by the start and end properties of range.

Arguments

rangeRange

Required. A range of rows

    • EditSession.redo()
    • Undocumented

Re-implements a previously undone change to your document.

Re-implements a previously undone change to your document.

Arguments

deltasArray

Required. An array of previous changes

dontSelectBoolean

Required. If true, doesn't select the range of where the change occurred

Removes the range from the document.

Removes the range from the document.

Arguments

rangeRange

Required. A specified Range to remove

    • EditSession.removeGutterDecoration(Number row, String className)

Removes className from the row.

Removes className from the row.

Arguments

rowNumber

Required. The row number

classNameString

Required. The class to add

    • EditSession.removeMarker(Number markerId)

Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker' event is emitted. If the marker was in the back, the 'changeBackMarker' event is emitted.

Removes the marker with the specified ID. If this marker was in front, the 'changeFrontMarker' event is emitted. If the marker was in the back, the 'changeBackMarker' event is emitted.

Arguments

markerIdNumber

Required. A number representing a marker

Replaces a range in the document with the new text.

Replaces a range in the document with the new text.

Arguments

rangeRange

Required. A specified Range to replace

textString

Required. The new text to use as a replacement

    • EditSession.reset()
    • Undocumented
    • EditSession.resetCaches()
    • Undocumented
    • EditSession.screenToDocumentColumn()
    • Undocumented

Converts characters coordinates on the screen to characters coordinates within the document. This takes into account code folding, word wrap, tab size, and any other visual modifications.

Converts characters coordinates on the screen to characters coordinates within the document. This takes into account code folding, word wrap, tab size, and any other visual modifications.

Arguments

screenRowNumber

Required. The screen row to check

screenColumnNumber

Required. The screen column to check

    • EditSession.screenToDocumentRow()
    • Undocumented
    • EditSession.setAnnotations(Array annotations)

Sets annotations for the EditSession. This functions emits the 'changeAnnotation' event.

Sets annotations for the EditSession. This functions emits the 'changeAnnotation' event.

Arguments

annotationsArray

Required. A list of annotations

Sets a breakpoint on the row number given by rows. This function also emites the 'changeBreakpoint' event.

Sets a breakpoint on the row number given by rows. This function also emites the 'changeBreakpoint' event.

Arguments

rowNumber

Required. A row index

classNameString

Required. Class of the breakpoint

    • EditSession.setBreakpoints(Array rows)

Sets a breakpoint on every row number given by rows. This function also emites the 'changeBreakpoint' event.

Sets a breakpoint on every row number given by rows. This function also emites the 'changeBreakpoint' event.

Arguments

rowsArray

Required. An array of row indices

Sets the EditSession to point to a new Document. If a BackgroundTokenizer exists, it also points to doc.

Sets the EditSession to point to a new Document. If a BackgroundTokenizer exists, it also points to doc.

Arguments

docDocument

Required. The new Document to use

    • EditSession.setMode()
    • Undocumented
    • EditSession.setNewLineMode(String newLineMode)

Sets the new line mode.

Sets the new line mode.

Arguments

newLineModeString

Required. The newline mode to use; can be either windows, unix, or auto

    • EditSession.setOverwrite(Boolean overwrite)

Pass in true to enable overwrites in your session, or false to disable.

Pass in true to enable overwrites in your session, or false to disable.

If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emits the changeOverwrite event.

Arguments

overwriteBoolean

Required. Defines wheter or not to set overwrites

    • EditSession.setScrollLeft(Object scrollLeft)

Sets the value of the distance between the left of the editor and the leftmost part of the visible content.

Sets the value of the distance between the left of the editor and the leftmost part of the visible content.

Arguments

scrollLeftObject

Required.

    • EditSession.setScrollTop(Number scrollTop)

This function sets the scroll top value. It also emits the 'changeScrollTop' event.

This function sets the scroll top value. It also emits the 'changeScrollTop' event.

Arguments

scrollTopNumber

Required. The new scroll top value

    • EditSession.setTabSize(Number tabSize)

Set the number of spaces that define a soft tab; for example, passing in 4 transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize event.

Set the number of spaces that define a soft tab; for example, passing in 4 transforms the soft tabs to be equivalent to four spaces. This function also emits the changeTabSize event.

Arguments

tabSizeNumber

Required. The new tab size

Sets the undo manager.

Sets the undo manager.

Arguments

undoManagerUndoManager

Required. The new undo manager

    • EditSession.setUndoSelect(Boolean enable)

Enables or disables highlighting of the range where an undo occured.

Enables or disables highlighting of the range where an undo occured.

Arguments

enableBoolean

Required. If true, selects the range of the reinserted change

    • EditSession.setUseSoftTabs(Boolean useSoftTabs)

Pass true to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t').

Pass true to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character ('\t').

Arguments

useSoftTabsBoolean

Required. Value indicating whether or not to use soft tabs

    • EditSession.setUseWorker(Boolean useWorker)

Identifies if you want to use a worker for the EditSession.

Identifies if you want to use a worker for the EditSession.

Arguments

useWorkerBoolean

Required. Set to true to use a worker

    • EditSession.setUseWrapMode(Boolean useWrapMode)

Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the 'changeWrapMode' event is emitted.

Sets whether or not line wrapping is enabled. If useWrapMode is different than the current value, the 'changeWrapMode' event is emitted.

Arguments

useWrapModeBoolean

Required. Enable (or disable) wrap mode

    • EditSession.setValue(String text)

Sets the session text.

Sets the session text.

Arguments

textString

Required. The new text to place

Sets the boundaries of wrap. Either value can be null to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for min or max are different, this method also emits the 'changeWrapMode' event.

Sets the boundaries of wrap. Either value can be null to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for min or max are different, this method also emits the 'changeWrapMode' event.

Arguments

minNumber

Required. The minimum wrap value (the left side wrap)

maxNumber

Required. The maximum wrap value (the right side wrap)

    • EditSession.toggleOverwrite()

Sets the value of overwrite to the opposite of whatever it currently is.

Sets the value of overwrite to the opposite of whatever it currently is.

    • EditSession.toString()

Returns the current Document as a string.

Returns the current Document as a string.

    • EditSession.undo()
    • Undocumented

Reverts previous changes to your document.

Reverts previous changes to your document.

Arguments

deltasArray

Required. An array of previous changes

dontSelectBoolean

Required. If true, doesn't select the range of where the change occurred

================================================ FILE: api/editor.html ================================================

Editor

The main entry point into the Ace functionality.

The Editor manages the EditSession (which manages Documents), as well as the VirtualRenderer, which draws everything to the screen.

Event sessions dealing with the mouse and keyboard are bubbled up from Document to the Editor, which decides what to do with them.

Constructors

Creates a new Editor object.

Creates a new Editor object.

Arguments

rendererVirtualRenderer

Required. Associated VirtualRenderer that draws everything

sessionEditSession

Required. The EditSession to refer to

Events

    • Editor.on("blur", function())

Emitted once the editor has been blurred.

Emitted once the editor has been blurred.

    • Editor.on("change", function(Object e))

Emitted whenever the document is changed.

Emitted whenever the document is changed.

Arguments

eObject

Required. Contains a single property, data, which has the delta of changes

    • Editor.on("changeSession", function(Object e))

Emitted whenever the EditSession changes.

Emitted whenever the EditSession changes.

Arguments

eObject

Required. An object with two properties, oldSession and session, that represent the old and new EditSessions.

    • Editor.on("copy", function(String text))

Emitted when text is copied.

Emitted when text is copied.

Arguments

textString

Required. The copied text

    • Editor.on("focus", function())

Emitted once the editor comes into focus.

Emitted once the editor comes into focus.

    • Editor.on("paste", function(Object e))

Emitted when text is pasted.

Emitted when text is pasted.

Arguments

eObject

Required. An object which contains one property, text, that represents the text to be pasted. Editing this property will alter the text that is pasted.

Methods

    • Editor.addSelectionMarker(Range orientedRange)

Adds the selection and cursor.

Adds the selection and cursor.

Arguments

orientedRangeRange

Required. A range containing a cursor

    • Editor.alignCursors()

Aligns the cursors or selected text.

Aligns the cursors or selected text.

    • Editor.blockOutdent()

Outdents the current line.

Outdents the current line.

    • Editor.blur()

Blurs the current textInput.

Blurs the current textInput.

    • Editor.centerSelection()

Attempts to center the current selection on the screen.

Attempts to center the current selection on the screen.

    • Editor.clearSelection()

Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.

Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.

    • Editor.copyLinesDown()

Copies all the selected lines down one row.

Copies all the selected lines down one row.

Copies all the selected lines up one row.

Copies all the selected lines up one row.

    • Editor.destroy()

Cleans up the entire editor.

Cleans up the entire editor.

    • Editor.duplicateSelection()
    • Undocumented
    • Editor.execCommand()
    • Undocumented
    • Editor.exitMultiSelectMode()

Removes all the selections except the last added one.

Removes all the selections except the last added one.

Attempts to find needle within the document. For more information on options, see Search.

Attempts to find needle within the document. For more information on options, see Search.

Arguments

needleString

Required. The text to search for (optional)

optionsObject

Required. An object defining various search properties

animateBoolean

Required. If true animate scrolling

Finds and selects all the occurrences of needle.

Finds and selects all the occurrences of needle.

Arguments

TheString

Required. Text to find

TheObject

Required. Search options

keepsBoolean

Required.

Performs another search for needle in the document. For more information on options, see Search.

Performs another search for needle in the document. For more information on options, see Search.

Arguments

optionsObject

Required. Search options

animateBoolean

Required. If true animate scrolling

Performs a search for needle backwards. For more information on options, see Search.

Performs a search for needle backwards. For more information on options, see Search.

Arguments

optionsObject

Required. Search options

animateBoolean

Required. If true animate scrolling

    • Editor.focus()

Brings the current textInput into focus.

Brings the current textInput into focus.

Executes a command for each selection range.

Executes a command for each selection range.

Arguments

cmdString

Required. The command to execute

argsString

Required. Any arguments for the command

    • Editor.getAnimatedScroll()
    • Undocumented
    • Editor.getBehavioursEnabled()

Returns true if the behaviors are currently enabled. "Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.

Returns true if the behaviors are currently enabled. "Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.

Returns the string of text currently highlighted.

Returns the string of text currently highlighted.

    • Editor.getCursorPosition()

Gets the current position of the cursor.

Gets the current position of the cursor.

    • Editor.getCursorPositionScreen()

Returns the screen position of the cursor.

Returns the screen position of the cursor.

    • Editor.getDisplayIndentGuides()
    • Undocumented
    • Editor.getDragDelay()

Returns the current mouse drag delay.

Returns the current mouse drag delay.

    • Editor.getFadeFoldWidgets()
    • Undocumented
    • Editor.getFirstVisibleRow()

Returns the index of the first visible row.

Returns the index of the first visible row.

    • Editor.getHighlightActiveLine()

Returns true if current lines are always highlighted.

Returns true if current lines are always highlighted.

    • Editor.getHighlightGutterLine()
    • Undocumented
    • Editor.getHighlightSelectedWord()

Returns true if currently highlighted words are to be highlighted.

Returns true if currently highlighted words are to be highlighted.

    • Editor.getKeyboardHandler()

Returns the keyboard handler, such as "vim" or "windows".

Returns the keyboard handler, such as "vim" or "windows".

    • Editor.getLastSearchOptions()

Returns an object containing all the search options. For more information on options, see Search.

Returns an object containing all the search options. For more information on options, see Search.

    • Editor.getLastVisibleRow()

Returns the index of the last visible row.

Returns the index of the last visible row.

Returns true if overwrites are enabled; false otherwise.

Returns true if overwrites are enabled; false otherwise.

    • Editor.getPrintMarginColumn()

Returns the column number of where the print margin is.

Returns the column number of where the print margin is.

Returns true if the editor is set to read-only mode.

Returns true if the editor is set to read-only mode.

    • Editor.getScrollSpeed()

Returns the value indicating how fast the mouse scroll speed is (in milliseconds).

Returns the value indicating how fast the mouse scroll speed is (in milliseconds).

Returns selection object.

Returns selection object.

    • Editor.getSelectionRange()

Returns the Range for the selected text.

Returns the Range for the selected text.

    • Editor.getSelectionStyle()

Returns the current selection style.

Returns the current selection style.

Returns the current session being used.

Returns the current session being used.

    • Editor.getShowFoldWidgets()

Returns true if the fold widgets are shown.

Returns true if the fold widgets are shown.

    • Editor.getShowInvisibles()

Returns true if invisible characters are being shown.

Returns true if invisible characters are being shown.

    • Editor.getShowPrintMargin()

Returns true if the print margin is being shown.

Returns true if the print margin is being shown.

Returns the path of the current theme.

Returns the path of the current theme.

Returns the current session's content.

Returns the current session's content.

    • Editor.getWrapBehavioursEnabled()

Returns true if the wrapping behaviors are currently enabled.

Returns true if the wrapping behaviors are currently enabled.

Moves the cursor to the specified line number, and also into the indicated column.

Moves the cursor to the specified line number, and also into the indicated column.

Arguments

lineNumberNumber

Required. The line number to go to

columnNumber

Required. A column number to go to

animateBoolean

Required. If true animates scrolling

    • Editor.gotoPageDown()

Shifts the document to wherever "page down" is, as well as moving the cursor position.

Shifts the document to wherever "page down" is, as well as moving the cursor position.

    • Editor.gotoPageUp()

Shifts the document to wherever "page up" is, as well as moving the cursor position.

Shifts the document to wherever "page up" is, as well as moving the cursor position.

    • Editor.indent()

Indents the current line.

Indents the current line.

Inserts text into wherever the cursor is pointing.

Inserts text into wherever the cursor is pointing.

Arguments

textString

Required. The new text to add

Returns true if the current textInput is in focus.

Returns true if the current textInput is in focus.

Indicates if the entire row is currently visible on the screen.

Indicates if the entire row is currently visible on the screen.

Arguments

rowNumber

Required. The row to check

Indicates if the row is currently visible on the screen.

Indicates if the row is currently visible on the screen.

Arguments

rowNumber

Required. The row to check

    • Editor.jumpToMatching(Object select)

Moves the cursor's row and column to the next matching bracket.

Moves the cursor's row and column to the next matching bracket.

Arguments

selectObject

Required.

    • Editor.modifyNumber(Number amount)

If the character before the cursor is a number, this functions changes its value by amount.

If the character before the cursor is a number, this functions changes its value by amount.

Arguments

amountNumber

Required. The value to change the numeral by (can be negative to decrease value)

Moves the cursor to the specified row and column. Note that this does not de-select the current selection.

Moves the cursor to the specified row and column. Note that this does not de-select the current selection.

Arguments

rowNumber

Required. The new row number

columnNumber

Required. The new column number

    • Editor.moveCursorToPosition(Object pos)

Moves the cursor to the position indicated by pos.row and pos.column.

Moves the cursor to the position indicated by pos.row and pos.column.

Arguments

posObject

Required. An object with two properties, row and column

    • Editor.moveLinesDown()

Shifts all the selected lines down one row.

Shifts all the selected lines down one row.

Shifts all the selected lines up one row.

Shifts all the selected lines up one row.

    • Editor.moveText()
    • Undocumented
    • Editor.navigateDown(Number times)

Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.

Moves the cursor down in the document the specified number of times. Note that this does de-select the current selection.

Arguments

timesNumber

Required. The number of times to change navigation

    • Editor.navigateFileEnd()

Moves the cursor to the end of the current file. Note that this does de-select the current selection.

Moves the cursor to the end of the current file. Note that this does de-select the current selection.

    • Editor.navigateFileStart()

Moves the cursor to the start of the current file. Note that this does de-select the current selection.

Moves the cursor to the start of the current file. Note that this does de-select the current selection.

    • Editor.navigateLeft(Number times)

Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.

Moves the cursor left in the document the specified number of times. Note that this does de-select the current selection.

Arguments

timesNumber

Required. The number of times to change navigation

    • Editor.navigateLineEnd()

Moves the cursor to the end of the current line. Note that this does de-select the current selection.

Moves the cursor to the end of the current line. Note that this does de-select the current selection.

    • Editor.navigateLineStart()

Moves the cursor to the start of the current line. Note that this does de-select the current selection.

Moves the cursor to the start of the current line. Note that this does de-select the current selection.

    • Editor.navigateRight(Number times)

Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.

Moves the cursor right in the document the specified number of times. Note that this does de-select the current selection.

Arguments

timesNumber

Required. The number of times to change navigation

Moves the cursor to the specified row and column. Note that this does de-select the current selection.

Moves the cursor to the specified row and column. Note that this does de-select the current selection.

Arguments

rowNumber

Required. The new row number

columnNumber

Required. The new column number

    • Editor.navigateUp(Number times)

Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.

Moves the cursor up in the document the specified number of times. Note that this does de-select the current selection.

Arguments

timesNumber

Required. The number of times to change navigation

    • Editor.navigateWordLeft()

Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.

Moves the cursor to the word immediately to the left of the current position. Note that this does de-select the current selection.

    • Editor.navigateWordRight()

Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.

Moves the cursor to the word immediately to the right of the current position. Note that this does de-select the current selection.

    • Editor.onBlur()
    • Undocumented
    • Editor.onChangeAnnotation()
    • Undocumented
    • Editor.onChangeBackMarker()
    • Undocumented
    • Editor.onChangeBreakpoint()
    • Undocumented
    • Editor.onChangeFold()
    • Undocumented
    • Editor.onChangeFrontMarker()
    • Undocumented
    • Editor.onChangeMode()
    • Undocumented
    • Editor.onChangeWrapLimit()
    • Undocumented
    • Editor.onChangeWrapMode()
    • Undocumented
    • Editor.onCommandKey()
    • Undocumented
    • Editor.onCompositionEnd()
    • Undocumented
    • Editor.onCompositionStart()
    • Undocumented
    • Editor.onCompositionUpdate()
    • Undocumented
    • Editor.onCopy()

Called whenever a text "copy" happens.

Called whenever a text "copy" happens.

    • Editor.onCursorChange()

Emitted when the selection changes.

Emitted when the selection changes.

    • Editor.onCut()

Called whenever a text "cut" happens.

Called whenever a text "cut" happens.

    • Editor.onDocumentChange()
    • Undocumented
    • Editor.onFocus()
    • Undocumented

Called whenever a text "paste" happens.

Called whenever a text "paste" happens.

Arguments

textString

Required. The pasted text

    • Editor.onScrollLeftChange()
    • Undocumented
    • Editor.onScrollTopChange()
    • Undocumented
    • Editor.onSelectionChange()
    • Undocumented
    • Editor.onTextInput()
    • Undocumented
    • Editor.onTokenizerUpdate()
    • Undocumented
    • Editor.redo()

Perform a redo operation on the document, reimplementing the last change.

Perform a redo operation on the document, reimplementing the last change.

Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.

Removes words of text from the editor. A "word" is defined as a string of characters bookended by whitespace.

Arguments

dirString

Required. The direction of the deletion to occur, either "left" or "right"

    • Editor.removeLines()

Removes all the lines in the current selection

Removes all the lines in the current selection

    • Editor.removeSelectionMarker(Range The)

Removes the selection marker.

Removes the selection marker.

Arguments

TheRange

Required. selection range added with addSelectionMarker().

    • Editor.removeToLineEnd()

Removes all the words to the right of the current selection, until the end of the line.

Removes all the words to the right of the current selection, until the end of the line.

    • Editor.removeToLineStart()

Removes all the words to the left of the current selection, until the start of the line.

Removes all the words to the left of the current selection, until the start of the line.

    • Editor.removeWordLeft()

Removes the word directly to the left of the current selection.

Removes the word directly to the left of the current selection.

    • Editor.removeWordRight()

Removes the word directly to the right of the current selection.

Removes the word directly to the right of the current selection.

Replaces the first occurrence of options.needle with the value in replacement.

Replaces the first occurrence of options.needle with the value in replacement.

Arguments

replacementString

Required. The text to replace with

optionsObject

Required. The Search options to use

Replaces all occurrences of options.needle with the value in replacement.

Replaces all occurrences of options.needle with the value in replacement.

Arguments

replacementString

Required. The text to replace with

optionsObject

Required. The Search options to use

Triggers a resize of the editor.

Triggers a resize of the editor.

Arguments

forceBoolean

Required. If true, recomputes the size, even if the height and width haven't changed

    • Editor.revealRange()
    • Undocumented
    • Editor.scrollPageDown()

Scrolls the document to wherever "page down" is, without changing the cursor position.

Scrolls the document to wherever "page down" is, without changing the cursor position.

    • Editor.scrollPageUp()

Scrolls the document to wherever "page up" is, without changing the cursor position.

Scrolls the document to wherever "page up" is, without changing the cursor position.

Scrolls to a line. If center is true, it puts the line in middle of screen (or attempts to).

Scrolls to a line. If center is true, it puts the line in middle of screen (or attempts to).

Arguments

lineNumber

Required. The line to scroll to

centerBoolean

Required. If true

animateBoolean

Required. If true animates scrolling

callbackFunction

Required. Function to be called when the animation has finished

    • Editor.scrollToRow(Object row)

Moves the editor to the specified row.

Moves the editor to the specified row.

Arguments

rowObject

Required.

    • Editor.selectAll()

Selects all the text in editor.

Selects all the text in editor.

Finds the next occurrence of text in an active selection and adds it to the selections.

Finds the next occurrence of text in an active selection and adds it to the selections.

Arguments

dirNumber

Required. The direction of lines to select: -1 for up, 1 for down

skipBoolean

Required. If true, removes the active selection range

Adds a cursor above or below the active cursor.

Adds a cursor above or below the active cursor.

Arguments

dirNumber

Required. The direction of lines to select: -1 for up, 1 for down

skipBoolean

Required. If true, removes the active selection range

    • Editor.selectPageDown()

Selects the text from the current position of the document until where a "page down" finishes.

Selects the text from the current position of the document until where a "page down" finishes.

    • Editor.selectPageUp()

Selects the text from the current position of the document until where a "page up" finishes.

Selects the text from the current position of the document until where a "page up" finishes.

    • Editor.setAnimatedScroll()
    • Undocumented
    • Editor.setBehavioursEnabled(Boolean enabled)

Specifies whether to use behaviors or not. "Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.

Specifies whether to use behaviors or not. "Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.

Arguments

enabledBoolean

Required. Enables or disables behaviors

    • Editor.setDisplayIndentGuides()
    • Undocumented
    • Editor.setDragDelay(Number dragDelay)

Sets the delay (in milliseconds) of the mouse drag.

Sets the delay (in milliseconds) of the mouse drag.

Arguments

dragDelayNumber

Required. A value indicating the new delay

    • Editor.setFadeFoldWidgets()
    • Undocumented
    • Editor.setFontSize(Number size)

Set a new font size (in pixels) for the editor text.

Set a new font size (in pixels) for the editor text.

Arguments

sizeNumber

Required. A font size

    • Editor.setHighlightActiveLine(Boolean shouldHighlight)

Determines whether or not the current line should be highlighted.

Determines whether or not the current line should be highlighted.

Arguments

shouldHighlightBoolean

Required. Set to true to highlight the current line

    • Editor.setHighlightGutterLine()
    • Undocumented
    • Editor.setHighlightSelectedWord(Boolean shouldHighlight)

Determines if the currently selected word should be highlighted.

Determines if the currently selected word should be highlighted.

Arguments

shouldHighlightBoolean

Required. Set to true to highlight the currently selected word

    • Editor.setKeyboardHandler(String keyboardHandler)

Sets a new key handler, such as "vim" or "windows".

Sets a new key handler, such as "vim" or "windows".

Arguments

keyboardHandlerString

Required. The new key handler

    • Editor.setOverwrite(Boolean overwrite)

Pass in true to enable overwrites in your session, or false to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emits the changeOverwrite event.

Pass in true to enable overwrites in your session, or false to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of overwrite changes, this function also emits the changeOverwrite event.

Arguments

overwriteBoolean

Required. Defines whether or not to set overwrites

    • Editor.setPrintMarginColumn(Number showPrintMargin)

Sets the column defining where the print margin should be.

Sets the column defining where the print margin should be.

Arguments

showPrintMarginNumber

Required. Specifies the new print margin

    • Editor.setReadOnly(Boolean readOnly)

If readOnly is true, then the editor is set to read-only mode, and none of the content can change.

If readOnly is true, then the editor is set to read-only mode, and none of the content can change.

Arguments

readOnlyBoolean

Required. Specifies whether the editor can be modified or not

    • Editor.setScrollSpeed(Number speed)

Sets how fast the mouse scrolling should do.

Sets how fast the mouse scrolling should do.

Arguments

speedNumber

Required. A value indicating the new speed (in milliseconds)

    • Editor.setSelectionStyle(String style)

Indicates how selections should occur.

Indicates how selections should occur.

By default, selections are set to "line". There are no other styles at the moment, although this code change in the future.

This function also emits the 'changeSelectionStyle' event.

Arguments

styleString

Required. The new selection style

Sets a new editsession to use. This method also emits the 'changeSession' event.

Sets a new editsession to use. This method also emits the 'changeSession' event.

Arguments

sessionEditSession

Required. The new session to use

    • Editor.setShowFoldWidgets(Boolean show)

Indicates whether the fold widgets are shown or not.

Indicates whether the fold widgets are shown or not.

Arguments

showBoolean

Required. Specifies whether the fold widgets are shown

    • Editor.setShowInvisibles(Boolean showInvisibles)

If showInvisibles is set to true, invisible characters—like spaces or new lines—are show in the editor.

If showInvisibles is set to true, invisible characters—like spaces or new lines—are show in the editor.

Arguments

showInvisiblesBoolean

Required. Specifies whether or not to show invisible characters

    • Editor.setShowPrintMargin(Boolean showPrintMargin)

If showPrintMargin is set to true, the print margin is shown in the editor.

If showPrintMargin is set to true, the print margin is shown in the editor.

Arguments

showPrintMarginBoolean

Required. Specifies whether or not to show the print margin

    • Editor.setStyle(String style)

Adds a new class, style, to the editor.

Adds a new class, style, to the editor.

Arguments

styleString

Required. A class name

    • Editor.setTheme(String theme)

Sets a new theme for the editor. theme should exist, and be a directory path, like ace/theme/textmate.

Sets a new theme for the editor. theme should exist, and be a directory path, like ace/theme/textmate.

Arguments

themeString

Required. The path to a theme

Sets the current document to val.

Sets the current document to val.

Arguments

valString

Required. The new value to set for the document

cursorPosNumber

Required. Where to set the new value. undefined or 0 is selectAll, -1 is at the document start, and 1 is at the end

    • Editor.setWrapBehavioursEnabled(Boolean enabled)

Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets when such a character is typed in.

Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets when such a character is typed in.

Arguments

enabledBoolean

Required. Enables or disables wrapping behaviors

    • Editor.sortLines()
    • Undocumented
    • Editor.splitLine()

Splits the line at the current selection (by inserting an '\n').

Splits the line at the current selection (by inserting an '\n').

    • Editor.toggleCommentLines()

Given the currently selected range, this function either comments all the lines, or uncomments all of them.

Given the currently selected range, this function either comments all the lines, or uncomments all of them.

    • Editor.toggleOverwrite()

Sets the value of overwrite to the opposite of whatever it currently is.

Sets the value of overwrite to the opposite of whatever it currently is.

    • Editor.toLowerCase()

Converts the current selection entirely into lowercase.

Converts the current selection entirely into lowercase.

    • Editor.toUpperCase()

Converts the current selection entirely into uppercase.

Converts the current selection entirely into uppercase.

    • Editor.transposeLetters()

Transposes current line.

Transposes current line.

    • Editor.transposeSelections(Number dir)

Transposes the selected ranges.

Transposes the selected ranges.

Arguments

dirNumber

Required. The direction to rotate selections

    • Editor.undo()

Perform an undo operation on the document, reverting the last change.

Perform an undo operation on the document, reverting the last change.

    • Editor.unsetStyle(Object style)

Removes the class style from the editor.

Removes the class style from the editor.

Arguments

styleObject

Required.

    • Editor.updateSelectionMarkers()

Updates the cursor and marker layers.

Updates the cursor and marker layers.

================================================ FILE: api/index.html ================================================

Ace API Reference

Welcome to the Ace API Reference Guide. Ace is a standalone code editor written in JavaScript that you can embed onto any website. We're used in a bunch of places already, like GitHub, Google, and Facebook.

On the left, you'll find a list of all of our currently documented classes. There are plenty more to do, but these represent the "core" set. For more information on how to work with Ace, check out the main Ace website.

================================================ FILE: api/placeholder.html ================================================

Constructors

    • new PlaceHolder()
  • session (Document): The document to associate with the anchor
  • length (Number): The starting row position
  • pos (Number): The starting column position
  • others (String):
  • mainClass (String):
  • othersClass (String):
  • session (Document): The document to associate with the anchor
  • length (Number): The starting row position
  • pos (Number): The starting column position
  • others (String):
  • mainClass (String):
  • othersClass (String):

Methods

    • PlaceHolder.cancel()

PlaceHolder.cancel()

PlaceHolder.cancel()

TODO

    • PlaceHolder.detach()

PlaceHolder.detach()

PlaceHolder.detach()

TODO

    • PlaceHolder.hideOtherMarkers()

PlaceHolder.hideOtherMarkers()

PlaceHolder.hideOtherMarkers()

Hides all over markers in the EditSession that are not the currently selected one.

    • PlaceHolder.onCursorChange(Object event)

PlaceHolder@onCursorChange(e)

PlaceHolder@onCursorChange(e)

Emitted when the cursor changes.

Arguments

eventObject

Required.

    • PlaceHolder.onUpdate(Object event)

PlaceHolder@onUpdate(e)

PlaceHolder@onUpdate(e)

Emitted when the place holder updates.

Arguments

eventObject

Required.

    • PlaceHolder.setup()

PlaceHolder.setup()

PlaceHolder.setup()

TODO

    • PlaceHolder.showOtherMarkers()

PlaceHolder.showOtherMarkers()

PlaceHolder.showOtherMarkers()

TODO

================================================ FILE: api/range.html ================================================

This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogous to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.

Constructors

Creates a new Range object with the given starting and ending row and column points.

Creates a new Range object with the given starting and ending row and column points.

Arguments

startRowNumber

Required. The starting row

startColumnNumber

Required. The starting column

endRowNumber

Required. The ending row

endColumnNumber

Required. The ending column

Methods

Returns the part of the current Range that occurs within the boundaries of firstRow and lastRow as a new Range object.

Returns the part of the current Range that occurs within the boundaries of firstRow and lastRow as a new Range object.

Arguments

firstRowNumber

Required. The starting row

lastRowNumber

Required. The ending row

Returns a duplicate of the calling range.

Returns a duplicate of the calling range.

    • Range.collapseRows()

Returns a range containing the starting and ending rows of the original range, but with a column value of 0.

Returns a range containing the starting and ending rows of the original range, but with a column value of 0.

Checks the row and column points with the row and column points of the calling range.

Checks the row and column points with the row and column points of the calling range.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Checks the row and column points with the row and column points of the calling range.

Checks the row and column points with the row and column points of the calling range.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Checks the row and column points with the row and column points of the calling range.

Checks the row and column points with the row and column points of the calling range.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Checks the row and column points of p with the row and column points of the calling range.

Checks the row and column points of p with the row and column points of the calling range.

Arguments

pRange

Required. A point to compare with

Compares this range (A) with another range (B).

Compares this range (A) with another range (B).

Arguments

rangeRange

Required. A range to compare with

Checks the row and column points with the row and column points of the calling range.

Checks the row and column points with the row and column points of the calling range.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Returns true if the row and column provided are within the given range. This can better be expressed as returning true if:

   this.start.row <= row <= this.end.row &&
   this.start.column <= column <= this.end.column

Returns true if the row and column provided are within the given range. This can better be expressed as returning true if:

   this.start.row <= row <= this.end.row &&
   this.start.column <= column <= this.end.column

Arguments

rowNumber

Required. A row to check for

columnNumber

Required. A column to check for

Checks the start and end points of range and compares them to the calling range. Returns true if the range is contained within the caller's range.

Checks the start and end points of range and compares them to the calling range. Returns true if the range is contained within the caller's range.

Arguments

rangeRange

Required. A range to compare with

Changes the row and column points for the calling range for both the starting and ending points.

Changes the row and column points for the calling range for both the starting and ending points.

Arguments

rowNumber

Required. A new row to extend to

columnNumber

Required. A new column to extend to

Creates and returns a new Range based on the row and column of the given parameters.

Creates and returns a new Range based on the row and column of the given parameters.

Arguments

startRange

Required. A starting point to use

endRange

Required. An ending point to use

Returns true if the row and column are within the given range.

Returns true if the row and column are within the given range.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Returns true if the row and column are within the given range's ending points.

Returns true if the row and column are within the given range's ending points.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Returns true if the row and column are within the given range's starting points.

Returns true if the row and column are within the given range's starting points.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Returns true if passed in range intersects with the one calling this method.

Returns true if passed in range intersects with the one calling this method.

Arguments

rangeRange

Required. A range to compare with

    • Range.isEmpty()
    • Undocumented

Returns true if the caller's ending row point is the same as row, and if the caller's ending column is the same as column.

Returns true if the caller's ending row point is the same as row, and if the caller's ending column is the same as column.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Returns true if and only if the starting row and column, and ending row and column, are equivalent to those given by range.

Returns true if and only if the starting row and column, and ending row and column, are equivalent to those given by range.

Arguments

rangeRange

Required. A range to check against

Returns true if the range spans across multiple lines.

Returns true if the range spans across multiple lines.

Returns true if the caller's starting row point is the same as row, and if the caller's starting column is the same as column.

Returns true if the caller's starting row point is the same as row, and if the caller's starting column is the same as column.

Arguments

rowNumber

Required. A row point to compare with

columnNumber

Required. A column point to compare with

Sets the starting row and column for the range.

Sets the starting row and column for the range.

Arguments

rowNumber

Required. A row point to set

columnNumber

Required. A column point to set

Sets the starting row and column for the range.

Sets the starting row and column for the range.

Arguments

rowNumber

Required. A row point to set

columnNumber

Required. A column point to set

Given the current Range, this function converts those starting and ending points into screen positions, and then returns a new Range object.

Given the current Range, this function converts those starting and ending points into screen positions, and then returns a new Range object.

Arguments

sessionEditSession

Required. The EditSession to retrieve coordinates from

Returns a string containing the range's row and column information, given like this:

   [start.row/start.column] -> [end.row/end.column]

Returns a string containing the range's row and column information, given like this:

   [start.row/start.column] -> [end.row/end.column]
================================================ FILE: api/renderloop.html ================================================

RenderLoop

Batches changes (that force something to be redrawn) in the background.

================================================ FILE: api/resources/csses/ace_api.css ================================================ /* Generic "affects everything" stuff */ #wrapper .content .column2 { float: none; } #documentation ul { font-size: 13px; } #documentation li { color: black; } pre { background-color: #FFFFFF; } code { font-size: 12px; line-height: 16px; font-family: 'Ubuntu Mono',Monaco,Consolas,monospace !important; background-color: #F9F9F9; border-radius: 3px 3px 3px 3px; display: inline-block; padding: 0 4px; margin: 2px 1px; color: inherit; } #documentation pre { margin-top: 10px; border-radius: none; box-shadow: none; background : white; /*background : #f5f5f5; border: 0;*/ -webkit-border-radius: 6px 6px 0 0; -moz-border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0; padding: 5px; } .method pre, .event pre, .property pre { background : white; } #documentation pre code { background-color: transparent; border-radius: none; box-shadow: none; } #documentation a code { color: #00438a; } #documentation h2 { font-size: 26px; } #documentation p { font-size: 13px; } #documentation li p:last-child { margin-bottom : 5px; } #documentation blockquote p{ font-size: 14px; font-weight: 500; line-height: 23px; font-style: italic; } .alert-message{ margin-bottom : 13px; } /* Header and shoulders */ .navbar .nav > li { float:none; display:inline-block; *display:inline; /* ie7 fix */ zoom:1; /* hasLayout ie7 trigger */ } .navbar .nav > li > a { padding: 10px 15px 11px; } .navbar { text-align:center; } #topSection { width: 1000px; } .small_win #topSection { width: 100%; } .small_win #topSection .dropdown { margin-right: 40%; } .navbar .brand { margin-left: 0px; } .brand { background: transparent url(../images/ace_logo_menu.png) no-repeat 33px 5px; width: 80px; outline: none; height: 40px; padding: 0 10px !important; border: none; } .brand.dropdown-toggle:after { content: none; display: block; height: 40px; border: none; } .ace_logo { position: absolute; top: 45px; z-index: 20000; left: 210px; } .headerTitle { position: relative; top: 100px; left: 250px; } /* Menu venue */ h3.api_title { padding-top: 10px; } ul.menu { margin-left: 2px; } .menu li { list-style-image: url(../images/menu_disc.png); margin-bottom: 4px; font-weight: 700; padding-left: 10px; margin-left: 0; } .menu li .menu-item a.menuLink, .menu li .menu-item span.menuLink { color: #3E7096; font-weight: 100; } .menuTwo { margin-bottom: 5px; margin-top: 2px; } .menuTwo li .menu-item a.menuLink { color: #3E7096; font-weight: 100; } /* need specificity to "beat" the above colors */ .menu li .menu-item a.currentItem, .menuTwo li .menu-item { color: #0072bc; } /* Members and the tabs that represent them */ .srolled .members { width: 100%; /* -webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.35); -moz-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.35); box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.35); */ padding-bottom: 15px; /* height: 31px;*/ position: fixed; } .shadow.members{ background: #edf8fd; box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); -moz-box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); -o-box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); -webkit-box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); } .membersContent { /* border-bottom: 0.1em solid #FFF;*/ height: 3em; padding-top: 4px; /* line-height: 4;*/ /* margin-top: -0.1em;*/ position: relative; /* transition-property: border-color, line-height; transition-duration: 125ms, 250ms; transition-timing-function: ease-out, ease-out; -moz-transition-property: border-color, line-height; -moz-transition-duration: 125ms, 250ms; -moz-transition-timing-function: ease-out, ease-out; -o-transition-property: border-color, line-height; -o-transition-duration: 125ms, 250ms; -o-transition-timing-function: ease-out, ease-out; -webkit-transition-property: border-color, line-height; -webkit-transition-duration: 125ms, 250ms; -webkit-transition-timing-function: ease-out, ease-out;*/ /*transition-duration: 125ms; transition-property: top; transition-timing-function: ease-out; top : 11px;*/ z-index: 103; padding-right: 10px; margin-right: -5px; /*width: 700px;*/ } .srolledHeader .membersContent { line-height: 3; } .srolled .membersContent { /*top : 0;*/ width: 625px; padding-left: 327px; margin : 0 auto 0 auto; } .srolled ul.nav { padding-right: 10px; } .membersBackground { /* background-color: white; position: fixed; z-index: 2; top: 40px; left: 0px; right: 0px; width: 100%; height: 55px; opacity: 0; display: none; box-shadow: rgba(0, 0, 0, 0.398438) 1px 4px 6px;*/ background-color: transparent; height: 47px; /*width: 700px;*/ position: absolute; } .srolled .membersBackground { position: relative; } .srolledHeader .membersBackground { /* display: block;*/ } .memberHeader { float: left; padding-right: 10px; margin-bottom: 5px; position: absolute; padding-top: 4px; } ul.tabs li:first-child ul{ left: -63px; } .tabs a.menu:after, .tabs .dropdown-toggle:after { margin-top: 22px; } .nav .dropdown-toggle .caret { margin-top: 12px; border-top-color: #6D8CA0; border-bottom-color: #6D8CA0; } li.dropdown { color: #2D2D2D; font-weight: bold; } .editInC9 { font-size: 11px; color: #657383; } .editInC9 a { color: #657383; font-weight: normal; position : relative; top : -2px; } .tabs { padding-top: 14px; /*border-bottom: 1px solid #848484;*/ min-height : 27px; padding-bottom : 5px; } .tabsSansBorder { border: 0; } .tabs, .pills { margin-bottom: 0; } .srolledHeader .members .tabs { background-color: white; } li.dropdown { color: #2D2D2D; font-weight: bold; } .members .tabs .dropdown a, .members .tabs a.menu:after, .members .tabs .dropdown-toggle:after { margin-right: 0; margin-left: 6px; } .memberLink a { margin-left: 0 !important; } .menu-dropdown { min-width : 105px; max-height: 350px; overflow: auto; border-color : rgba(0, 0, 0, 0.1); } .topbar div > ul .menu-dropdown li a:hover, .nav .menu-dropdown li a:hover, .topbar div > ul .dropdown-menu li a:hover, .nav .dropdown-menu li a:hover { background-color: #ffffff; color: #000000; } .tabs a.menu:after, .tabs .dropdown-toggle:after { margin-top: 13px; line-height: 28px; } .open .menu, .dropdown.open .menu, .open .dropdown-toggle, .dropdown.open .dropdown-toggle { background: transparent; color: black; /* font-weight: bold;*/ } #topSection .open .menu, #topSection .dropdown.open .menu, #topSection .open .dropdown-toggle, #topSection .dropdown.open .dropdown-toggle { color: #bfbfbf; } .tabs > li { font-weight: bold; } .tabs > li > a { border: none; outline: none; line-height: 28px; font-size: 11px; padding: 0 5px; } .tabs > li > a:hover { color: #000000; text-decoration: none; background-color: transparent; border: none; } .tabs > li, .pills > li { float: right; } .topbar .dropdown-menu a, .dropdown-menu a { font-size: 11px; /* padding: 2px 12px;*/ line-height: 14px; } .tabs .active > a, .tabs .active > a:hover { color: #000000; border: none; cursor: default; } .tabs .menu-dropdown, .tabs .dropdown-menu { border-radius: 0 0 6px 6px; left: 10px; width: 160px; } .srolled .tabs .menu-dropdown, .srolled .tabs .dropdown-menu { top: 32px; } .dropdown-toggle { color: #6D8CA0; } ul.tabs .double ul, ul.tabs .triple ul, ul.tabs .quad ul{ width:760px; margin-bottom:20px; overflow:hidden; border-top:1px solid #ccc; } /*ul.tabs .double li, ul.tabs .triple li, ul.tabs .quad li{ line-height:1.5em; border-bottom:1px solid #ccc; float:left; display:inline; }*/ /* Center content (the "real stuff") */ #nonFooter { padding-top: 40px; } #wrapper { height: 100%; } .content { height: 100%; } header.filler { position: relative; height: 40px; width: 100%; } /* .container-fluid .row-fluid { width: 1000px; margin-left: auto; margin-right: auto; }*/ .divider { height: 3px; background-color: #BEDAEA; margin-bottom: 3px; } #sidebar h3 a, #sidebar h3 a:hover { color: #404040; } #sidebarContainer { padding-top: 20px; } #mainContent { margin-left: 30px; } #documentation { padding-top: 35px; padding-bottom: 10px; } #documentation article.article { border-top: 1px solid #e9e9e9; padding: 16px 10px 2px; -webkit-transition: padding 0.2s; -moz-transition: padding 0.2s; -o-transition: padding 0.2s; } #documentation h3.sectionHeader + article.article { border-top: none; } div#documentation article:last-child { border-bottom: 1px solid #e9e9e9; padding-bottom: 40px; } #documentation article.article.methodToggleOpen { background: rgba(255, 255, 255, 0.5); font-size: 13px; line-height: 24px; margin: 0 0 10px 0; } #documentation article:first-child { border:none; } .site_logo { display: block; margin-left: auto; margin-right: auto; } /* Edit in Cloud9, sucka */ .snippet pre { margin-bottom: 0; } .snippet .toolbar { -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; text-align: right; padding: 3px 10px; margin-top : -1px; } .snippet .filename, .snippet .toolbar { font-family: Ubuntu, sans-serif; font-size: 12px; color: #EEE; } .snippet .filename { padding: 0 5px 2px 5px; font-size: 10px; background: rgba(230,230,230,0.5); padding: 0 5px 2px 5px; border-radius: 0 6px 0 6px; margin : 1px; position : absolute; right : 0; top : 0; } .snippet .filename span{ color : #666; } .snippet .toolbar { background-color: rgba(30,30,30,0.5); } div.snippet { margin-bottom: 18px; position : relative; } div.snippet a, div.toolbar a { color: #FFF; } /* All about signatures */ .signatures { /* width: 800px;*/ margin-left: 20px; margin-bottom: 5px; } .sideToggler { padding-left: 20px; } ul.signatures ul { list-style: none; display: inline; } li.signature { list-style: none; } .signature ul { padding: 0; margin: 0; } .signature li { display: inline; } .signature ul.argument-types::before { content: '→'; margin: 0 5px; } .signature li.argument-type::after { content: '|'; padding: 0 5px 0 5px; } .signature li.argument-type:last-child:after { content: ''; padding: 0 5px 0 5px; } .member-name { color: #4397cd; font-weight: bold; text-decoration: none; cursor: pointer; padding-right: 3px; } .signature-call { cursor: pointer; } #documentation .signature-call a { color: #8e487e; } .sigClassName { display: none; } .eventObjName { font-style: italic; } .eventListenerStart, .eventListenerClose, .eventFunctionOpen, .eventFunctionClose { color: #999999; } .eventMember { padding-right: 0px; } .metaInfo { float: right; z-index: 1; position: relative; } .chainable { background-color: #0072bc; color: #ffffff; } .deprecated { background-color: #f7941d; color: #ffffff; } .alias { background-color: #6c951e; color: #ffffff; } .related-to { background-color: #89289a; color: #ffffff; font-size: 10px; padding: 2px 5px 3px; text-transform: capitalize; } .undocumented { background-color: #B94A48; color: #ffffff; } #documentation .alias a, #documentation .related-to a { color: #ffffff; /* text-decoration: underline; */ } #documentation .alias a:hover, #documentation .related-to a:hover { text-decoration: none; } .#documentation alias:hover, #documentation .related-to:hover { opacity: 0.8; cursor: pointer; } .memberContent .title { } .memberContent .description { position:relative; /*top: -13px;*/ display: none; } .snip-container .actions .toggle-plaintext label { margin-top: 1px; padding-top: 0; text-align: left; } .snip-container .actions .toggle-plaintext input { margin-top: 4px !important; } .snip-container label { color: #ffffff; } .description h4 { padding-top: 10px; font-size: 18px; line-height : 18px; } .table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th { background-color: #F9F9F9; } .table-striped tbody tr:nth-child(even) td, .table-striped tbody tr:nth-child(even) th { background-color: #fbfbfb; } .argument-list { margin-bottom : 13px; } .argName { font-style: italic; } /* Everyday I'm togglin' */ #documentation i.methodToggle { cursor: pointer; color: #9f9f9f; padding-top: 2px; float: left; } #documentation i.methodToggle.methodToggleHover { text-shadow: 0 0 10px #4699d5; color: #4699d5; } #documentation i.methodToggle.active { text-shadow: 0 0 10px #4699d5; color: #4699d5; /* Safari */ -webkit-transform: rotate(45deg); /* Firefox */ -moz-transform: rotate(45deg); /* IE */ -ms-transform: rotate(45deg); /* Opera */ -o-transform: rotate(45deg); padding-top: 9px; } #documentation h3.sectionHeader { line-height : 24px; } div.method { position: relative; } .methodToggle a { color: #fff; border-bottom: 0px; text-decoration: none; } h3.methodToggle { height : 13px; width : 8px; background-position : 0px 0px; position: absolute; top: -20px; background-image : url(../images/member-sprites.png); background-color : transparent; background-repeat : no-repeat; overflow: hidden; left: 0px; } h3.methodToggleHover { /* background-position : 0px -28px; */ } h3.methodToggle.inactive { top: 4px; } h3.methodToggle.active { top: 6px; height : 13px; width : 8px; background-position : 0px -59px; } .hidden { display: none; visibility: hidden; } .hiddenSpan { display: none; } .ellipsis_description, .short_description { /* width: 800px;*/ } .methodToggleOpen .ellipsis_description { display: none; } .sideToggler .short_description, .sideToggler .description{ display: none; } .methodToggleOpen .short_description, .methodToggleOpen .description { display: block; } .description td p { margin: 0; } /* Footer? I hardly know her */ #footer { width:100%; background: #101010 url(../images/dashed_back.png) repeat 0 0; font-size: 12px; color: white; height: 40px; } #footer .footerInner { padding-left: 300px; margin-left: auto; margin-right: auto; min-height: 40px; } #footer .footer-text { display: block; font-size: 12px; float: right; } #footer div.footerInner div.footer-text p { font-size: 12px; font-family: Arial; line-height: 18px; margin: 10px 15px 0px 1px; } #footer a, #footer a:hover { color: #8DD0FF; } .logoText, .logoImg { /*position: absolute;*/ margin-bottom: 5px; } .logoImg { top: 40px; } .topbar div > ul .menu-dropdown li a:hover, .nav .menu-dropdown li a:hover, .topbar div > ul .dropdown-menu li a:hover, .nav .dropdown-menu li a:hover { background-color: #191919; background-repeat: repeat-x; background-image: -khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919)); background-image: -moz-linear-gradient(top, #292929, #191919); background-image: -ms-linear-gradient(top, #292929, #191919); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919)); background-image: -webkit-linear-gradient(top, #292929, #191919); background-image: -o-linear-gradient(top, #292929, #191919); background-image: linear-gradient(top, #292929, #191919); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0); color: #ffffff; } .alert-message.block-message { background: #fefaca; border-color : #fefaca; padding : 8px 14px 8px 14px; } body .dsq-reply{ margin-top : 10px; } #disqus_thread{ border-top : 1px solid #ddd; margin-top : 30px; } #disqus_thread h3, body #dsq-content h3 { font-size : 12px; margin : 0 0 20px 0; line-height : 12px; } body #dsq-reply h3{ font-size : 18px; line-height : 18px; margin : 15px 0 20px 0; } #disqus_thread select{ font-size : 11px; height : 20px; color : #444; } #dsq-global-toolbar, #dsq-pagination, .dsq-trackback-url{ display : none; } ================================================ FILE: api/resources/javascripts/bbq.js ================================================ /* * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 * http://benalman.com/projects/jquery-bbq-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this); ================================================ FILE: api/resources/javascripts/bootstrap.js ================================================ /* ============================================================ * bootstrap-dropdown.js v2.1.1 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* DROPDOWN CLASS DEFINITION * ========================= */ var toggle = '[data-toggle=dropdown]' , Dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeClass('open') }) } Dropdown.prototype = { constructor: Dropdown , toggle: function (e) { var $this = $(this) , $parent , isActive if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') clearMenus() if (!isActive) { $parent.toggleClass('open') $this.focus() } return false } , keydown: function (e) { var $this , $items , $active , $parent , isActive , index if (!/(38|40|27)/.test(e.keyCode)) return $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) return $this.click() $items = $('[role=menu] li:not(.divider) a', $parent) if (!$items.length) return index = $items.index($items.filter(':focus')) if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items .eq(index) .focus() } } function clearMenus() { getParent($(toggle)) .removeClass('open') } function getParent($this) { var selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = $(selector) $parent.length || ($parent = $this.parent()) return $parent } /* DROPDOWN PLUGIN DEFINITION * ========================== */ $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('dropdown') if (!data) $this.data('dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.Constructor = Dropdown /* APPLY TO STANDARD DROPDOWN ELEMENTS * =================================== */ $(function () { $('html') .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) $('body') .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }) }(window.jQuery); /* ======================================================== * bootstrap-tab.js v2.1.1 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================== */ !function ($) { "use strict"; // jshint ;_; /* TAB CLASS DEFINITION * ==================== */ var Tab = function (element) { this.element = $(element) } Tab.prototype = { constructor: Tab , show: function () { var $this = this.element , $ul = $this.closest('ul:not(.dropdown-menu)') , selector = $this.attr('data-target') , previous , $target , e if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } if ( $this.parent('li').hasClass('active') ) return previous = $ul.find('.active a').last()[0] e = $.Event('show', { relatedTarget: previous }) $this.trigger(e) if (e.isDefaultPrevented()) return $target = $(selector) this.activate($this.parent('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ type: 'shown' , relatedTarget: previous }) }) } , activate: function ( element, container, callback) { var $active = container.find('> .active') , transition = callback && $.support.transition && $active.hasClass('fade') function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') element.addClass('active') if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if ( element.parent('.dropdown-menu') ) { element.closest('li.dropdown').addClass('active') } callback && callback() } transition ? $active.one($.support.transition.end, next) : next() $active.removeClass('in') } } /* TAB PLUGIN DEFINITION * ===================== */ $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tab') if (!data) $this.data('tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } $.fn.tab.Constructor = Tab /* TAB DATA-API * ============ */ $(function () { $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() $(this).tab('show') }) }) }(window.jQuery); /* ========================================================== * bootstrap-affix.js v2.1.1 * http://twitter.github.com/bootstrap/javascript.html#affix * ========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* AFFIX CLASS DEFINITION * ====================== */ var Affix = function (element, options) { this.options = $.extend({}, $.fn.affix.defaults, options) this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) this.$element = $(element) this.checkPosition() } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var scrollHeight = $(document).height() , scrollTop = this.$window.scrollTop() , position = this.$element.offset() , offset = this.options.offset , offsetBottom = offset.bottom , offsetTop = offset.top , reset = 'affix affix-top affix-bottom' , affix if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top() if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetTop != null && scrollTop <= offsetTop ? 'top' : false if (this.affixed === affix) return this.affixed = affix this.unpin = affix == 'bottom' ? position.top - scrollTop : null this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) } /* AFFIX PLUGIN DEFINITION * ======================= */ $.fn.affix = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('affix') , options = typeof option == 'object' && option if (!data) $this.data('affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.affix.Constructor = Affix $.fn.affix.defaults = { offset: 0 } /* AFFIX DATA-API * ============== */ $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) , data = $spy.data() data.offset = data.offset || {} data.offsetBottom && (data.offset.bottom = data.offsetBottom) data.offsetTop && (data.offset.top = data.offsetTop) $spy.affix(data) }) }) }(window.jQuery); ================================================ FILE: api/resources/javascripts/clicker.js ================================================ function setupClicker() { // when hovering over arrow, add highlight (only if inactive) $("i.methodToggle").hover(function () { if (!$("i.methodToggle").hasClass('active')) $(this).addClass("methodToggleHover"); }, function () { $(this).removeClass("methodToggleHover"); } ); function handleClick(e, linkHref) { //if (linkHref.indexOf("nav=api&api=") >= 0) // return; if (linkHref == "api") return; e.preventDefault(); var dstElem; if (linkHref) { dstElem = $("article[id='" + linkHref + "']"); } var $article = (dstElem || $(this)).closest('.article'), $arrow = $('i.methodClicker', $article); if (!$article.hasClass('methodToggleOpen') || this.force) { $article.addClass('methodToggleOpen'); $arrow.removeClass('inactive').addClass('active'); if (!$arrow[0]) return; var data = $arrow[0].id.replace(/^js_/, ""); //var state = {}; //state.section = data; //$.bbq.pushState(state); scrollTo(null, data); } else { $article.removeClass('methodToggleOpen'); $arrow.removeClass('active').addClass('inactive'); } } function transformHash(e) { // some bs to figure out link hash var hashId = (e.srcElement ? e.srcElement.href : (e.hash || e.target.href)) || e.currentTarget.hash; handleClick(e, hashId.substring(hashId.indexOf("#") + 1)); } // for the arrow $("i.methodToggle").click(handleClick); // for the signature $('.member-name').click(handleClick); // for the top dropdown $('li.memberLink a').click(transformHash); //$('a[href^="#"]').click(transformHash); $('.related-to', '.metaInfo').click(function(){ location.hash = $(this).find('a').attr('href').split('#')[1]; }); } ================================================ FILE: api/resources/javascripts/disqus-ext.js ================================================ function setupDisqus(href) { var disqus_shortname = 'aceapi'; //var paths = window.location.pathname.split("/"); //var fileName = paths[paths.length - 2] + "/" + paths[paths.length - 1]; //var disqus_identifier = fileName; var disqus_identifier = href.substring(2); (function() { if (document.getElementById("disqusScript") === null) { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); } })(); } ================================================ FILE: api/resources/javascripts/jquery-scrollspy.js ================================================ /*! * jQuery Scrollspy Plugin * Author: @sxalexander * Licensed under the MIT license */ ;(function ( $, window, document, undefined ) { $.fn.extend({ scrollspy: function ( options ) { var defaults = { min: 0, max: 0, mode: 'vertical', buffer: 0, container: window, onEnter: options.onEnter ? options.onEnter : [], onLeave: options.onLeave ? options.onLeave : [], onTick: options.onTick ? options.onTick : [] } var options = $.extend( {}, defaults, options ); return this.each(function (i) { var element = this; var o = options; var $container = $(o.container); var mode = o.mode; var buffer = o.buffer; var enters = leaves = 0; var inside = false; /* add listener to container */ $container.bind('scroll', function(e){ var position = {top: $(this).scrollTop(), left: $(this).scrollLeft()}; var xy = (mode == 'vertical') ? position.top + buffer : position.left + buffer; var max = o.max; var min = o.min; /* fix max */ if($.isFunction(o.max)){ max = o.max(); } /* fix max */ if($.isFunction(o.min)){ min = o.min(); } if(max == 0){ max = (mode == 'vertical') ? $container.height() : $container.outerWidth() + $(element).outerWidth(); } /* if we have reached the minimum bound but are below the max ... */ if(xy >= o.min && xy <= max){ /* trigger enter event */ if(!inside){ inside = true; enters++; /* fire enter event */ $(element).trigger('scrollEnter', {position: position}) if($.isFunction(o.onEnter)){ o.onEnter(element, position); } } /* triger tick event */ $(element).trigger('scrollTick', {position: position, inside: inside, enters: enters, leaves: leaves}) if($.isFunction(o.onTick)){ o.onTick(element, position, inside, enters, leaves); } }else{ if(inside){ inside = false; leaves++; /* trigger leave event */ $(element).trigger('scrollLeave', {position: position, leaves:leaves}) if($.isFunction(o.onLeave)){ o.onLeave(element, position); } } } }); }); } }) })( jQuery, window ); ================================================ FILE: api/resources/javascripts/jquery.collapse.js ================================================ /*! * Collapse plugin for jQuery * http://github.com/danielstocks/jQuery-Collapse/ * * @author Daniel Stocks (http://webcloud.se) * @version 0.9.1 * @updated 17-AUG-2010 * * Copyright 2010, Daniel Stocks * Released under the MIT, BSD, and GPL Licenses. */ (function($) { // Use a cookie counter to allow multiple instances of the plugin var cookieCounter = 0; $.fn.extend({ collapse: function(options) { var defaults = { head : "h3", group : "div, ul", cookieName : "collapse", // Default function for showing content show: function() { this.show(); }, // Default function for hiding content hide: function() { this.hide(); } }; var op = $.extend(defaults, options); // Default CSS classes var active = "active", inactive = "inactive"; return this.each(function() { // Increment coookie counter to ensure cookie name integrity cookieCounter++; var obj = $(this), // Find all headers and wrap them in for accessibility. sections = obj.find(op.head).wrapInner(''), l = sections.length, cookie = op.cookieName + "_" + cookieCounter; // Locate all panels directly following a header var panel = obj.find(op.head).map(function() { var head = $(this) if(!head.hasClass(active)) { return head.next(op.group).hide()[0]; } return head.next(op.group)[0]; }); // Bind event for showing content obj.bind("show", function(e, bypass) { var obj = $(e.target); // ARIA attribute obj.attr('aria-hidden', false) .prev() .removeClass(inactive) .addClass(active); // Bypass method for instant display if(bypass) { obj.show(); } else { op.show.call(obj); } }); // Bind event for hiding content obj.bind("hide", function(e, bypass) { var obj = $(e.target); obj.attr('aria-hidden', true) .prev() .removeClass(active) .addClass(inactive); if(bypass) { obj.hide(); } else { op.hide.call(obj); } }); // Look for existing cookies if(cookieSupport) { for (var c=0;c<=l;c++) { var val = $.cookie(cookie + c); // Show content if associating cookie is found if ( val == c + "open" ) { panel.eq(c).trigger('show', [true]); // Hide content } else if ( val == c + "closed") { panel.eq(c).trigger('hide', [true]); } } } // Delegate click event to show/hide content. obj.bind("click", function(e) { var t = $(e.target); // Check if header was clicked if(!t.is(op.head)) { // What about link inside header. if ( t.parent().is(op.head) ) { t = t.parent(); } else { return; } e.preventDefault(); } // Figure out what position the clicked header has. var num = sections.index(t), cookieName = cookie + num, cookieVal = num, content = t.next(op.group); // If content is already active, hide it. if(t.hasClass(active)) { content.trigger('hide'); cookieVal += 'closed'; if(cookieSupport) { $.cookie(cookieName, cookieVal, { path: '/', expires: 10 }); } return; } // Otherwise show it. content.trigger('show'); cookieVal += 'open'; if(cookieSupport) { $.cookie(cookieName, cookieVal, { path: '/', expires: 10 }); } }); }); } }); // Make sure can we eat cookies without getting into trouble. var cookieSupport = (function() { try { $.cookie('x', 'x', { path: '/', expires: 10 }); $.cookie('x', null); } catch(e) { return false; } return true; })(); })(jQuery); ================================================ FILE: api/resources/javascripts/jquery.cookie.js ================================================ /** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; ================================================ FILE: api/resources/javascripts/plugins.js ================================================ window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);(typeof console.log==="object"?log.apply.call(console.log,console,a):console.log.apply(console,a))}}; (function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try {console.log();return window.console;}catch(err){return window.console={};}})()); /* * jQuery throttle / debounce - v1.1 - 3/7/2010 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); ================================================ FILE: api/resources/javascripts/prettify-extension.js ================================================ // Stolen from StackOverflow. Find all
 
// elements on the page and add the "prettyprint" style. If at least one 
// prettyprint element was found, call the Google Prettify prettyPrint() API.
//http://sstatic.net/so/js/master.js?v=6523
function styleCode() 
{
    if (typeof disableStyleCode != "undefined") 
    {
        return;
    }

    var a = false;

    $("pre code").parent().each(function() 
    {
        if (!$(this).hasClass("prettyprint")) 
        {
            $(this).addClass("prettyprint");
            a = true
        }
    });
    
    if (a) { prettyPrint() } 
}

================================================
FILE: api/resources/javascripts/prettify.js
================================================
var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
(function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
[],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
"");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
/^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b=
!k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p 1010) sx = 1010 - document.documentElement.offsetWidth;
    }
    else sx = 0;

    $('span.methodClicker, article.article, i.methodClicker').each(function () {
        var a = $(this);
        var constructorPos = a.attr("id").indexOf("new ");

        var objName = a.attr("id");
        if (constructorPos >= 0) {
            objName = objName.substring(constructorPos + 4);
            objName += ".new";
        }

        a.attr("id", objName);
    });
    
    function showMethodContent() {
        var locationHash = location.hash.replace(/^#/, '').replace(/\./g, '\\.');
        var equalsPos = location.hash.indexOf("=");
        
        if (equalsPos >=0) {
            locationHash = locationHash.substring(0, location.hash.indexOf("="));
        }
        
        var $clickerEl = $('span#' + locationHash);
        if ($clickerEl.length > 0 && $clickerEl.hasClass('methodClicker')) {
            var p = $clickerEl.parent();
            p[0].force = true;
            p.trigger('click');
            p[0].force = false;
        }
    }

    if (location.hash.indexOf("section") >= 1) {
        showMethodContent();
        var data = location.hash;
        scrollTo(null, data.substr(1));
    }

    window.onhashchange = function () {
        showMethodContent();
    }
};

function scrollTo(el, data) {
    if (!data) {
        data = el.getAttribute("data-id");
        //location.hash = data;
    }
    var el = $("span#" + data.replace(/\./g, "\\."))[0];
    if (!el) return;

    var article = $(el).closest('.article')[0];

    var top = article.offsetTop - 100;

    if (document.body.scrollTop > top || document.body.scrollTop != top && document.body.scrollTop + (window.innerHeight || document.documentElement.offsetHeight) < top + article.offsetHeight) {
        $('body').animate({
            scrollTop: top
        }, {
            duration: 200,
            easing: "swing"
        });
    }
}

================================================
FILE: api/scrollbar.html
================================================

A set of methods for setting and retrieving the editor's scrollbar.

Constructors

Creates a new ScrollBar. parent is the owner of the scroll bar.

Creates a new ScrollBar. parent is the owner of the scroll bar.

Arguments

parentDOMElement

Required. A DOM element

Events

    • ScrollBar.on("scroll", function(Object e))

Emitted when the scroll bar, well, scrolls.

Emitted when the scroll bar, well, scrolls.

Arguments

eObject

Required. Contains one property, "data", which indicates the current scroll top position

Methods

Returns the width of the scroll bar.

Returns the width of the scroll bar.

    • ScrollBar.onScroll()
    • Undocumented
    • ScrollBar.setHeight(Number height)

Sets the height of the scroll bar, in pixels.

Sets the height of the scroll bar, in pixels.

Arguments

heightNumber

Required. The new height

    • ScrollBar.setInnerHeight(Number height)

Sets the inner height of the scroll bar, in pixels.

Sets the inner height of the scroll bar, in pixels.

Arguments

heightNumber

Required. The new inner height

    • ScrollBar.setScrollTop(Number scrollTop)

Sets the scroll top of the scroll bar.

Sets the scroll top of the scroll bar.

Arguments

scrollTopNumber

Required. The new scroll top

================================================ FILE: api/search.html ================================================

A class designed to handle all sorts of text searches within a Document.

Constructors

    • new Search()

Creates a new Search object. The following search options are available:

Creates a new Search object. The following search options are available:

  • needle: The string or regular expression you're looking for
  • backwards: Whether to search backwards from where cursor currently is. Defaults to false.
  • wrap: Whether to wrap the search back to the beginning when it hits the end. Defaults to false.
  • caseSensitive: Whether the search ought to be case-sensitive. Defaults to false.
  • wholeWord: Whether the search matches only on whole words. Defaults to false.
  • range: The Range to search within. Set this to null for the whole document
  • regExp: Whether the search is a regular expression or not. Defaults to false.
  • start: The starting Range or cursor position to begin the search
  • skipCurrent: Whether or not to include the current line in the search. Default to false.

Methods

Searches for options.needle. If found, this method returns the Range where the text first occurs. If options.backwards is true, the search goes backwards in the session.

Searches for options.needle. If found, this method returns the Range where the text first occurs. If options.backwards is true, the search goes backwards in the session.

Arguments

sessionEditSession

Required. The session to search with

Searches for all occurances options.needle. If found, this method returns an array of Ranges where the text first occurs. If options.backwards is true, the search goes backwards in the session.

Searches for all occurances options.needle. If found, this method returns an array of Ranges where the text first occurs. If options.backwards is true, the search goes backwards in the session.

Arguments

sessionEditSession

Required. The session to search with

Returns an object containing all the search options.

Returns an object containing all the search options.

Searches for options.needle in input, and, if found, replaces it with replacement.

Searches for options.needle in input, and, if found, replaces it with replacement.

Arguments

inputString

Required. The text to search in

replacementString

Required. The replacing text

  • (String): If options.regExp is true, this function returns input with the replacement already made. Otherwise, this function just returns replacement.
    If options.needle was not found, this function returns null.

Sets the search options via the options parameter.

Sets the search options via the options parameter.

Arguments

optionsObject

Required. An object containing all the new search properties

    • Search.setOptions()
    • Undocumented
================================================ FILE: api/selection.html ================================================

Contains the cursor position and the text selection of an edit session.

The row/columns used in the selection are in document coordinates representing the coordinates as they appear in the document before applying soft wrap and folding.

Constructors

Creates a new Selection object.

Creates a new Selection object.

Arguments

sessionEditSession

Required. The session to use

Events

    • Selection.on("changeCursor", function())

Emitted when the cursor position changes.

Emitted when the cursor position changes.

    • Selection.on("changeSelection", function())

Emitted when the cursor selection changes.

Emitted when the cursor selection changes.

Methods

    • Selection.addRange(Range range, Boolean $blockChangeEvents)

Adds a range to a selection by entering multiselect mode, if necessary.

Adds a range to a selection by entering multiselect mode, if necessary.

Arguments

rangeRange

Required. The new range to add

$blockChangeEventsBoolean

Required. Whether or not to block changing events

    • Selection.clearSelection()

Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.

Empties the selection (by de-selecting it). This function also emits the 'changeSelection' event.

    • Selection.detach()
    • Undocumented
    • Selection.fromOrientedRange()
    • Undocumented
    • Selection.getAllRanges()

Returns a concatenation of all the ranges.

Returns a concatenation of all the ranges.

    • Selection.getCursor()

Gets the current position of the cursor.

Gets the current position of the cursor.

    • Selection.getLineRange()
    • Undocumented
    • Selection.getRange()

Returns the Range for the selected text.

Returns the Range for the selected text.

    • Selection.getSelectionAnchor()

Returns an object containing the row and column of the calling selection anchor.

Returns an object containing the row and column of the calling selection anchor.

    • Selection.getSelectionLead()

Returns an object containing the row and column of the calling selection lead.

Returns an object containing the row and column of the calling selection lead.

Moves the selection to highlight the entire word.

Moves the selection to highlight the entire word.

Arguments

rowObject

Required.

columnObject

Required.

Returns true if the selection is going backwards in the document.

Returns true if the selection is going backwards in the document.

Returns true if the selection is empty.

Returns true if the selection is empty.

Returns true if the selection is a multi-line.

Returns true if the selection is a multi-line.

    • Selection.mergeOverlappingRanges()

Merges overlapping ranges ensuring consistency after changes

Merges overlapping ranges ensuring consistency after changes

Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.

Moves the cursor to position indicated by the parameters. Negative numbers move the cursor backwards in the document.

Arguments

rowsNumber

Required. The number of rows to move by

charsNumber

Required. The number of characters to move by

    • Selection.moveCursorDown()

Moves the cursor down one row.

Moves the cursor down one row.

    • Selection.moveCursorFileEnd()

Moves the cursor to the end of the file.

Moves the cursor to the end of the file.

    • Selection.moveCursorFileStart()

Moves the cursor to the start of the file.

Moves the cursor to the start of the file.

    • Selection.moveCursorLeft()

Moves the cursor left one column.

Moves the cursor left one column.

    • Selection.moveCursorLineEnd()

Moves the cursor to the end of the line.

Moves the cursor to the end of the line.

    • Selection.moveCursorLineStart()

Moves the cursor to the start of the line.

Moves the cursor to the start of the line.

    • Selection.moveCursorLongWordLeft()

Moves the cursor to the word on the left.

Moves the cursor to the word on the left.

    • Selection.moveCursorLongWordRight()

Moves the cursor to the word on the right.

Moves the cursor to the word on the right.

    • Selection.moveCursorRight()

Moves the cursor right one column.

Moves the cursor right one column.

    • Selection.moveCursorShortWordLeft()
    • Undocumented
    • Selection.moveCursorShortWordRight()
    • Undocumented

Moves the cursor to the row and column provided. If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.

Moves the cursor to the row and column provided. If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.

Arguments

rowNumber

Required. The row to move to

columnNumber

Required. The column to move to

keepDesiredColumnBoolean

Required. If true, the cursor move does not respect the previous column

    • Selection.moveCursorToPosition(Object position)

Moves the selection to the position indicated by its row and column.

Moves the selection to the position indicated by its row and column.

Arguments

positionObject

Required. The position to move to

Moves the cursor to the screen position indicated by row and column. If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.

Moves the cursor to the screen position indicated by row and column. If preventUpdateDesiredColumn is true, then the cursor stays in the same column position as its original point.

Arguments

rowNumber

Required. The row to move to

columnNumber

Required. The column to move to

keepDesiredColumnBoolean

Required. If true, the cursor move does not respect the previous column

    • Selection.moveCursorUp()

Moves the cursor up one row.

Moves the cursor up one row.

    • Selection.moveCursorWordLeft()
    • Undocumented
    • Selection.moveCursorWordRight()
    • Undocumented

Gets list of ranges composing rectangular block on the screen

Gets list of ranges composing rectangular block on the screen

Arguments

screenCursorCursor

Required. The cursor to use

screenAnchorAnchor

Required. The anchor to use

includeEmptyLinesBoolean

Required. If true, this includes ranges inside the block which are empty due to clipping

    • Selection.selectAll()

Selects all the text in the document.

Selects all the text in the document.

    • Selection.selectAWord()

Selects a word, including its right whitespace.

Selects a word, including its right whitespace.

    • Selection.selectDown()

Moves the selection down one row.

Moves the selection down one row.

    • Selection.selectFileEnd()

Moves the selection to the end of the file.

Moves the selection to the end of the file.

    • Selection.selectFileStart()

Moves the selection to the start of the file.

Moves the selection to the start of the file.

    • Selection.selectLeft()

Moves the selection left one column.

Moves the selection left one column.

    • Selection.selectLine()

Selects the entire line.

Selects the entire line.

    • Selection.selectLineEnd()

Moves the selection to the end of the current line.

Moves the selection to the end of the current line.

    • Selection.selectLineStart()

Moves the selection to the beginning of the current line.

Moves the selection to the beginning of the current line.

    • Selection.selectRight()

Moves the selection right one column.

Moves the selection right one column.

Moves the selection cursor to the indicated row and column.

Moves the selection cursor to the indicated row and column.

Arguments

rowNumber

Required. The row to select to

columnNumber

Required. The column to select to

    • Selection.selectToPosition(Object pos)

Moves the selection cursor to the row and column indicated by pos.

Moves the selection cursor to the row and column indicated by pos.

Arguments

posObject

Required. An object containing the row and column

    • Selection.selectUp()

Moves the selection up one row.

Moves the selection up one row.

    • Selection.selectWord()

Selects an entire word boundary.

Selects an entire word boundary.

    • Selection.selectWordLeft()

Moves the selection to the first word on the left.

Moves the selection to the first word on the left.

    • Selection.selectWordRight()

Moves the selection to the first word on the right.

Moves the selection to the first word on the right.

Sets the row and column position of the anchor. This function also emits the 'changeSelection' event.

Sets the row and column position of the anchor. This function also emits the 'changeSelection' event.

Arguments

rowNumber

Required. The new row

columnNumber

Required. The new column

Sets the selection to the provided range.

Sets the selection to the provided range.

Arguments

rangeRange

Required. The range of text to select

reverseBoolean

Required. Indicates if the range should go backwards (true) or not

    • Selection.shiftSelection(Number columns)

Shifts the selection up (or down, if isBackwards() is true) the given number of columns.

Shifts the selection up (or down, if isBackwards() is true) the given number of columns.

Arguments

columnsNumber

Required. The number of columns to shift by

    • Selection.splitIntoLines()

Splits all the ranges into lines.

Splits all the ranges into lines.

    • Selection.substractPoint(Range pos)

Removes a Range containing pos (if it exists).

Removes a Range containing pos (if it exists).

Arguments

posRange

Required. The position to remove, as a {row, column} object

    • Selection.toggleBlockSelection()
    • Undocumented
    • Selection.toOrientedRange()
    • Undocumented
    • Selection.toSingleRange()
    • Undocumented
================================================ FILE: api/split.html ================================================

Methods

    • Split.blur()

Blurs the current editor.

Blurs the current editor.

    • Split.execute()
    • Undocumented
    • Split.focus()

Focuses the current editor.

Focuses the current editor.

Arguments

callbackFunction

Required. A callback function to execute

scopeString

Required. The default scope for the callback

Executes callback on all of the available editors.

    • Split.getCurrentEditor()

Returns the current editor.

Returns the current editor.

    • Undocumented

Arguments

idxNumber

Required. The index of the editor you want

Returns the editor identified by the index idx.

    • Split.getOrientation()

Returns the orientation.

Returns the orientation.

Returns the number of splits.

Returns the number of splits.

    • Split.hasRedo()
    • Undocumented
    • Split.hasUndo()
    • Undocumented
    • Split.redo()
    • Undocumented
    • Split.reset()
    • Undocumented
    • Split.resize()

Resizes the editor.

Resizes the editor.

    • Split.setFontSize(Number size)
    • Undocumented

Arguments

sizeNumber

Required. The new font size

Sets the font size, in pixels, for all the available editors.

    • Split.setKeyboardHandler(String keybinding)
    • Undocumented

Arguments

keybindingString

Required. Sets the keyboard handler for the editor.

    • Split.setOrientation(Number orientation)

Sets the orientation.

Sets the orientation.

Arguments

orientationNumber

Required. The new orientation value

Arguments

sessionEditSession

Required. The new edit session

idxNumber

Required. The editor's index you're interested in

Sets a new EditSession for the indicated editor.

    • Split.setSplits()
    • Undocumented
    • Split.setTheme(String theme)
    • Undocumented

Arguments

themeString

Required. The name of the theme to set

Sets a theme for each of the available editors.

    • Split.undo()
    • Undocumented
    • Split.UndoManagerProxy()
    • Undocumented
================================================ FILE: api/token_iterator.html ================================================

This class provides an essay way to treat the document as a stream of tokens, and provides methods to iterate over these tokens.

Constructors

Creates a new token iterator object. The initial token index is set to the provided row and column coordinates.

Creates a new token iterator object. The initial token index is set to the provided row and column coordinates.

Arguments

sessionEditSession

Required. The session to associate with

initialRowNumber

Required. The row to start the tokenizing at

initialColumnNumber

Required. The column to start the tokenizing at

Methods

    • TokenIterator.getCurrentToken()

Returns the current tokenized string.

Returns the current tokenized string.

    • TokenIterator.getCurrentTokenColumn()

Returns the current column.

Returns the current column.

    • TokenIterator.getCurrentTokenRow()

Returns the current row.

Returns the current row.

    • TokenIterator.stepBackward()

Tokenizes all the items from the current point to the row prior in the document.

Tokenizes all the items from the current point to the row prior in the document.

    • TokenIterator.stepForward()

Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns null. Otherwise, it returns the tokenized string.

Tokenizes all the items from the current point until the next row in the document. If the current point is at the end of the file, this function returns null. Otherwise, it returns the tokenized string.

================================================ FILE: api/tokenizer.html ================================================

Constructors

Constructs a new tokenizer based on the given rules and flags.

Constructs a new tokenizer based on the given rules and flags.

Arguments

rulesObject

Required. The highlighting rules

flagString

Required. Any additional regular expression flags to pass (like "i" for case insensitive)

Methods

Returns an object containing two properties: tokens, which contains all the tokens; and state, the current state.

Returns an object containing two properties: tokens, which contains all the tokens; and state, the current state.

Arguments

lineObject

Required.

startStateObject

Required.

================================================ FILE: api/undomanager.html ================================================

This object maintains the undo stack for an EditSession.

Constructors

    • new UndoManager()

Resets the current undo state and creates a new UndoManager.

Resets the current undo state and creates a new UndoManager.

Methods

    • UndoManager.execute(Object options)

Provides a means for implementing your own undo manager. options has one property, args, an Array, with two elements:

Provides a means for implementing your own undo manager. options has one property, args, an Array, with two elements:

  • args[0] is an array of deltas
  • args[1] is the document to associate with

Arguments

optionsObject

Required. Contains additional properties

Returns true if there are redo operations left to perform.

Returns true if there are redo operations left to perform.

Returns true if there are undo operations left to perform.

Returns true if there are undo operations left to perform.

    • UndoManager.redo(Boolean dontSelect)

Perform a redo operation on the document, reimplementing the last change.

Perform a redo operation on the document, reimplementing the last change.

Arguments

dontSelectBoolean

Required. If true, doesn't select the range of where the change occurred

    • UndoManager.reset()

Destroys the stack of undo and redo redo operations.

Destroys the stack of undo and redo redo operations.

Perform an undo operation on the document, reverting the last change.

Perform an undo operation on the document, reverting the last change.

Arguments

dontSelectBoolean

Required. If true, doesn't select the range of where the change occurred

================================================ FILE: api/virtual_renderer.html ================================================

The class that is responsible for drawing everything you see on the screen!

Constructors

Constructs a new VirtualRenderer within the container specified, applying the given theme.

Constructs a new VirtualRenderer within the container specified, applying the given theme.

Arguments

containerDOMElement

Required. The root element of the editor

themeString

Required. The starting theme

Methods

    • VirtualRenderer._loadTheme()
    • Undocumented
    • VirtualRenderer.adjustWrapLimit()

Adjusts the wrap limit, which is the number of characters that can fit within the width of the edit area on screen.

Adjusts the wrap limit, which is the number of characters that can fit within the width of the edit area on screen.

    • VirtualRenderer.alignCursor()
    • Undocumented
    • VirtualRenderer.animateScrolling()
    • Undocumented
    • VirtualRenderer.destroy()

Destroys the text and cursor layers for this renderer.

Destroys the text and cursor layers for this renderer.

    • VirtualRenderer.getAnimatedScroll()

Returns whether an animated scroll happens or not.

Returns whether an animated scroll happens or not.

    • VirtualRenderer.getContainerElement()

Returns the root element containing this renderer.

Returns the root element containing this renderer.

    • VirtualRenderer.getDisplayIndentGuides()
    • Undocumented
    • VirtualRenderer.getFadeFoldWidgets()
    • Undocumented
    • VirtualRenderer.getFirstFullyVisibleRow()

Returns the index of the first fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.

Returns the index of the first fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.

    • VirtualRenderer.getFirstVisibleRow()

Returns the index of the first visible row.

Returns the index of the first visible row.

    • VirtualRenderer.getHighlightGutterLine()
    • Undocumented
    • VirtualRenderer.getHScrollBarAlwaysVisible()

Returns whether the horizontal scrollbar is set to be always visible.

Returns whether the horizontal scrollbar is set to be always visible.

    • VirtualRenderer.getLastFullyVisibleRow()

Returns the index of the last fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.

Returns the index of the last fully visible row. "Fully" here means that the characters in the row are not truncated; that the top and the bottom of the row are on the screen.

    • VirtualRenderer.getLastVisibleRow()

Returns the index of the last visible row.

Returns the index of the last visible row.

    • VirtualRenderer.getMouseEventTarget()

Returns the element that the mouse events are attached to

Returns the element that the mouse events are attached to

    • VirtualRenderer.getPrintMarginColumn()

Returns whether the print margin column is being shown or not.

Returns whether the print margin column is being shown or not.

    • VirtualRenderer.getScrollBottomRow()

Returns the last visible row, regardless of whether it's fully visible or not.

Returns the last visible row, regardless of whether it's fully visible or not.

    • VirtualRenderer.getScrollLeft()

Returns the value of the distance between the left of the editor and the leftmost part of the visible content.

Returns the value of the distance between the left of the editor and the leftmost part of the visible content.

    • VirtualRenderer.getScrollTop()

Returns the value of the distance between the top of the editor and the topmost part of the visible content.

Returns the value of the distance between the top of the editor and the topmost part of the visible content.

    • VirtualRenderer.getScrollTopRow()

Returns the first visible row, regardless of whether it's fully visible or not.

Returns the first visible row, regardless of whether it's fully visible or not.

    • VirtualRenderer.getShowGutter()

Returns true if the gutter is being shown.

Returns true if the gutter is being shown.

    • VirtualRenderer.getShowInvisibles()

Returns whether invisible characters are being shown or not.

Returns whether invisible characters are being shown or not.

    • VirtualRenderer.getShowPrintMargin()

Returns whether the print margin is being shown or not.

Returns whether the print margin is being shown or not.

    • VirtualRenderer.getTextAreaContainer()

Returns the element to which the hidden text area is added.

Returns the element to which the hidden text area is added.

    • VirtualRenderer.getTheme()

Returns the path of the current theme.

Returns the path of the current theme.

    • VirtualRenderer.hideComposition()

Hides the current composition.

Hides the current composition.

    • VirtualRenderer.hideCursor()

Hides the cursor icon.

Hides the cursor icon.

Returns true if you can still scroll by either parameter; in other words, you haven't reached the end of the file or line.

Returns true if you can still scroll by either parameter; in other words, you haven't reached the end of the file or line.

Arguments

deltaXNumber

Required. The x value to scroll by

deltaYNumber

Required. The y value to scroll by

    • VirtualRenderer.onChangeTabSize()
    • Undocumented
    • VirtualRenderer.onGutterResize()
    • Undocumented

Triggers a resize of the editor.

Triggers a resize of the editor.

Arguments

forceBoolean

Required. If true, recomputes the size, even if the height and width haven't changed

gutterWidthNumber

Required. The width of the gutter in pixels

widthNumber

Required. The width of the editor in pixels

heightNumber

Required. The height of the editor, in pixels

    • VirtualRenderer.pixelToScreenCoordinates()
    • Undocumented
    • VirtualRenderer.screenToTextCoordinates()
    • Undocumented

Scrolls the editor across both x- and y-axes.

Scrolls the editor across both x- and y-axes.

Arguments

deltaXNumber

Required. The x value to scroll by

deltaYNumber

Required. The y value to scroll by

    • VirtualRenderer.scrollCursorIntoView(Object cursor, Object offset)

Scrolls the cursor into the first visible area of the editor

Scrolls the cursor into the first visible area of the editor

Arguments

cursorObject

Required.

offsetObject

Required.

    • VirtualRenderer.scrollSelectionIntoView()
    • Undocumented

Gracefully scrolls the editor to the row indicated.

Gracefully scrolls the editor to the row indicated.

Arguments

lineNumber

Required. A line number

centerBoolean

Required. If true, centers the editor the to indicated line

animateBoolean

Required. If true animates scrolling

callbackFunction

Required. Function to be called after the animation has finished

    • VirtualRenderer.scrollToRow(Number row)

Gracefully scrolls from the top of the editor to the row indicated.

Gracefully scrolls from the top of the editor to the row indicated.

Arguments

rowNumber

Required. A row id

Scrolls the editor across the x-axis to the pixel indicated.

Scrolls the editor across the x-axis to the pixel indicated.

Arguments

scrollLeftNumber

Required. The position to scroll to

Scrolls the editor to the y pixel indicated.

Scrolls the editor to the y pixel indicated.

Arguments

scrollTopNumber

Required. The position to scroll to

    • VirtualRenderer.setAnimatedScroll(Boolean shouldAnimate)

Identifies whether you want to have an animated scroll or not.

Identifies whether you want to have an animated scroll or not.

Arguments

shouldAnimateBoolean

Required. Set to true to show animated scrolls

    • VirtualRenderer.setAnnotations(Array annotations)

Sets annotations for the gutter.

Sets annotations for the gutter.

Arguments

annotationsArray

Required. An array containing annotations

    • VirtualRenderer.setCompositionText(String text)
    • Undocumented

Arguments

textString

Required. A string of text to use

Sets the inner text of the current composition to text.

    • VirtualRenderer.setDisplayIndentGuides()
    • Undocumented
    • VirtualRenderer.setFadeFoldWidgets()
    • Undocumented
    • VirtualRenderer.setHighlightGutterLine()
    • Undocumented
    • VirtualRenderer.setHScrollBarAlwaysVisible(Boolean alwaysVisible)

Identifies whether you want to show the horizontal scrollbar or not.

Identifies whether you want to show the horizontal scrollbar or not.

Arguments

alwaysVisibleBoolean

Required. Set to true to make the horizontal scroll bar visible

    • VirtualRenderer.setPadding(Number padding)

Sets the padding for all the layers.

Sets the padding for all the layers.

Arguments

paddingNumber

Required. A new padding value (in pixels)

    • VirtualRenderer.setPrintMarginColumn(Boolean showPrintMargin)

Identifies whether you want to show the print margin column or not.

Identifies whether you want to show the print margin column or not.

Arguments

showPrintMarginBoolean

Required. Set to true to show the print margin column

    • VirtualRenderer.setShowGutter(Boolean show)

Identifies whether you want to show the gutter or not.

Identifies whether you want to show the gutter or not.

Arguments

showBoolean

Required. Set to true to show the gutter

    • VirtualRenderer.setShowInvisibles(Boolean showInvisibles)

Identifies whether you want to show invisible characters or not.

Identifies whether you want to show invisible characters or not.

Arguments

showInvisiblesBoolean

Required. Set to true to show invisibles

    • VirtualRenderer.setShowPrintMargin(Boolean showPrintMargin)

Identifies whether you want to show the print margin or not.

Identifies whether you want to show the print margin or not.

Arguments

showPrintMarginBoolean

Required. Set to true to show the print margin

    • VirtualRenderer.setStyle()
    • Undocumented
    • VirtualRenderer.setTheme(String theme)

Sets a new theme for the editor. theme should exist, and be a directory path, like ace/theme/textmate.

Sets a new theme for the editor. theme should exist, and be a directory path, like ace/theme/textmate.

Arguments

themeString

Required. The path to a theme

    • VirtualRenderer.showCursor()

Shows the cursor icon.

Shows the cursor icon.

Returns an object containing the pageX and pageY coordinates of the document position.

Returns an object containing the pageX and pageY coordinates of the document position.

Arguments

rowNumber

Required. The document row position

columnNumber

Required. The document column position

    • VirtualRenderer.unsetStyle(String style)

Removes the class style from the editor.

Removes the class style from the editor.

Arguments

styleString

Required. A class name

    • VirtualRenderer.updateBackMarkers()

Schedules an update to all the back markers in the document.

Schedules an update to all the back markers in the document.

    • VirtualRenderer.updateBreakpoints(Object rows)

Redraw breakpoints.

Redraw breakpoints.

Arguments

rowsObject

Required.

    • VirtualRenderer.updateCharacterSize()
    • Undocumented
    • VirtualRenderer.updateCursor()

Updates the cursor icon.

Updates the cursor icon.

    • VirtualRenderer.updateFontSize()

Updates the font size.

Updates the font size.

    • VirtualRenderer.updateFrontMarkers()

Schedules an update to all the front markers in the document.

Schedules an update to all the front markers in the document.

    • VirtualRenderer.updateFull(Boolean force)

Triggers a full update of all the layers, for all the rows.

Triggers a full update of all the layers, for all the rows.

Arguments

forceBoolean

Required. If true, forces the changes through

    • VirtualRenderer.updateLines(Number firstRow, Number lastRow)

Triggers a partial update of the text, from the range given by the two parameters.

Triggers a partial update of the text, from the range given by the two parameters.

Arguments

firstRowNumber

Required. The first row to update

lastRowNumber

Required. The last row to update

    • VirtualRenderer.updateText()

Triggers a full update of the text, for all the rows.

Triggers a full update of the text, for all the rows.

    • VirtualRenderer.visualizeBlur()

Blurs the current container.

Blurs the current container.

    • VirtualRenderer.visualizeFocus()

Focuses the current container.

Focuses the current container.

================================================ FILE: build_support/bookmarklet.html ================================================ Ace Bookmarklet Builder

SourceUrl:


Ace Bookmarklet Builder

WARNING: Currently, this is only supported in non IE browsers.

How to use it:

  • Select the options as you want them to be by default.
  • Enter the "SourceUrl". This has to be the URL pointing to build/textarea/src/ (you can leave the default to server the scripts from GitHub).
  • Click the "Build Link" button to generate your custom Ace Bookmarklet.
  • Drag the generated link to your toolbar or store it somewhere else.
  • Go to a page with a textarea element and click the bookmarklet - wait a little bit till the files are loaded.
  • Click three times on the textarea you want to replace - Ace will replace it.
  • To change settings, just click the red icon in the bottom right corner.
================================================ FILE: build_support/editor.html ================================================ Editor
function foo(items) {
    var i;
    for (i = 0; i < items.length; i++) {
        alert("Ace Rocks " + items[i]);
    }
}
================================================ FILE: build_support/mini_require.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /** * Define a module along with a payload * @param module a name for the payload * @param payload a function to call with (require, exports, module) params */ (function() { var ACE_NAMESPACE = ""; var global = (function() { return this; })(); if (!global && typeof window != "undefined") global = window; // strict mode if (!ACE_NAMESPACE && typeof requirejs !== "undefined") return; var define = function(module, deps, payload) { if (typeof module !== "string") { if (define.original) define.original.apply(this, arguments); else { console.error("dropping module because define wasn\'t a string."); console.trace(); } return; } if (arguments.length == 2) payload = deps; if (!define.modules[module]) { define.payloads[module] = payload; define.modules[module] = null; } }; define.modules = {}; define.payloads = {}; /** * Get at functionality define()ed using the function above */ var _require = function(parentId, module, callback) { if (typeof module === "string") { var payload = lookup(parentId, module); if (payload != undefined) { callback && callback(); return payload; } } else if (Object.prototype.toString.call(module) === "[object Array]") { var params = []; for (var i = 0, l = module.length; i < l; ++i) { var dep = lookup(parentId, module[i]); if (dep == undefined && require.original) return; params.push(dep); } return callback && callback.apply(null, params) || true; } }; var require = function(module, callback) { var packagedModule = _require("", module, callback); if (packagedModule == undefined && require.original) return require.original.apply(this, arguments); return packagedModule; }; var normalizeModule = function(parentId, moduleName) { // normalize plugin requires if (moduleName.indexOf("!") !== -1) { var chunks = moduleName.split("!"); return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]); } // normalize relative requires if (moduleName.charAt(0) == ".") { var base = parentId.split("/").slice(0, -1).join("/"); moduleName = base + "/" + moduleName; while(moduleName.indexOf(".") !== -1 && previous != moduleName) { var previous = moduleName; moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, ""); } } return moduleName; }; /** * Internal function to lookup moduleNames and resolve them by calling the * definition function if needed. */ var lookup = function(parentId, moduleName) { moduleName = normalizeModule(parentId, moduleName); var module = define.modules[moduleName]; if (!module) { module = define.payloads[moduleName]; if (typeof module === 'function') { var exports = {}; var mod = { id: moduleName, uri: '', exports: exports, packaged: true }; var req = function(module, callback) { return _require(moduleName, module, callback); }; var returnValue = module(req, exports, mod); exports = returnValue || mod.exports; define.modules[moduleName] = exports; delete define.payloads[moduleName]; } module = define.modules[moduleName] = exports || module; } return module; }; function exportAce(ns) { var root = global; if (ns) { if (!global[ns]) global[ns] = {}; root = global[ns]; } if (!root.define || !root.define.packaged) { define.original = root.define; root.define = define; root.define.packaged = true; } if (!root.require || !root.require.packaged) { require.original = root.require; root.require = require; root.require.packaged = true; } } exportAce(ACE_NAMESPACE); })(); ================================================ FILE: build_support/style.css ================================================ @import url(//fonts.googleapis.com/css?family=Droid+Sans+Mono); body { margin:0; padding:0; background-color:#e6f5fc; } H2, H3, H4 { font-family:Trebuchet MS; font-weight:bold; margin:0; padding:0; } H2 { font-size:28px; color:#263842; padding-bottom:6px; } H3 { font-family:Trebuchet MS; font-weight:bold; font-size:22px; color:#253741; margin-top:43px; margin-bottom:8px; } H4 { font-family:Trebuchet MS; font-weight:bold; font-size:21px; color:#222222; margin-bottom:4px; } P { padding:13px 0; margin:0; line-height:22px; } UL{ line-height : 22px; } PRE{ background : #333; color : white; padding : 10px; } #header { height : 227px; position:relative; overflow:hidden; background: url(images/background.png) repeat-x 0 0; border-bottom:1px solid #c9e8fa; } #header .content .signature { font-family:Trebuchet MS; font-size:11px; color:#ebe4d6; position:absolute; bottom:5px; right:42px; letter-spacing : 1px; } .content { width:970px; position:relative; margin:0 auto; } #header .content { height:184px; margin-top:22px; } #header .content .logo { width : 282px; height : 184px; background:url(images/logo.png) no-repeat 0 0; position:absolute; top:0; left:0; } #header .content .title { width : 605px; height : 58px; background:url(images/ace.png) no-repeat 0 0; position:absolute; top:98px; left:329px; } #wrapper { background:url(images/body_background.png) repeat-x 0 0; min-height:250px; } #wrapper .content { font-family:Arial; font-size:14px; color:#222222; width:1000px; } #wrapper .content .column1 { position:relative; float:left; width:315px; margin-right:31px; } #wrapper .content .column2 { position:relative; overflow:hidden; float:left; width:600px; padding-top:47px; } .fork_on_github { width:310px; height:80px; background:url(images/fork_on_github.png) no-repeat 0 0; position:relative; overflow:hidden; margin-top:49px; cursor:pointer; } .fork_on_github:hover { background-position:0 -80px; } .divider { height:3px; background-color:#bedaea; margin-bottom:3px; } .menu { padding:23px 0 0 24px; } UL.content-list { padding:15px; margin:0; } UL.menu-list { padding:0; margin:0 0 20px 0; list-style-type:none; line-height : 16px; } UL.menu-list LI { color:#2557b4; font-family:Trebuchet MS; font-size:14px; padding:7px 0; border-bottom:1px dotted #d6e2e7; } UL.menu-list LI:last-child { border-bottom:0; } A { color:#2557b4; text-decoration:none; } A:hover { text-decoration:underline; } P#first{ background : rgba(255,255,255,0.5); padding : 20px; font-size : 16px; line-height : 24px; margin : 0 0 20px 0; } #footer { height:40px; position:relative; overflow:hidden; background:url(images/bottombar.png) repeat-x 0 0; position:relative; margin-top:40px; } UL.menu-footer { padding:0; margin:8px 11px 0 0; list-style-type:none; float:right; } UL.menu-footer LI { color:white; font-family:Arial; font-size:12px; display:inline-block; margin:0 1px; } UL.menu-footer LI A { color:#8dd0ff; text-decoration:none; } UL.menu-footer LI A:hover { text-decoration:underline; } ================================================ FILE: demo/autocompletion.html ================================================ ACE Autocompletion demo













================================================
FILE: demo/autoresize.html
================================================



  
  
  Editor
  


autoresizing editor
minHeight = 2 lines












================================================
FILE: demo/emmet.html
================================================



  
  ACE Emmet demo
  
















================================================
FILE: demo/ie7.html
================================================



  
  
  ACE Editor StatusBar Demo
  



require("ace/ext/old_ie");
// now ace will work even on ie7!
var editor = ace.edit("editor");
================================================ FILE: demo/keyboard_shortcuts.html ================================================ Editor

    








================================================
FILE: demo/kitchen-sink/demo.js
================================================
/* ***** BEGIN LICENSE BLOCK *****
 * Distributed under the BSD license:
 *
 * Copyright (c) 2010, Ajax.org B.V.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Ajax.org B.V. nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ***** END LICENSE BLOCK ***** */


define(function(require, exports, module) {
"use strict";

require("ace/lib/fixoldbrowsers");

require("ace/multi_select");
require("ace/ext/spellcheck");
require("./inline_editor");
require("./dev_util");
require("./file_drop");

var config = require("ace/config");
config.init();
var env = {};

var dom = require("ace/lib/dom");
var net = require("ace/lib/net");
var lang = require("ace/lib/lang");
var useragent = require("ace/lib/useragent");

var event = require("ace/lib/event");
var theme = require("ace/theme/textmate");
var EditSession = require("ace/edit_session").EditSession;
var UndoManager = require("ace/undomanager").UndoManager;

var HashHandler = require("ace/keyboard/hash_handler").HashHandler;

var Renderer = require("ace/virtual_renderer").VirtualRenderer;
var Editor = require("ace/editor").Editor;

var whitespace = require("ace/ext/whitespace");



var doclist = require("./doclist");
var modelist = require("ace/ext/modelist");
var themelist = require("ace/ext/themelist");
var layout = require("./layout");
var TokenTooltip = require("./token_tooltip").TokenTooltip;
var util = require("./util");
var saveOption = util.saveOption;
var fillDropdown = util.fillDropdown;
var bindCheckbox = util.bindCheckbox;
var bindDropdown = util.bindDropdown;

var ElasticTabstopsLite = require("ace/ext/elastic_tabstops_lite").ElasticTabstopsLite;

var IncrementalSearch = require("ace/incremental_search").IncrementalSearch;


var workerModule = require("ace/worker/worker_client");
if (location.href.indexOf("noworker") !== -1) {
    workerModule.WorkerClient = workerModule.UIWorkerClient;
}

/*********** create editor ***************************/
var container = document.getElementById("editor-container");

// Splitting.
var Split = require("ace/split").Split;
var split = new Split(container, theme, 1);
env.editor = split.getEditor(0);
split.on("focus", function(editor) {
    env.editor = editor;
    updateUIEditorOptions();
});
env.split = split;
window.env = env;


var consoleEl = dom.createElement("div");
container.parentNode.appendChild(consoleEl);
consoleEl.style.cssText = "position:fixed; bottom:1px; right:0;\
border:1px solid #baf; z-index:100";

var cmdLine = new layout.singleLineEditor(consoleEl);
cmdLine.editor = env.editor;
env.editor.cmdLine = cmdLine;

env.editor.showCommandLine = function(val) {
    this.cmdLine.focus();
    if (typeof val == "string")
        this.cmdLine.setValue(val, 1);
};

/**
 * This demonstrates how you can define commands and bind shortcuts to them.
 */
env.editor.commands.addCommands([{
    name: "gotoline",
    bindKey: {win: "Ctrl-L", mac: "Command-L"},
    exec: function(editor, line) {
        if (typeof line == "object") {
            var arg = this.name + " " + editor.getCursorPosition().row;
            editor.cmdLine.setValue(arg, 1);
            editor.cmdLine.focus();
            return;
        }
        line = parseInt(line, 10);
        if (!isNaN(line))
            editor.gotoLine(line);
    },
    readOnly: true
}, {
    name: "snippet",
    bindKey: {win: "Alt-C", mac: "Command-Alt-C"},
    exec: function(editor, needle) {
        if (typeof needle == "object") {
            editor.cmdLine.setValue("snippet ", 1);
            editor.cmdLine.focus();
            return;
        }
        var s = snippetManager.getSnippetByName(needle, editor);
        if (s)
            snippetManager.insertSnippet(editor, s.content);
    },
    readOnly: true
}, {
    name: "focusCommandLine",
    bindKey: "shift-esc|ctrl-`",
    exec: function(editor, needle) { editor.cmdLine.focus(); },
    readOnly: true
}, {
    name: "nextFile",
    bindKey: "Ctrl-tab",
    exec: function(editor) { doclist.cycleOpen(editor, 1); },
    readOnly: true
}, {
    name: "previousFile",
    bindKey: "Ctrl-shift-tab",
    exec: function(editor) { doclist.cycleOpen(editor, -1); },
    readOnly: true
}, {
    name: "execute",
    bindKey: "ctrl+enter",
    exec: function(editor) {
        try {
            var r = window.eval(editor.getCopyText() || editor.getValue());
        } catch(e) {
            r = e;
        }
        editor.cmdLine.setValue(r + "");
    },
    readOnly: true
}, {
    name: "showKeyboardShortcuts",
    bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"},
    exec: function(editor) {
        config.loadModule("ace/ext/keybinding_menu", function(module) {
            module.init(editor);
            editor.showKeyboardShortcuts();
        });
    }
}, {
    name: "increaseFontSize",
    bindKey: "Ctrl-=|Ctrl-+",
    exec: function(editor) {
        var size = parseInt(editor.getFontSize(), 10) || 12;
        editor.setFontSize(size + 1);
    }
}, {
    name: "decreaseFontSize",
    bindKey: "Ctrl+-|Ctrl-_",
    exec: function(editor) {
        var size = parseInt(editor.getFontSize(), 10) || 12;
        editor.setFontSize(Math.max(size - 1 || 1));
    }
}, {
    name: "resetFontSize",
    bindKey: "Ctrl+0|Ctrl-Numpad0",
    exec: function(editor) {
        editor.setFontSize(12);
    }
}]);


env.editor.commands.addCommands(whitespace.commands);

cmdLine.commands.bindKeys({
    "Shift-Return|Ctrl-Return|Alt-Return": function(cmdLine) { cmdLine.insert("\n"); },
    "Esc|Shift-Esc": function(cmdLine){ cmdLine.editor.focus(); },
    "Return": function(cmdLine){
        var command = cmdLine.getValue().split(/\s+/);
        var editor = cmdLine.editor;
        editor.commands.exec(command[0], editor, command[1]);
        editor.focus();
    }
});

cmdLine.commands.removeCommands(["find", "gotoline", "findall", "replace", "replaceall"]);

var commands = env.editor.commands;
commands.addCommand({
    name: "save",
    bindKey: {win: "Ctrl-S", mac: "Command-S"},
    exec: function(arg) {
        var session = env.editor.session;
        var name = session.name.match(/[^\/]+$/);
        localStorage.setItem(
            "saved_file:" + name,
            session.getValue()
        );
        env.editor.cmdLine.setValue("saved "+ name);
    }
});

commands.addCommand({
    name: "load",
    bindKey: {win: "Ctrl-O", mac: "Command-O"},
    exec: function(arg) {
        var session = env.editor.session;
        var name = session.name.match(/[^\/]+$/);
        var value = localStorage.getItem("saved_file:" + name);
        if (typeof value == "string") {
            session.setValue(value);
            env.editor.cmdLine.setValue("loaded "+ name);
        } else {
            env.editor.cmdLine.setValue("no previuos value saved for "+ name);
        }
    }
});

var keybindings = {
    ace: null, // Null = use "default" keymapping
    vim: require("ace/keyboard/vim").handler,
    emacs: "ace/keyboard/emacs",
    // This is a way to define simple keyboard remappings
    custom: new HashHandler({
        "gotoright":      "Tab",
        "indent":         "]",
        "outdent":        "[",
        "gotolinestart":  "^",
        "gotolineend":    "$"
    })
};



/*********** manage layout ***************************/
var consoleHeight = 20;
function onResize() {
    var left = env.split.$container.offsetLeft;
    var width = document.documentElement.clientWidth - left;
    container.style.width = width + "px";
    container.style.height = document.documentElement.clientHeight - consoleHeight + "px";
    env.split.resize();

    consoleEl.style.width = width + "px";
    cmdLine.resize();
}

window.onresize = onResize;
onResize();

/*********** options panel ***************************/
var docEl = document.getElementById("doc");
var modeEl = document.getElementById("mode");
var wrapModeEl = document.getElementById("soft_wrap");
var themeEl = document.getElementById("theme");
var foldingEl = document.getElementById("folding");
var selectStyleEl = document.getElementById("select_style");
var highlightActiveEl = document.getElementById("highlight_active");
var showHiddenEl = document.getElementById("show_hidden");
var showGutterEl = document.getElementById("show_gutter");
var showPrintMarginEl = document.getElementById("show_print_margin");
var highlightSelectedWordE = document.getElementById("highlight_selected_word");
var showHScrollEl = document.getElementById("show_hscroll");
var showVScrollEl = document.getElementById("show_vscroll");
var animateScrollEl = document.getElementById("animate_scroll");
var softTabEl = document.getElementById("soft_tab");
var navigateWithinSoftTabEl = document.getElementById("navigate_within_soft_tab");
var behavioursEl = document.getElementById("enable_behaviours");

fillDropdown(docEl, doclist.all);

fillDropdown(modeEl, modelist.modes);
var modesByName = modelist.modesByName;
bindDropdown("mode", function(value) {
    env.editor.session.setMode(modesByName[value].mode || modesByName.text.mode);
    env.editor.session.modeName = value;
});

doclist.history = doclist.docs.map(function(doc) {
    return doc.name;
});
doclist.history.index = 0;
doclist.cycleOpen = function(editor, dir) {
    var h = this.history;
    h.index += dir;
    if (h.index >= h.length)
        h.index = 0;
    else if (h.index <= 0)
        h.index = h.length - 1;
    var s = h[h.index];
    docEl.value = s;
    docEl.onchange();
};
doclist.addToHistory = function(name) {
    var h = this.history;
    var i = h.indexOf(name);
    if (i != h.index) {
        if (i != -1)
            h.splice(i, 1);
        h.index = h.push(name);
    }
};

bindDropdown("doc", function(name) {
    doclist.loadDoc(name, function(session) {
        if (!session)
            return;
        doclist.addToHistory(session.name);
        session = env.split.setSession(session);
        whitespace.detectIndentation(session);
        updateUIEditorOptions();
        env.editor.focus();
    });
});


function updateUIEditorOptions() {
    var editor = env.editor;
    var session = editor.session;

    session.setFoldStyle(foldingEl.value);

    saveOption(docEl, session.name);
    saveOption(modeEl, session.modeName || "text");
    saveOption(wrapModeEl, session.getUseWrapMode() ? session.getWrapLimitRange().min || "free" : "off");

    saveOption(selectStyleEl, editor.getSelectionStyle() == "line");
    saveOption(themeEl, editor.getTheme());
    saveOption(highlightActiveEl, editor.getHighlightActiveLine());
    saveOption(showHiddenEl, editor.getShowInvisibles());
    saveOption(showGutterEl, editor.renderer.getShowGutter());
    saveOption(showPrintMarginEl, editor.renderer.getShowPrintMargin());
    saveOption(highlightSelectedWordE, editor.getHighlightSelectedWord());
    saveOption(showHScrollEl, editor.renderer.getHScrollBarAlwaysVisible());
    saveOption(animateScrollEl, editor.getAnimatedScroll());
    saveOption(softTabEl, session.getUseSoftTabs());
    saveOption(navigateWithinSoftTabEl, session.getNavigateWithinSoftTabs());
    saveOption(behavioursEl, editor.getBehavioursEnabled());
}

themelist.themes.forEach(function(x){ x.value = x.theme });
fillDropdown(themeEl, {
    Bright: themelist.themes.filter(function(x){return !x.isDark}),
    Dark: themelist.themes.filter(function(x){return x.isDark})
});

event.addListener(themeEl, "mouseover", function(e){
    themeEl.desiredValue = e.target.value;
    if (!themeEl.$timer)
        themeEl.$timer = setTimeout(themeEl.updateTheme);
});

event.addListener(themeEl, "mouseout", function(e){
    themeEl.desiredValue = null;
    if (!themeEl.$timer)
        themeEl.$timer = setTimeout(themeEl.updateTheme, 20);
});

themeEl.updateTheme = function(){
    env.split.setTheme((themeEl.desiredValue || themeEl.selectedValue));
    themeEl.$timer = null;
};

bindDropdown("theme", function(value) {
    if (!value)
        return;
    env.editor.setTheme(value);
    themeEl.selectedValue = value;
});

bindDropdown("keybinding", function(value) {
    env.editor.setKeyboardHandler(keybindings[value]);
});

bindDropdown("fontsize", function(value) {
    env.split.setFontSize(value);
});

bindDropdown("folding", function(value) {
    env.editor.session.setFoldStyle(value);
    env.editor.setShowFoldWidgets(value !== "manual");
});

bindDropdown("soft_wrap", function(value) {
    env.editor.setOption("wrap", value);
});

bindCheckbox("select_style", function(checked) {
    env.editor.setOption("selectionStyle", checked ? "line" : "text");
});

bindCheckbox("highlight_active", function(checked) {
    env.editor.setHighlightActiveLine(checked);
});

bindCheckbox("show_hidden", function(checked) {
    env.editor.setShowInvisibles(checked);
});

bindCheckbox("display_indent_guides", function(checked) {
    env.editor.setDisplayIndentGuides(checked);
});

bindCheckbox("show_gutter", function(checked) {
    env.editor.renderer.setShowGutter(checked);
});

bindCheckbox("show_print_margin", function(checked) {
    env.editor.renderer.setShowPrintMargin(checked);
});

bindCheckbox("highlight_selected_word", function(checked) {
    env.editor.setHighlightSelectedWord(checked);
});

bindCheckbox("show_hscroll", function(checked) {
    env.editor.setOption("hScrollBarAlwaysVisible", checked);
});

bindCheckbox("show_vscroll", function(checked) {
    env.editor.setOption("vScrollBarAlwaysVisible", checked);
});

bindCheckbox("animate_scroll", function(checked) {
    env.editor.setAnimatedScroll(checked);
});

bindCheckbox("soft_tab", function(checked) {
    env.editor.session.setUseSoftTabs(checked);
});

bindCheckbox("navigate_within_soft_tab", function(checked) {
    env.editor.session.setNavigateWithinSoftTabs(checked);
});

bindCheckbox("enable_behaviours", function(checked) {
    env.editor.setBehavioursEnabled(checked);
});

bindCheckbox("fade_fold_widgets", function(checked) {
    env.editor.setFadeFoldWidgets(checked);
});
bindCheckbox("read_only", function(checked) {
    env.editor.setReadOnly(checked);
});
bindCheckbox("scrollPastEnd", function(checked) {
    env.editor.setOption("scrollPastEnd", checked);
});

bindDropdown("split", function(value) {
    var sp = env.split;
    if (value == "none") {
        sp.setSplits(1);
    } else {
        var newEditor = (sp.getSplits() == 1);
        sp.setOrientation(value == "below" ? sp.BELOW : sp.BESIDE);
        sp.setSplits(2);

        if (newEditor) {
            var session = sp.getEditor(0).session;
            var newSession = sp.setSession(session, 1);
            newSession.name = session.name;
        }
    }
});


bindCheckbox("elastic_tabstops", function(checked) {
    env.editor.setOption("useElasticTabstops", checked);
});

var iSearchCheckbox = bindCheckbox("isearch", function(checked) {
    env.editor.setOption("useIncrementalSearch", checked);
});

env.editor.addEventListener('incrementalSearchSettingChanged', function(event) {
    iSearchCheckbox.checked = event.isEnabled;
});


function synchroniseScrolling() {
    var s1 = env.split.$editors[0].session;
    var s2 = env.split.$editors[1].session;
    s1.on('changeScrollTop', function(pos) {s2.setScrollTop(pos)});
    s2.on('changeScrollTop', function(pos) {s1.setScrollTop(pos)});
    s1.on('changeScrollLeft', function(pos) {s2.setScrollLeft(pos)});
    s2.on('changeScrollLeft', function(pos) {s1.setScrollLeft(pos)});
}

bindCheckbox("highlight_token", function(checked) {
    var editor = env.editor;
    if (editor.tokenTooltip && !checked) {
        editor.tokenTooltip.destroy();
        delete editor.tokenTooltip;
    } else if (checked) {
        editor.tokenTooltip = new TokenTooltip(editor);
    }
});

var StatusBar = require("ace/ext/statusbar").StatusBar;
new StatusBar(env.editor, cmdLine.container);


var Emmet = require("ace/ext/emmet");
net.loadScript("https://cloud9ide.github.io/emmet-core/emmet.js", function() {
    Emmet.setCore(window.emmet);
    env.editor.setOption("enableEmmet", true);
});


// require("ace/placeholder").PlaceHolder;

var snippetManager = require("ace/snippets").snippetManager;

env.editSnippets = function() {
    var sp = env.split;
    if (sp.getSplits() == 2) {
        sp.setSplits(1);
        return;
    }
    sp.setSplits(1);
    sp.setSplits(2);
    sp.setOrientation(sp.BESIDE);
    var editor = sp.$editors[1];
    var id = sp.$editors[0].session.$mode.$id || "";
    var m = snippetManager.files[id];
    if (!doclist["snippets/" + id]) {
        var text = m.snippetText;
        var s = doclist.initDoc(text, "", {});
        s.setMode("ace/mode/snippets");
        doclist["snippets/" + id] = s;
    }
    editor.on("blur", function() {
        m.snippetText = editor.getValue();
        snippetManager.unregister(m.snippets);
        m.snippets = snippetManager.parseSnippetFile(m.snippetText, m.scope);
        snippetManager.register(m.snippets);
    });
    sp.$editors[0].once("changeMode", function() {
        sp.setSplits(1);
    });
    editor.setSession(doclist["snippets/" + id], 1);
    editor.focus();
};

require("ace/ext/language_tools");
env.editor.setOptions({
    enableBasicAutocompletion: true,
    enableLiveAutocompletion: false,
    enableSnippets: true
});

var beautify = require("ace/ext/beautify");
env.editor.commands.addCommands(beautify.commands);


// global keybindings

var KeyBinding = require("ace/keyboard/keybinding").KeyBinding;
var CommandManager = require("ace/commands/command_manager").CommandManager;
var commandManager = new CommandManager();
var kb = new KeyBinding({
    commands: commandManager,
    fake: true
});
event.addCommandKeyListener(document.documentElement, kb.onCommandKey.bind(kb));
event.addListener(document.documentElement, "keyup", function(e) {
    if (e.keyCode === 18) // do not trigger browser menu on windows
        e.preventDefault();
});
commandManager.addCommands([{
    name: "window-left",
    bindKey: {win: "cmd-alt-left", mac: "ctrl-cmd-left"},
    exec: function() {
        moveFocus();
    }
}, {
    name: "window-right",
    bindKey: {win: "cmd-alt-right", mac: "ctrl-cmd-right"},
    exec: function() {
        moveFocus();
    }
}, {
    name: "window-up",
    bindKey: {win: "cmd-alt-up", mac: "ctrl-cmd-up"},
    exec: function() {
        moveFocus();
    }
}, {
    name: "window-down",
    bindKey: {win: "cmd-alt-down", mac: "ctrl-cmd-down"},
    exec: function() {
        moveFocus();
    }
}]);

function moveFocus() {
    var el = document.activeElement;
    if (el == env.editor.textInput.getElement())
        env.editor.cmdLine.focus();    
    else
        env.editor.focus();
}

});

================================================
FILE: demo/kitchen-sink/dev_util.js
================================================
/* ***** BEGIN LICENSE BLOCK *****
 * Distributed under the BSD license:
 *
 * Copyright (c) 2010, Ajax.org B.V.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Ajax.org B.V. nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ***** END LICENSE BLOCK ***** */

define(function(require, exports, module) {
var dom = require("ace/lib/dom");
var Range = require("ace/range").Range;
function warn() {
    var s = (new Error()).stack || "";
    s = s.split("\n");
    if (s[1] == "Error") s.shift(); // remove error description on chrome
    s.shift(); // remove warn
    s.shift(); // remove the getter
    s = s.join("\n");
    // allow easy access to ace in console, but not in ace code
    if (!/at Object.InjectedScript.|@debugger eval|snippets:\/{3}|:\d+:\d+/.test(s)) {
        console.error("trying to access to global variable");
    }
}
function def(o, key, get) {
    try {
        Object.defineProperty(o, key, {
            configurable: true, 
            get: get,
            set: function(val) {
                delete o[key];
                o[key] = val;
            }
        });
    } catch(e) {
        console.error(e);
    }
}
def(window, "ace", function(){ warn(); return window.env.editor });
def(window, "editor", function(){ warn(); return window.env.editor });
def(window, "session", function(){ warn(); return window.env.editor.session });
def(window, "split", function(){ warn(); return window.env.split });


def(window, "devUtil", function(){ warn(); return exports });
exports.showTextArea = function(argument) {
    dom.importCssString("\
      .ace_text-input {\
        position: absolute;\
        z-index: 10!important;\
        width: 6em!important;\
        height: 1em;\
        opacity: 1!important;\
        background: rgba(0, 92, 255, 0.11);\
        border: none;\
        font: inherit;\
        padding: 0 1px;\
        margin: 0 -1px;\
        text-indent: 0em;\
    }\
    ");
};

exports.addGlobals = function() {
    window.oop = require("ace/lib/oop");
    window.dom = require("ace/lib/dom");
    window.Range = require("ace/range").Range;
    window.Editor = require("ace/editor").Editor;
    window.assert = require("ace/test/asyncjs/assert");
    window.asyncjs = require("ace/test/asyncjs/async");
    window.UndoManager = require("ace/undomanager").UndoManager;
    window.EditSession = require("ace/edit_session").EditSession;
    window.MockRenderer = require("ace/test/mockrenderer").MockRenderer;
    window.EventEmitter = require("ace/lib/event_emitter").EventEmitter;
    
    window.getSelection = getSelection;
    window.setSelection = setSelection;
    window.testSelection = testSelection;
};

function getSelection(editor) {
    var data = editor.multiSelect.toJSON();
    if (!data.length) data = [data];
    data = data.map(function(x) {
        var a, c;
        if (x.isBackwards) {
            a = x.end;
            c = x.start;
        } else {
            c = x.end;
            a = x.start;
        }
        return Range.comparePoints(a, c) 
            ? [a.row, a.column, c.row, c.column]
            : [a.row, a.column];
    });
    return data.length > 1 ? data : data[0];
}
function setSelection(editor, data) {
    if (typeof data[0] == "number")
        data = [data];
    editor.selection.fromJSON(data.map(function(x) {
        var start = {row: x[0], column: x[1]};
        var end = x.length == 2 ? start : {row: x[2], column: x[3]};
        var isBackwards = Range.comparePoints(start, end) > 0;
        return isBackwards ? {
            start: end,
            end: start,
            isBackwards: true
        } : {
            start: start,
            end: end,
            isBackwards: true
        };
    }));
}
function testSelection(editor, data) {
    assert.equal(getSelection(editor) + "", data + "");
}

exports.recordTestCase = function() {
    exports.addGlobals();
    var editor = window.editor;
    var testcase = window.testcase = [];
    var assert;

    testcase.push({
        type: "setValue",
        data: editor.getValue()
    }, {
        type: "setSelection",
        data: getSelection(editor)
    });
    editor.commands.on("afterExec", function(e) {
        testcase.push({
            type: "exec",
            data: e
        });
        testcase.push({
            type: "value",
            data: editor.getValue()
        });
        testcase.push({
            type: "selection",
            data: getSelection(editor)
        });
    });
    editor.on("mouseup", function() {
        testcase.push({
            type: "setSelection",
            data: getSelection(editor)
        });
    });
    
    testcase.toString = function() {
        var lastValue = "";
        // var lastSelection = ""
        var str = this.map(function(x) {
            var data = x.data;
            switch (x.type) {
                case "exec": 
                    return 'editor.execCommand("' 
                        + data.command.name
                        + (data.args ? '", ' + JSON.stringify(data.args) : '"')
                    + ')';
                case "setSelection":
                    return 'setSelection(editor, ' + JSON.stringify(data)  + ')';
                case "setValue":
                    if (lastValue != data) {
                        lastValue = data;
                        return 'editor.setValue(' + JSON.stringify(data) + ', -1)';
                    }
                    return;
                case "selection":
                    return 'testSelection(editor, ' + JSON.stringify(data) + ')';
                case "value":
                    if (lastValue != data) {
                        lastValue = data;
                        return 'assert.equal('
                            + 'editor.getValue(),'
                            + JSON.stringify(data)
                        + ')';
                    }
                    return;
            }
        }).filter(Boolean).join("\n");
        
        return getSelection + "\n"
            + testSelection + "\n"
            + setSelection + "\n"
            + "\n" + str + "\n";
    };
};


});


================================================
FILE: demo/kitchen-sink/doclist.js
================================================
/* ***** BEGIN LICENSE BLOCK *****
 * Distributed under the BSD license:
 *
 * Copyright (c) 2010, Ajax.org B.V.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *     * Redistributions in binary form must reproduce the above copyright
 *       notice, this list of conditions and the following disclaimer in the
 *       documentation and/or other materials provided with the distribution.
 *     * Neither the name of Ajax.org B.V. nor the
 *       names of its contributors may be used to endorse or promote products
 *       derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 * ***** END LICENSE BLOCK ***** */

 define(function(require, exports, module) {
"use strict";

var EditSession = require("ace/edit_session").EditSession;
var UndoManager = require("ace/undomanager").UndoManager;
var net = require("ace/lib/net");

var modelist = require("ace/ext/modelist");
/*********** demo documents ***************************/
var fileCache = {};

function initDoc(file, path, doc) {
    if (doc.prepare)
        file = doc.prepare(file);

    var session = new EditSession(file);
    session.setUndoManager(new UndoManager());
    doc.session = session;
    doc.path = path;
    session.name = doc.name;
    if (doc.wrapped) {
        session.setUseWrapMode(true);
        session.setWrapLimitRange(80, 80);
    }
    var mode = modelist.getModeForPath(path);
    session.modeName = mode.name;
    session.setMode(mode.mode);
    return session;
}


function makeHuge(txt) {
    for (var i = 0; i < 5; i++)
        txt += txt;
    return txt;
}

var docs = {
    "docs/javascript.js": {order: 1, name: "JavaScript"},

    "docs/latex.tex": {name: "LaTeX", wrapped: true},
    "docs/markdown.md": {name: "Markdown", wrapped: true},
    "docs/mushcode.mc": {name: "MUSHCode", wrapped: true},
    "docs/pgsql.pgsql": {name: "pgSQL", wrapped: true},
    "docs/plaintext.txt": {name: "Plain Text", prepare: makeHuge, wrapped: true},
    "docs/sql.sql": {name: "SQL", wrapped: true},

    "docs/textile.textile": {name: "Textile", wrapped: true},

    "docs/c9search.c9search_results": "C9 Search Results",
    "docs/mel.mel": "MEL",
    "docs/Nix.nix": "Nix"
};

var ownSource = {
    /* filled from require*/
};

var hugeDocs = require.toUrl ? {
    "build/src/ace.js": "",
    "build/src-min/ace.js": ""
} : {
    "src/ace.js": "",
    "src-min/ace.js": ""
};

modelist.modes.forEach(function(m) {
    var ext = m.extensions.split("|")[0];
    if (ext[0] === "^") {
        path = ext.substr(1);
    } else {
        var path = m.name + "." + ext;
    }
    path = "docs/" + path;
    if (!docs[path]) {
        docs[path] = {name: m.caption};
    } else if (typeof docs[path] == "object" && !docs[path].name) {
        docs[path].name = m.caption;
    }
});



if (window.require && window.require.s) try {
    for (var path in window.require.s.contexts._.defined) {
        if (path.indexOf("!") != -1)
            path = path.split("!").pop();
        else
            path = path + ".js";
        ownSource[path] = "";
    }
} catch(e) {}

function sort(list) {
    return list.sort(function(a, b) {
        var cmp = (b.order || 0) - (a.order || 0);
        return cmp || a.name && a.name.localeCompare(b.name);
    });
}

function prepareDocList(docs) {
    var list = [];
    for (var path in docs) {
        var doc = docs[path];
        if (typeof doc != "object")
            doc = {name: doc || path};

        doc.path = path;
        doc.desc = doc.name.replace(/^(ace|docs|demo|build)\//, "");
        if (doc.desc.length > 18)
            doc.desc = doc.desc.slice(0, 7) + ".." + doc.desc.slice(-9);

        fileCache[doc.name] = doc;
        list.push(doc);
    }

    return list;
}

function loadDoc(name, callback) {
    var doc = fileCache[name];
    if (!doc)
        return callback(null);

    if (doc.session)
        return callback(doc.session);

    // TODO: show load screen while waiting
    var path = doc.path;
    var parts = path.split("/");
    if (parts[0] == "docs")
        path = "demo/kitchen-sink/" + path;
    else if (parts[0] == "ace")
        path = "lib/" + path;

    net.get(path, function(x) {
        initDoc(x, path, doc);
        callback(doc.session);
    });
}

function saveDoc(name, callback) {
    var doc = fileCache[name] || name;
    if (!doc || !doc.session)
        return callback("Unknown document: " + name);

    var path = doc.path;
    var parts = path.split("/");
    if (parts[0] == "docs")
        path = "demo/kitchen-sink/" + path;
    else if (parts[0] == "ace")
        path = "lib/" + path;

    upload(path, doc.session.getValue(), callback);
}

function upload(url, data, callback) {
    var absUrl = net.qualifyURL(url);
    if (/^file:/.test(absUrl))
        absUrl = "http://localhost:8888/" + url;
    url = absUrl
    if (!/^https?:/.test(url))
        return callback(new Error("Unsupported url scheme"));
    var xhr = new XMLHttpRequest();
    xhr.open("PUT", url, true);
    xhr.onreadystatechange = function () {
        if (xhr.readyState === 4) {
            callback(!/^2../.test(xhr.status));
        }
    };
    xhr.send(data);
};


module.exports = {
    fileCache: fileCache,
    docs: sort(prepareDocList(docs)),
    ownSource: prepareDocList(ownSource),
    hugeDocs: prepareDocList(hugeDocs),
    initDoc: initDoc,
    loadDoc: loadDoc,
    saveDoc: saveDoc
};
module.exports.all = {
    "Mode Examples": module.exports.docs,
    "Huge documents": module.exports.hugeDocs,
    "own source": module.exports.ownSource
};

});



================================================
FILE: demo/kitchen-sink/docs/Dockerfile
================================================
#
# example Dockerfile for http://docs.docker.io/en/latest/examples/postgresql_service/
#

FROM ubuntu
MAINTAINER SvenDowideit@docker.com

# Add the PostgreSQL PGP key to verify their Debian packages.
# It should be the same key as https://www.postgresql.org/media/keys/ACCC4CF8.asc 
RUN apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys B97B0AFCAA1A47F044F244A07FCC7D46ACCC4CF8

# Add PostgreSQL's repository. It contains the most recent stable release
#     of PostgreSQL, ``9.3``.
RUN echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" > /etc/apt/sources.list.d/pgdg.list

# Update the Ubuntu and PostgreSQL repository indexes
RUN apt-get update

# Install ``python-software-properties``, ``software-properties-common`` and PostgreSQL 9.3
#  There are some warnings (in red) that show up during the build. You can hide
#  them by prefixing each apt-get statement with DEBIAN_FRONTEND=noninteractive
RUN apt-get -y -q install python-software-properties software-properties-common
RUN apt-get -y -q install postgresql-9.3 postgresql-client-9.3 postgresql-contrib-9.3

# Note: The official Debian and Ubuntu images automatically ``apt-get clean``
# after each ``apt-get`` 

# Run the rest of the commands as the ``postgres`` user created by the ``postgres-9.3`` package when it was ``apt-get installed``
USER postgres

# Create a PostgreSQL role named ``docker`` with ``docker`` as the password and
# then create a database `docker` owned by the ``docker`` role.
# Note: here we use ``&&\`` to run commands one after the other - the ``\``
#       allows the RUN command to span multiple lines.
RUN    /etc/init.d/postgresql start &&\
    psql --command "CREATE USER docker WITH SUPERUSER PASSWORD 'docker';" &&\
    createdb -O docker docker

# Adjust PostgreSQL configuration so that remote connections to the
# database are possible. 
RUN echo "host all  all    0.0.0.0/0  md5" >> /etc/postgresql/9.3/main/pg_hba.conf

# And add ``listen_addresses`` to ``/etc/postgresql/9.3/main/postgresql.conf``
RUN echo "listen_addresses='*'" >> /etc/postgresql/9.3/main/postgresql.conf

# Expose the PostgreSQL port
EXPOSE 5432

# Add VOLUMEs to allow backup of config, logs and databases
VOLUME	["/etc/postgresql", "/var/log/postgresql", "/var/lib/postgresql"]

# Set the default command to run when starting the container
CMD ["/usr/lib/postgresql/9.3/bin/postgres", "-D", "/var/lib/postgresql/9.3/main", "-c", "config_file=/etc/postgresql/9.3/main/postgresql.conf"]

================================================
FILE: demo/kitchen-sink/docs/Haxe.hx
================================================
class Haxe 
{
    public static function main() 
    {
        // Say Hello!
        var greeting:String = "Hello World";
        trace(greeting);
        
        var targets:Array = ["Flash","Javascript","PHP","Neko","C++","iOS","Android","webOS"];
        trace("Haxe is a great language that can target:");
        for (target in targets)
        {
            trace (" - " + target);
        }
        trace("And many more!");
    }
}

================================================
FILE: demo/kitchen-sink/docs/Jack.jack
================================================
vars it, p

p = {label, value|
  print("\n" + label)
  print(inspect(value))
}
-- Create an array from 0 to 15
p("range", i-collect(range(5)))

-- Create an array from 0 to 15 and break up in chunks of 4
p("chunked range", i-collect(i-chunk(4, range(16))))

-- Check if all or none items in stream pass test.
p("all < 60 in range(60)", i-all?({i|i<60}, range(60)))
p("any < 60 in range(60)", i-any?({i|i>60}, range(60)))
p("all < 60 in range(70)", i-all?({i|i<60}, range(70)))
p("any < 60 in range(70)", i-any?({i|i>60}, range(70)))

-- Zip three different collections together
p("zipped", i-collect(i-zip(
  range(10),
  [1,2,3,4,5],
  i-map({i|i*i}, range(10))
)))

vars names, person, i, doubles, lengths, cubeRange
names = ["Thorin", "Dwalin", "Balin", "Bifur", "Bofur", "Bombur", "Oin",
         "Gloin", "Ori", "Nori", "Dori", "Fili", "Kili", "Bilbo", "Gandalf"]

for name in names {
  if name != "Bilbo" && name != "Gandalf" {
    print(name)
  }
}

person = {name: "Tim", age: 30}
for key, value in person {
  print(key + " = " + value)
}

i = 0
while i < 10 {
  i = i + 1
  print(i)
}

print("range")
for i in range(10) {
  print(i + 1)
}
for i in range(10) {
  print(10 - i)
}

-- Dynamic object that gives the first 10 doubles
doubles = {
  @len: {| 10 }
  @get: {key|
    if key is Integer { key * key }
  }
}
print("#doubles", #doubles)

print("Doubles")
for k, v in doubles {
  print([k, v])
}

-- Dynamic object that has names list as keys and string lenth as values
lengths = {
  @keys: {| names }
  @get: {key|
    if key is String { #key }
  }
}

print ("Lengths")
for k, v in lengths {
  print([k, v])
}


cubeRange = {n|
  vars i, v
  i = 0
  {
    @call: {|
      v = i
      i = i + 1
      if v < n { v * v * v }
    }
  }
}

print("Cubes")
for k, v in cubeRange(5) {
  print([k, v])
}
print("String")
for k, v in "Hello World" {
  print([k, v])
}


print([i for i in range(10)])
print([i for i in range(20) if i % 3])



-- Example showing how to do parallel work using split..and
base = {bootstrap, target-dir|
  split {
    copy("res", target-dir)
  } and {
    if newer("src/*.less", target-dir + "/style.css") {
      lessc("src/" + bootstrap + ".less", target-dir + "/style.css")
    }
  } and {
    build("src/" + bootstrap + ".js", target-dir + "/app.js")
  }
}


vars Dragon, pet

Dragon = {name|
  vars asleep, stuff-in-belly, stuff-in-intestine,
       feed, walk, put-to-bed, toss, rock,
       hungry?, poopy?, passage-of-time

  asleep = false
  stuff-in-belly     = 10 -- He's full.
  stuff-in-intestine =  0 -- He doesn't need to go.

  print(name + ' is born.')

  feed = {|
    print('You feed ' + name + '.')
    stuff-in-belly = 10
    passage-of-time()
  }

  walk = {|
    print('You walk ' + name + ".")
    stuff-in-intestine = 0
    passage-of-time
  }

  put-to-bed = {|
    print('You put ' + name + ' to bed.')
    asleep = true
    for i in range(3) {
      if asleep {
        passage-of-time()
      }
      if asleep {
        print(name + ' snores, filling the room with smoke.')
      }
    }
    if asleep {
      asleep = false
      print(name + ' wakes up slowly.')
    }
  }

  toss = {|
    print('You toss ' + name + ' up into the air.')
    print('He giggles, which singes your eyebrows.')
    passage-of-time()
  }

  rock = {|
    print('You rock ' + name + ' gently.')
    asleep = true
    print('He briefly dozes off...')
    passage-of-time()
    if asleep {
      asleep = false
      print('...but wakes when you stop.')
    }
  }

  hungry? = {|
    stuff-in-belly <= 2
  }

  poopy? = {|
    stuff-in-intestine >= 8
  }

  passage-of-time = {|
    if stuff-in-belly > 0 {
      -- Move food from belly to intestine
      stuff-in-belly     = stuff-in-belly     - 1
      stuff-in-intestine = stuff-in-intestine + 1
    } else { -- Our dragon is starving!
      if asleep {
        asleep = false
        print('He wakes up suddenly!')
      }
      print(name + ' is starving! In desperation, he ate YOU!')
      abort "died"
    }

    if stuff-in-intestine >= 10 {
      stuff-in-intestine = 0
      print('Whoops! ' + name + ' had an accident...')
    }

    if hungry?() {
      if asleep {
        asleep = false
        print('He wakes up suddenly!')
      }
      print(name + "'s stomach grumbles...")
    }

    if poopy?() {
      if asleep {
        asleep = false
        print('He wakes up suddenly!')
      }
      print(name + ' does the potty dance...')
    }
  }

  -- Export the public interface to this closure object.
  {
   feed: feed
   walk: walk
   put-to-bed: put-to-bed
   toss: toss
   rock: rock
  }

}

pet = Dragon('Norbert')
pet.feed()
pet.toss()
pet.walk()
pet.put-to-bed()
pet.rock()
pet.put-to-bed()
pet.put-to-bed()
pet.put-to-bed()
pet.put-to-bed()


================================================
FILE: demo/kitchen-sink/docs/Makefile
================================================
.PHONY:    apf ext worker mode theme package test

default: apf worker

update: worker

# packages apf

# This is the first line of a comment \
and this is still part of the comment \
as is this, since I keep ending each line \
with a backslash character

apf:
    cd node_modules/packager; node package.js projects/apf_cloud9.apr
	cd node_modules/packager; cat build/apf_release.js | sed 's/\(\/\*FILEHEAD(\).*//g' > ../../plugins-client/lib.apf/www/apf-packaged/apf_release.js

# package debug version of apf
apfdebug:
	cd node_modules/packager/projects; cat apf_cloud9.apr | sed 's///g' > apf_cloud9_debug2.apr
	cd node_modules/packager/projects; cat apf_cloud9_debug2.apr | sed 's/apf_release/apf_debug/g' > apf_cloud9_debug.apr; rm apf_cloud9_debug2.apr
	cd node_modules/packager; node package.js projects/apf_cloud9_debug.apr
	cd node_modules/packager; cat build/apf_debug.js | sed 's/\(\/\*FILEHEAD(\).*\/apf\/\(.*\)/\1\2/g' > ../../plugins-client/lib.apf/www/apf-packaged/apf_debug.js

# package_apf--temporary fix for non-workering infra
pack_apf:
	mkdir -p build/src
	mv plugins-client/lib.apf/www/apf-packaged/apf_release.js build/src/apf_release.js
	node build/r.js -o name=./build/src/apf_release.js out=./plugins-client/lib.apf/www/apf-packaged/apf_release.js baseUrl=.

# makes ace; at the moment, requires dryice@0.4.2
ace:
	cd node_modules/ace; make clean pre_build; ./Makefile.dryice.js minimal


# packages core
core: ace
	mkdir -p build/src
	node build/r.js -o build/core.build.js

# generates packed template
helper: 
	node build/packed_helper.js

helper_clean:
	mkdir -p build/src
	node build/packed_helper.js 1

# packages ext
ext: 
	node build/r.js -o build/app.build.js

# calls dryice on worker & packages it
worker: plugins-client/lib.ace/www/worker/worker-language.js

plugins-client/lib.ace/www/worker/worker-language.js plugins-client/lib.ace/www/worker/worker-javascript.js : \
        $(wildcard node_modules/ace/*) $(wildcard node_modules/ace/*/*) $(wildcard node_modules/ace/*/*/mode/*) \
        $(wildcard plugins-client/ext.language/*) \
        $(wildcard plugins-client/ext.language/*/*) \
        $(wildcard plugins-client/ext.linereport/*) \
        $(wildcard plugins-client/ext.codecomplete/*) \
        $(wildcard plugins-client/ext.codecomplete/*/*) \
        $(wildcard plugins-client/ext.jslanguage/*) \
        $(wildcard plugins-client/ext.jslanguage/*/*) \
        $(wildcard plugins-client/ext.csslanguage/*) \
        $(wildcard plugins-client/ext.csslanguage/*/*) \
        $(wildcard plugins-client/ext.htmllanguage/*) \
        $(wildcard plugins-client/ext.htmllanguage/*/*) \
        $(wildcard plugins-client/ext.jsinfer/*) \
        $(wildcard plugins-client/ext.jsinfer/*/*) \
        $(wildcard node_modules/treehugger/lib/*) \
        $(wildcard node_modules/treehugger/lib/*/*) \
        $(wildcard node_modules/ace/lib/*) \
        $(wildcard node_modules/ace/*/*) \
        Makefile.dryice.js
	mkdir -p plugins-client/lib.ace/www/worker
	rm -rf /tmp/c9_worker_build
	mkdir -p /tmp/c9_worker_build/ext
	ln -s `pwd`/plugins-client/ext.language /tmp/c9_worker_build/ext/language
	ln -s `pwd`/plugins-client/ext.codecomplete /tmp/c9_worker_build/ext/codecomplete
	ln -s `pwd`/plugins-client/ext.jslanguage /tmp/c9_worker_build/ext/jslanguage
	ln -s `pwd`/plugins-client/ext.csslanguage /tmp/c9_worker_build/ext/csslanguage
	ln -s `pwd`/plugins-client/ext.htmllanguage /tmp/c9_worker_build/ext/htmllanguage
	ln -s `pwd`/plugins-client/ext.linereport /tmp/c9_worker_build/ext/linereport
	ln -s `pwd`/plugins-client/ext.linereport_php /tmp/c9_worker_build/ext/linereport_php
	node Makefile.dryice.js worker
	cp node_modules/ace/build/src/worker* plugins-client/lib.ace/www/worker

define 

ifeq

override

# copies built ace modes
mode:
	mkdir -p plugins-client/lib.ace/www/mode
	cp `find node_modules/ace/build/src | grep -E "mode-[a-zA-Z_0-9]+.js"`  plugins-client/lib.ace/www/mode

# copies built ace themes
theme:
	mkdir -p plugins-client/lib.ace/www/theme
	cp `find node_modules/ace/build/src | grep -E "theme-[a-zA-Z_0-9]+.js"` plugins-client/lib.ace/www/theme

gzip_safe:
	for i in `ls ./plugins-client/lib.packed/www/*.js`; do \
		gzip -9 -v -c -q -f $$i > $$i.gz ; \
	done

gzip:
	for i in `ls ./plugins-client/lib.packed/www/*.js`; do \
		gzip -9 -v -q -f $$i ; \
	done

c9core: apf ace core worker mode theme
    
package_clean: helper_clean c9core ext

package: helper c9core ext

test check:
	test/run-tests.sh	

================================================
FILE: demo/kitchen-sink/docs/Nix.nix
================================================
{
  # Name of our deployment
  network.description = "HelloWorld";
  # Enable rolling back to previous versions of our infrastructure
  network.enableRollback = true;

  # It consists of a single server named 'helloserver'
  helloserver =
    # Every server gets passed a few arguments, including a reference
    # to nixpkgs (pkgs)
    { config, pkgs, ... }:
    let
      # We import our custom packages from ./default passing pkgs as argument
      packages = import ./default.nix { pkgs = pkgs; };
      # This is the nodejs version specified in default.nix
      nodejs   = packages.nodejs;
      # And this is the application we'd like to deploy
      app      = packages.app;
    in
    {
      # We'll be running our application on port 8080, because a regular
      # user cannot bind to port 80
      # Then, using some iptables magic we'll forward traffic designated to port 80 to 8080
      networking.firewall.enable = true;
      # We will open up port 22 (SSH) as well otherwise we're locking ourselves out
      networking.firewall.allowedTCPPorts = [ 80 8080 22 ];
      networking.firewall.allowPing = true;

      # Port forwarding using iptables
      networking.firewall.extraCommands = ''
        iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
      '';

      # To run our node.js program we're going to use a systemd service
      # We can configure the service to automatically start on boot and to restart
      # the process in case it crashes
      systemd.services.helloserver = {
        description = "Hello world application";
        # Start the service after the network is available
        after = [ "network.target" ];
        # We're going to run it on port 8080 in production
        environment = { PORT = "8080"; };
        serviceConfig = {
          # The actual command to run
          ExecStart = "${nodejs}/bin/node ${app}/server.js";
          # For security reasons we'll run this process as a special 'nodejs' user
          User = "nodejs";
          Restart = "always";
        };
      };

      # And lastly we ensure the user we run our application as is created
      users.extraUsers = {
        nodejs = { };
      };
    };
}

================================================
FILE: demo/kitchen-sink/docs/abap.abap
================================================
***************************************
** Program: EXAMPLE                  **
** Author: Joe Byte, 07-Jul-2007     **
***************************************
 
REPORT BOOKINGS.
 
* Read flight bookings from the database
SELECT * FROM FLIGHTINFO
  WHERE CLASS = 'Y'       "Y = economy
  OR    CLASS = 'C'.      "C = business
(...)

REPORT TEST.
WRITE 'Hello World'.

USERPROMPT = 'Please double-click on a line in the output list ' &
             'to see the complete details of the transaction.'.


DATA LAST_EOM    TYPE D.  "last end-of-month date
 
* Start from today's date
  LAST_EOM = SY-DATUM.
* Set characters 6 and 7 (0-relative) of the YYYYMMDD string to "01",
* giving the first day of the current month
  LAST_EOM+6(2) = '01'.
* Subtract one day
  LAST_EOM = LAST_EOM - 1.
 
  WRITE: 'Last day of previous month was', LAST_EOM.
  
DATA : BEGIN OF I_VBRK OCCURS 0,
         VBELN LIKE VBRK-VBELN,
         ZUONR LIKE VBRK-ZUONR,
       END OF I_VBRK.

SORT i_vbrk BY vbeln ASCENDING.
SORT i_vbrk BY vbeln DESCENDING.

RETURN.

================================================
FILE: demo/kitchen-sink/docs/abc.abc
================================================
%abc-2.1
H:This file contains some example English tunes
% note that the comments (like this one) are to highlight usages
%  and would not normally be included in such detail
O:England             % the origin of all tunes is England

X:1                   % tune no 1
T:Dusty Miller, The   % title
T:Binny's Jig         % an alternative title
C:Trad.               % traditional
R:DH                  % double hornpipe
M:3/4                 % meter
K:G                   % key
B>cd BAG|FA Ac BA|B>cd BAG|DG GB AG:|
Bdd gfg|aA Ac BA|Bdd gfa|gG GB AG:|
BG G/2G/2G BG|FA Ac BA|BG G/2G/2G BG|DG GB AG:|
W:Hey, the dusty miller, and his dusty coat;
W:He will win a shilling, or he spend a groat.
W:Dusty was the coat, dusty was the colour;
W:Dusty was the kiss, that I got frae the miller.

X:2
T:Old Sir Simon the King
C:Trad.
S:Offord MSS          % from Offord manuscript
N:see also Playford   % reference note
M:9/8
R:SJ                  % slip jig
N:originally in C     % transcription note
K:G
D|GFG GAG G2D|GFG GAG F2D|EFE EFE EFG|A2G F2E D2:|
D|GAG GAB d2D|GAG GAB c2D|[1 EFE EFE EFG|[A2G] F2E D2:|\ % no line-break in score
M:12/8                % change of meter
[2 E2E EFE E2E EFG|\  % no line-break in score
M:9/8                 % change of meter
A2G F2E D2|]

X:3
T:William and Nancy
T:New Mown Hay
T:Legacy, The
C:Trad.
O:England; Gloucs; Bledington % place of origin
B:Sussex Tune Book            % can be found in these books
B:Mally's Cotswold Morris vol.1 2
D:Morris On                   % can be heard on this record
P:(AB)2(AC)2A                 % play the parts in this order
M:6/8
K:G                        
[P:A] D|"G"G2G GBd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
[P:B] d|"G"e2d B2d|"C"gfe "G"d2d| "G"e2d    B2d|"C"gfe    "D7"d2c|
        "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|
% changes of meter, using inline fields
[T:Slows][M:4/4][L:1/4][P:C]"G"d2|"C"e2 "G"d2|B2 d2|"Em"gf "A7"e2|"D7"d2 "G"d2|\
       "C"e2 "G"d2|[M:3/8][L:1/8] "G"B2 d |[M:6/8] "C"gfe "D7"d2c|
        "G"B2B Bcd|"C"e2e "G"dBG|"D7"A2d "G"BAG|"C"E2"D7"F "G"G2:|

X:4
T:South Downs Jig
R:jig
S:Robert Harbron
M:6/8
L:1/8
K:G
|: d | dcA G3 | EFG AFE | DEF GAB | cde d2d |
dcA G3 | EFG AFE | DEF GAB | cAF G2 :|
B | Bcd e2c | d2B c2A | Bcd e2c | [M:9/8]d2B c2B A3 |
[M:6/8]DGF E3 | cBA FED | DEF GAB |1 cAF G2 :|2 cAF G3 |]

X:5
T:Atholl Brose
% in this example, which reproduces Highland Bagpipe gracing,
%  the large number of grace notes mean that it is more convenient to be specific about
%  score line-breaks (using the $ symbol), rather than using code line breaks to indicate them
I:linebreak $
K:D
{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad|
{gcd}c<{e}A {gAGAG}A>e {ag}a>f {gef}e>d|
{gcd}c<{e}A {gAGAG}A2 {gef}e>A {gAGAG}Ad|
{g}c/d/e {g}G>{d}B {gf}gG {dc}d>B:|$
{g}ce {ag}a>e {gf}g>e|
{g}ce {ag}a2 {GdG}a>d|
{g}ce {ag}a>e {gf}g>f|
{gef}e>d {gf}g>d {gBd}B<{e}G {dc}d>B|
{g}ce {ag}a>e {gf}g>e|
{g}ce {ag}a2 {GdG}ad|
{g}c<{GdG}e {gf}ga {f}g>e {g}f>d|
{g}e/f/g {Gdc}d>c {gBd}B<{e}G {dc}d2|]

X:6
T:Untitled Reel
C:Trad.
K:D
eg|a2ab ageg|agbg agef|g2g2 fgag|f2d2 d2:|\
ed|cecA B2ed|cAcA E2ed|cecA B2ed|c2A2 A2:|
K:G
AB|cdec BcdB|ABAF GFE2|cdec BcdB|c2A2 A2:|

X:7
T:Kitchen Girl
C:Trad.
K:D
[c4a4] [B4g4]|efed c2cd|e2f2 gaba|g2e2 e2fg|
a4 g4|efed cdef|g2d2 efed|c2A2 A4:|
K:G
ABcA BAGB|ABAG EDEG|A2AB c2d2|e3f edcB|ABcA BAGB|
ABAG EGAB|cBAc BAG2|A4 A4:|

%abc-2.1
%%pagewidth      21cm
%%pageheight     29.7cm
%%topspace       0.5cm
%%topmargin      1cm
%%botmargin      0cm
%%leftmargin     1cm
%%rightmargin    1cm
%%titlespace     0cm
%%titlefont      Times-Bold 32
%%subtitlefont   Times-Bold 24
%%composerfont   Times 16
%%vocalfont      Times-Roman 14
%%staffsep       60pt
%%sysstaffsep    20pt
%%musicspace     1cm
%%vocalspace     5pt
%%measurenb      0
%%barsperstaff   5
%%scale          0.7
X: 1
T: Canzonetta a tre voci
C: Claudio Monteverdi (1567-1643)
M: C
L: 1/4
Q: "Andante mosso" 1/4 = 110
%%score [1 2 3]
V: 1 clef=treble name="Soprano"sname="A"
V: 2 clef=treble name="Alto"   sname="T"
V: 3 clef=bass middle=d name="Tenor"  sname="B"
%%MIDI program 1 75 % recorder
%%MIDI program 2 75
%%MIDI program 3 75
K: Eb
% 1 - 4
[V: 1] |:z4  |z4  |f2ec         |_ddcc        |
w: Son que-sti~i cre-spi cri-ni~e
w: Que-sti son gli~oc-chi che mi-
[V: 2] |:c2BG|AAGc|(F/G/A/B/)c=A|B2AA         |
w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e
w: Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi-
[V: 3] |:z4  |f2ec|_ddcf        |(B/c/_d/e/)ff|
w: Son que-sti~i cre-spi cri-ni~e que - - - - sto~il
w: Que-sti son~gli oc-chi che mi-ran - - - - do
% 5 - 9
[V: 1] cAB2     |cAAA |c3B|G2!fermata!Gz ::e4|
w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,
w: ran-do fi-so, tut-to re-stai con-qui-so.
[V: 2] AAG2     |AFFF |A3F|=E2!fermata!Ez::c4|
w: que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,
w: ran-do fi-so tut-to re-stai con-qui-so.
[V: 3] (ag/f/e2)|A_ddd|A3B|c2!fermata!cz ::A4|
w: vi - - - so ond' io ti-man-go~uc-ci-so. Deh,
w: fi - - - so tut-to re-stai con-qui-so.
% 10 - 15
[V: 1] f_dec |B2c2|zAGF  |\
w: dim-me-lo ben mi-o, che que-sto\
=EFG2          |1F2z2:|2F8|] % more notes
w: sol de-si-o_. % more lyrics
[V: 2] ABGA  |G2AA|GF=EF |(GF3/2=E//D//E)|1F2z2:|2F8|]
w: dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_.
[V: 3] _dBc>d|e2AF|=EFc_d|c4             |1F2z2:|2F8|]
w: dim-me-lo ben mi-o, che que-sto sol de-si-o_.

================================================
FILE: demo/kitchen-sink/docs/actionscript.as
================================================
package code
{
    /*****************************************
	 * based on textmate actionscript bundle
	 ****************************************/
	 
	import fl.events.SliderEvent;
	
	public class Foo extends MovieClip
	{
		//*************************
		// Properties:
		
		public var activeSwatch:MovieClip;
		
		// Color offsets
		public var c1:Number = 0;	// R
		
		//*************************
		// Constructor:
		
		public function Foo()
		{
			// Respond to mouse events
			swatch1_btn.addEventListener(MouseEvent.CLICK,swatchHandler,false,0,false);
			previewBox_btn.addEventListener(MouseEvent.MOUSE_DOWN,dragPressHandler);
			
			// Respond to drag events
			red_slider.addEventListener(SliderEvent.THUMB_DRAG,sliderHandler);
			
			// Draw a frame later
			addEventListener(Event.ENTER_FRAME,draw);
		}
        
		protected function clickHandler(event:MouseEvent):void
		{
			car.transform.colorTransform = new ColorTransform(0,0,0,1,c1,c2,c3);
		}
		
		protected function changeRGBHandler(event:Event):void
		{
			c1 = Number(c1_txt.text);
            
			if(!(c1>=0)){
				c1 = 0;
			}			
			
			updateSliders();
		}
	}
}

================================================
FILE: demo/kitchen-sink/docs/ada.ada
================================================
with Ada.Text_IO; use Ada.Text_IO;
procedure Hello is
begin
  Put_Line("Hello, world!");
end Hello;

================================================
FILE: demo/kitchen-sink/docs/asciidoc.asciidoc
================================================
AsciiDoc User Guide
===================
Stuart Rackham 
:Author Initials: SJR
:toc:
:icons:
:numbered:
:website: http://www.methods.co.nz/asciidoc/

AsciiDoc is a text document format for writing notes, documentation,
articles, books, ebooks, slideshows, web pages, blogs and UNIX man
pages.  AsciiDoc files can be translated to many formats including
HTML, PDF, EPUB, man page.  AsciiDoc is highly configurable: both the
AsciiDoc source file syntax and the backend output markups (which can
be almost any type of SGML/XML markup) can be customized and extended
by the user.

.This document
**********************************************************************
This is an overly large document, it probably needs to be refactored
into a Tutorial, Quick Reference and Formal Reference.

If you're new to AsciiDoc read this section and the <> section and take a look at the example AsciiDoc (`*.txt`)
source files in the distribution `doc` directory.
**********************************************************************


Introduction
------------
AsciiDoc is a plain text human readable/writable document format that
can be translated to DocBook or HTML using the asciidoc(1) command.
You can then either use asciidoc(1) generated HTML directly or run
asciidoc(1) DocBook output through your favorite DocBook toolchain or
use the AsciiDoc a2x(1) toolchain wrapper to produce PDF, EPUB, DVI,
LaTeX, PostScript, man page, HTML and text formats.

The AsciiDoc format is a useful presentation format in its own right:
AsciiDoc markup is simple, intuitive and as such is easily proofed and
edited.

AsciiDoc is light weight: it consists of a single Python script and a
bunch of configuration files. Apart from asciidoc(1) and a Python
interpreter, no other programs are required to convert AsciiDoc text
files to DocBook or HTML. See <>
below.

Text markup conventions tend to be a matter of (often strong) personal
preference: if the default syntax is not to your liking you can define
your own by editing the text based asciidoc(1) configuration files.
You can also create configuration files to translate AsciiDoc
documents to almost any SGML/XML markup.

asciidoc(1) comes with a set of configuration files to translate
AsciiDoc articles, books and man pages to HTML or DocBook backend
formats.

.My AsciiDoc Itch
**********************************************************************
DocBook has emerged as the de facto standard Open Source documentation
format. But DocBook is a complex language, the markup is difficult to
read and even more difficult to write directly -- I found I was
spending more time typing markup tags, consulting reference manuals
and fixing syntax errors, than I was writing the documentation.
**********************************************************************


[[X6]]
Getting Started
---------------
Installing AsciiDoc
~~~~~~~~~~~~~~~~~~~
See the `README` and `INSTALL` files for install prerequisites and
procedures. Packagers take a look at <>.

[[X11]]
Example AsciiDoc Documents
~~~~~~~~~~~~~~~~~~~~~~~~~~
The best way to quickly get a feel for AsciiDoc is to view the
AsciiDoc web site and/or distributed examples:

- Take a look at the linked examples on the AsciiDoc web site home
  page {website}.  Press the 'Page Source' sidebar menu item to view
  corresponding AsciiDoc source.
- Read the `*.txt` source files in the distribution `./doc` directory
  along with the corresponding HTML and DocBook XML files.


AsciiDoc Document Types
-----------------------
There are three types of AsciiDoc documents: article, book and
manpage. All document types share the same AsciiDoc format with some
minor variations. If you are familiar with DocBook you will have
noticed that AsciiDoc document types correspond to the same-named
DocBook document types.

Use the asciidoc(1) `-d` (`--doctype`) option to specify the AsciiDoc
document type -- the default document type is 'article'.

By convention the `.txt` file extension is used for AsciiDoc document
source files.

article
~~~~~~~
Used for short documents, articles and general documentation.  See the
AsciiDoc distribution `./doc/article.txt` example.

AsciiDoc defines standard DocBook article frontmatter and backmatter
<> (appendix, abstract, bibliography,
glossary, index).

book
~~~~
Books share the same format as articles, with the following
differences:

- The part titles in multi-part books are <>
  (same level as book title).
- Some sections are book specific e.g. preface and colophon.

Book documents will normally be used to produce DocBook output since
DocBook processors can automatically generate footnotes, table of
contents, list of tables, list of figures, list of examples and
indexes.

AsciiDoc defines standard DocBook book frontmatter and backmatter
<> (appendix, dedication, preface,
bibliography, glossary, index, colophon).

.Example book documents
Book::
  The `./doc/book.txt` file in the AsciiDoc distribution.

Multi-part book::
  The `./doc/book-multi.txt` file in the AsciiDoc distribution.

manpage
~~~~~~~
Used to generate roff format UNIX manual pages.  AsciiDoc manpage
documents observe special header title and section naming conventions
-- see the <> section for details.

AsciiDoc defines the 'synopsis' <> to
generate the DocBook `refsynopsisdiv` section.

See also the asciidoc(1) man page source (`./doc/asciidoc.1.txt`) from
the AsciiDoc distribution.


[[X5]]
AsciiDoc Backends
-----------------
The asciidoc(1) command translates an AsciiDoc formatted file to the
backend format specified by the `-b` (`--backend`) command-line
option. asciidoc(1) itself has little intrinsic knowledge of backend
formats, all translation rules are contained in customizable cascading
configuration files. Backend specific attributes are listed in the
<> section.

docbook45::
  Outputs DocBook XML 4.5 markup.

html4::
  This backend generates plain HTML 4.01 Transitional markup.

xhtml11::
  This backend generates XHTML 1.1 markup styled with CSS2. Output
  files have an `.html` extension.

html5::
  This backend generates HTML 5 markup, apart from the inclusion of
  <> it is functionally identical to
  the 'xhtml11' backend.

slidy::
  Use this backend to generate self-contained
  http://www.w3.org/Talks/Tools/Slidy2/[Slidy] HTML slideshows for
  your web browser from AsciiDoc documents. The Slidy backend is
  documented in the distribution `doc/slidy.txt` file and
  {website}slidy.html[online].

wordpress::
  A minor variant of the 'html4' backend to support
  http://srackham.wordpress.com/blogpost1/[blogpost].

latex::
  Experimental LaTeX backend.

Backend Aliases
~~~~~~~~~~~~~~~
Backend aliases are alternative names for AsciiDoc backends.  AsciiDoc
comes with two backend aliases: 'html' (aliased to 'xhtml11') and
'docbook' (aliased to 'docbook45').

You can assign (or reassign) backend aliases by setting an AsciiDoc
attribute named like `backend-alias-` to an AsciiDoc backend
name. For example, the following backend alias attribute definitions
appear in the `[attributes]` section of the global `asciidoc.conf`
configuration file:

  backend-alias-html=xhtml11
  backend-alias-docbook=docbook45

[[X100]]
Backend Plugins
~~~~~~~~~~~~~~~
The asciidoc(1) `--backend` option is also used to install and manage
backend <>.

- A backend plugin is used just like the built-in backends.
- Backend plugins <> over built-in backends with
  the same name.
- You can use the `{asciidoc-confdir}` <> to
  refer to the built-in backend configuration file location from
  backend plugin configuration files.
- You can use the `{backend-confdir}` <> to
  refer to the backend plugin configuration file location.
- By default backends plugins are installed in
  `$HOME/.asciidoc/backends/` where `` is the
  backend name.


DocBook
-------
AsciiDoc generates 'article', 'book' and 'refentry'
http://www.docbook.org/[DocBook] documents (corresponding to the
AsciiDoc 'article', 'book' and 'manpage' document types).

Most Linux distributions come with conversion tools (collectively
called a toolchain) for <> to
presentation formats such as Postscript, HTML, PDF, EPUB, DVI,
PostScript, LaTeX, roff (the native man page format), HTMLHelp,
JavaHelp and text.  There are also programs that allow you to view
DocBook files directly, for example http://live.gnome.org/Yelp[Yelp]
(the GNOME help viewer).

[[X12]]
Converting DocBook to other file formats
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
DocBook files are validated, parsed and translated various
presentation file formats using a combination of applications
collectively called a DocBook 'tool chain'. The function of a tool
chain is to read the DocBook markup (produced by AsciiDoc) and
transform it to a presentation format (for example HTML, PDF, HTML
Help, EPUB, DVI, PostScript, LaTeX).

A wide range of user output format requirements coupled with a choice
of available tools and stylesheets results in many valid tool chain
combinations.

[[X43]]
a2x Toolchain Wrapper
~~~~~~~~~~~~~~~~~~~~~
One of the biggest hurdles for new users is installing, configuring
and using a DocBook XML toolchain. `a2x(1)` can help -- it's a
toolchain wrapper command that will generate XHTML (chunked and
unchunked), PDF, EPUB, DVI, PS, LaTeX, man page, HTML Help and text
file outputs from an AsciiDoc text file.  `a2x(1)` does all the grunt
work associated with generating and sequencing the toolchain commands
and managing intermediate and output files.  `a2x(1)` also optionally
deploys admonition and navigation icons and a CSS stylesheet. See the
`a2x(1)` man page for more details. In addition to `asciidoc(1)` you
also need <>, <> and
optionally: <> or <> (to generate PDF);
`w3m(1)` or `lynx(1)` (to generate text).

The following examples generate `doc/source-highlight-filter.pdf` from
the AsciiDoc `doc/source-highlight-filter.txt` source file. The first
example uses `dblatex(1)` (the default PDF generator) the second
example forces FOP to be used:

  $ a2x -f pdf doc/source-highlight-filter.txt
  $ a2x -f pdf --fop doc/source-highlight-filter.txt

See the `a2x(1)` man page for details.

TIP: Use the `--verbose` command-line option to view executed
toolchain commands.

HTML generation
~~~~~~~~~~~~~~~
AsciiDoc produces nicely styled HTML directly without requiring a
DocBook toolchain but there are also advantages in going the DocBook
route:

- HTML from DocBook can optionally include automatically generated
  indexes, tables of contents, footnotes, lists of figures and tables.
- DocBook toolchains can also (optionally) generate separate (chunked)
  linked HTML pages for each document section.
- Toolchain processing performs link and document validity checks.
- If the DocBook 'lang' attribute is set then things like table of
  contents, figure and table captions and admonition captions will be
  output in the specified language (setting the AsciiDoc 'lang'
  attribute sets the DocBook 'lang' attribute).

On the other hand, HTML output directly from AsciiDoc is much faster,
is easily customized and can be used in situations where there is no
suitable DocBook toolchain (for example, see the {website}[AsciiDoc
website]).

PDF generation
~~~~~~~~~~~~~~
There are two commonly used tools to generate PDFs from DocBook,
<> and <>.

.dblatex or FOP?
- 'dblatex' is easier to install, there's zero configuration
  required and no Java VM to install -- it just works out of the box.
- 'dblatex' source code highlighting and numbering is superb.
- 'dblatex' is easier to use as it converts DocBook directly to PDF
  whereas before using 'FOP' you have to convert DocBook to XML-FO
  using <>.
- 'FOP' is more feature complete (for example, callouts are processed
  inside literal layouts) and arguably produces nicer looking output.

HTML Help generation
~~~~~~~~~~~~~~~~~~~~
. Convert DocBook XML documents to HTML Help compiler source files
  using <> and <>.
. Convert the HTML Help source (`.hhp` and `.html`) files to HTML Help
  (`.chm`) files using the <>.

Toolchain components summary
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
AsciiDoc::
    Converts AsciiDoc (`.txt`) files to DocBook XML (`.xml`) files.

[[X13]]http://docbook.sourceforge.net/projects/xsl/[DocBook XSL Stylesheets]::
  These are a set of XSL stylesheets containing rules for converting
  DocBook XML documents to HTML, XSL-FO, manpage and HTML Help files.
  The stylesheets are used in conjunction with an XML parser such as
  <>.

[[X40]]http://www.xmlsoft.org[xsltproc]::
  An XML parser for applying XSLT stylesheets (in our case the
  <>) to XML documents.

[[X31]]http://dblatex.sourceforge.net/[dblatex]::
  Generates PDF, DVI, PostScript and LaTeX formats directly from
  DocBook source via the intermediate LaTeX typesetting language --
  uses <>, <> and
  `latex(1)`.

[[X14]]http://xml.apache.org/fop/[FOP]::
  The Apache Formatting Objects Processor converts XSL-FO (`.fo`)
  files to PDF files.  The XSL-FO files are generated from DocBook
  source files using <> and
  <>.

[[X67]]Microsoft Help Compiler::
  The Microsoft HTML Help Compiler (`hhc.exe`) is a command-line tool
  that converts HTML Help source files to a single HTML Help (`.chm`)
  file. It runs on MS Windows platforms and can be downloaded from
  http://www.microsoft.com.

AsciiDoc dblatex configuration files
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The AsciiDoc distribution `./dblatex` directory contains
`asciidoc-dblatex.xsl` (customized XSL parameter settings) and
`asciidoc-dblatex.sty` (customized LaTeX settings). These are examples
of optional <> output customization and are used by
<>.

AsciiDoc DocBook XSL Stylesheets drivers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You will have noticed that the distributed HTML and HTML Help
documentation files (for example `./doc/asciidoc.html`) are not the
plain outputs produced using the default 'DocBook XSL Stylesheets'
configuration.  This is because they have been processed using
customized DocBook XSL Stylesheets along with (in the case of HTML
outputs) the custom `./stylesheets/docbook-xsl.css` CSS stylesheet.

You'll find the customized DocBook XSL drivers along with additional
documentation in the distribution `./docbook-xsl` directory. The
examples that follow are executed from the distribution documentation
(`./doc`) directory. These drivers are also used by <>.

`common.xsl`::
    Shared driver parameters.  This file is not used directly but is
    included in all the following drivers.

`chunked.xsl`::
    Generate chunked XHTML (separate HTML pages for each document
    section) in the `./doc/chunked` directory. For example:

    $ python ../asciidoc.py -b docbook asciidoc.txt
    $ xsltproc --nonet ../docbook-xsl/chunked.xsl asciidoc.xml

`epub.xsl`::
    Used by <> to generate EPUB formatted documents.

`fo.xsl`::
    Generate XSL Formatting Object (`.fo`) files for subsequent PDF
    file generation using FOP. For example:

    $ python ../asciidoc.py -b docbook article.txt
    $ xsltproc --nonet ../docbook-xsl/fo.xsl article.xml > article.fo
    $ fop article.fo article.pdf

`htmlhelp.xsl`::
    Generate Microsoft HTML Help source files for the MS HTML Help
    Compiler in the `./doc/htmlhelp` directory. This example is run on
    MS Windows from a Cygwin shell prompt:

    $ python ../asciidoc.py -b docbook asciidoc.txt
    $ xsltproc --nonet ../docbook-xsl/htmlhelp.xsl asciidoc.xml
    $ c:/Program\ Files/HTML\ Help\ Workshop/hhc.exe htmlhelp.hhp

`manpage.xsl`::
    Generate a `roff(1)` format UNIX man page from a DocBook XML
    'refentry' document. This example generates an `asciidoc.1` man
    page file:

    $ python ../asciidoc.py -d manpage -b docbook asciidoc.1.txt
    $ xsltproc --nonet ../docbook-xsl/manpage.xsl asciidoc.1.xml

`xhtml.xsl`::
    Convert a DocBook XML file to a single XHTML file. For example:

    $ python ../asciidoc.py -b docbook asciidoc.txt
    $ xsltproc --nonet ../docbook-xsl/xhtml.xsl asciidoc.xml > asciidoc.html

If you want to see how the complete documentation set is processed
take a look at the A-A-P script `./doc/main.aap`.


Generating Plain Text Files
---------------------------
AsciiDoc does not have a text backend (for most purposes AsciiDoc
source text is fine), however you can convert AsciiDoc text files to
formatted text using the AsciiDoc <> toolchain wrapper
utility.


[[X35]]
HTML5 and XHTML 1.1
-------------------
The 'xhtml11' and 'html5' backends embed or link CSS and JavaScript
files in their outputs, there is also a <> plugin
framework.

- If the AsciiDoc 'linkcss' attribute is defined then CSS and
  JavaScript files are linked to the output document, otherwise they
  are embedded (the default behavior).
- The default locations for CSS and JavaScript files can be changed by
  setting the AsciiDoc 'stylesdir' and 'scriptsdir' attributes
  respectively.
- The default locations for embedded and linked files differ and are
  calculated at different times -- embedded files are loaded when
  asciidoc(1) generates the output document, linked files are loaded
  by the browser when the user views the output document.
- Embedded files are automatically inserted in the output files but
  you need to manually copy linked CSS and Javascript files from
  AsciiDoc <> to the correct location
  relative to the output document.

.Stylesheet file locations
[cols="3*",frame="topbot",options="header"]
|====================================================================
|'stylesdir' attribute
|Linked location ('linkcss' attribute defined)
|Embedded location ('linkcss' attribute undefined)

|Undefined (default).
|Same directory as the output document.
|`stylesheets` subdirectory in the AsciiDoc configuration directory
(the directory containing the backend conf file).

|Absolute or relative directory name.
|Absolute or relative to the output document.
|Absolute or relative to the AsciiDoc configuration directory (the
directory containing the backend conf file).

|====================================================================

.JavaScript file locations
[cols="3*",frame="topbot",options="header"]
|====================================================================
|'scriptsdir' attribute
|Linked location ('linkcss' attribute defined)
|Embedded location ('linkcss' attribute undefined)

|Undefined (default).
|Same directory as the output document.
|`javascripts` subdirectory in the AsciiDoc configuration directory
(the directory containing the backend conf file).

|Absolute or relative directory name.
|Absolute or relative to the output document.
|Absolute or relative to the AsciiDoc configuration directory (the
directory containing the backend conf file).

|====================================================================

[[X99]]
Themes
~~~~~~
The AsciiDoc 'theme' attribute is used to select an alternative CSS
stylesheet and to optionally include additional JavaScript code.

- Theme files reside in an AsciiDoc <>
  named `themes//` (where `` is the the theme name set
  by the 'theme' attribute). asciidoc(1) sets the 'themedir' attribute
  to the theme directory path name.
- The 'theme' attribute can also be set using the asciidoc(1)
  `--theme` option, the `--theme` option can also be used to manage
  theme <>.
- AsciiDoc ships with two themes: 'flask' and 'volnitsky'.
- The `.css` file replaces the default `asciidoc.css` CSS file.
- The `.js` file is included in addition to the default
  `asciidoc.js` JavaScript file.
- If the <> attribute is defined then icons are loaded
  from the theme `icons` sub-directory if it exists (i.e.  the
  'iconsdir' attribute is set to theme `icons` sub-directory path).
- Embedded theme files are automatically inserted in the output files
  but you need to manually copy linked CSS and Javascript files to the
  location of the output documents.
- Linked CSS and JavaScript theme files are linked to the same linked
  locations as <>.

For example, the command-line option `--theme foo` (or `--attribute
theme=foo`) will cause asciidoc(1) to search <<"X27","configuration
file locations 1, 2 and 3">> for a sub-directory called `themes/foo`
containing the stylesheet `foo.css` and optionally a JavaScript file
name `foo.js`.


Document Structure
------------------
An AsciiDoc document consists of a series of <>
starting with an optional document Header, followed by an optional
Preamble, followed by zero or more document Sections.

Almost any combination of zero or more elements constitutes a valid
AsciiDoc document: documents can range from a single sentence to a
multi-part book.

Block Elements
~~~~~~~~~~~~~~
Block elements consist of one or more lines of text and may contain
other block elements.

The AsciiDoc block structure can be informally summarized as follows
footnote:[This is a rough structural guide, not a rigorous syntax
definition]:

  Document      ::= (Header?,Preamble?,Section*)
  Header        ::= (Title,(AuthorInfo,RevisionInfo?)?)
  AuthorInfo    ::= (FirstName,(MiddleName?,LastName)?,EmailAddress?)
  RevisionInfo  ::= (RevisionNumber?,RevisionDate,RevisionRemark?)
  Preamble      ::= (SectionBody)
  Section       ::= (Title,SectionBody?,(Section)*)
  SectionBody   ::= ((BlockTitle?,Block)|BlockMacro)+
  Block         ::= (Paragraph|DelimitedBlock|List|Table)
  List          ::= (BulletedList|NumberedList|LabeledList|CalloutList)
  BulletedList  ::= (ListItem)+
  NumberedList  ::= (ListItem)+
  CalloutList   ::= (ListItem)+
  LabeledList   ::= (ListEntry)+
  ListEntry     ::= (ListLabel,ListItem)
  ListLabel     ::= (ListTerm+)
  ListItem      ::= (ItemText,(List|ListParagraph|ListContinuation)*)

Where:

- '?' implies zero or one occurrence, '+' implies one or more
  occurrences, '*' implies zero or more occurrences.
- All block elements are separated by line boundaries.
- `BlockId`, `AttributeEntry` and `AttributeList` block elements (not
  shown) can occur almost anywhere.
- There are a number of document type and backend specific
  restrictions imposed on the block syntax.
- The following elements cannot contain blank lines: Header, Title,
  Paragraph, ItemText.
- A ListParagraph is a Paragraph with its 'listelement' option set.
- A ListContinuation is a <>.

[[X95]]
Header
~~~~~~
The Header contains document meta-data, typically title plus optional
authorship and revision information:

- The Header is optional, but if it is used it must start with a
  document <>.
- Optional Author and Revision information immediately follows the
  header title.
- The document header must be separated from the remainder of the
  document by one or more blank lines and cannot contain blank lines.
- The header can include comments.
- The header can include <>, typically
  'doctype', 'lang', 'encoding', 'icons', 'data-uri', 'toc',
  'numbered'.
- Header attributes are overridden by command-line attributes.
- If the header contains non-UTF-8 characters then the 'encoding' must
  precede the header (either in the document or on the command-line).

Here's an example AsciiDoc document header:

  Writing Documentation using AsciiDoc
  ====================================
  Joe Bloggs 
  v2.0, February 2003:
  Rewritten for version 2 release.

The author information line contains the author's name optionally
followed by the author's email address. The author's name is formatted
like:

  firstname[ [middlename ]lastname][ ]]

i.e. a first name followed by optional middle and last names followed
by an email address in that order.  Multi-word first, middle and last
names can be entered using the underscore as a word separator.  The
email address comes last and must be enclosed in angle <> brackets.
Here a some examples of author information lines:

  Joe Bloggs 
  Joe Bloggs
  Vincent Willem van_Gogh

If the author line does not match the above specification then the
entire author line is treated as the first name.

The optional revision information line follows the author information
line. The revision information can be one of two formats:

. An optional document revision number followed by an optional
  revision date followed by an optional revision remark:
+
--
  * If the revision number is specified it must be followed by a
    comma.
  * The revision number must contain at least one numeric character.
  * Any non-numeric characters preceding the first numeric character
    will be dropped.
  * If a revision remark is specified it must be preceded by a colon.
    The revision remark extends from the colon up to the next blank
    line, attribute entry or comment and is subject to normal text
    substitutions.
  * If a revision number or remark has been set but the revision date
    has not been set then the revision date is set to the value of the
    'docdate' attribute.

Examples:

  v2.0, February 2003
  February 2003
  v2.0,
  v2.0, February 2003: Rewritten for version 2 release.
  February 2003: Rewritten for version 2 release.
  v2.0,: Rewritten for version 2 release.
  :Rewritten for version 2 release.
--

. The revision information line can also be an RCS/CVS/SVN $Id$
  marker:
+
--
  * AsciiDoc extracts the 'revnumber', 'revdate', and 'author'
    attributes from the $Id$ revision marker and displays them in the
    document header.
  * If an $Id$ revision marker is used the header author line can be
    omitted.

Example:

  $Id: mydoc.txt,v 1.5 2009/05/17 17:58:44 jbloggs Exp $
--

You can override or set header parameters by passing 'revnumber',
'revremark', 'revdate', 'email', 'author', 'authorinitials',
'firstname' and 'lastname' attributes using the asciidoc(1) `-a`
(`--attribute`) command-line option. For example:

  $ asciidoc -a revdate=2004/07/27 article.txt

Attribute entries can also be added to the header for substitution in
the header template with <> elements.

The 'title' element in HTML outputs is set to the AsciiDoc document
title, you can set it to a different value by including a 'title'
attribute entry in the document header.

[[X87]]
Additional document header information
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AsciiDoc has two mechanisms for optionally including additional
meta-data in the header of the output document:

'docinfo' configuration file sections::
If a <> section named 'docinfo' has been loaded
then it will be included in the document header. Typically the
'docinfo' section name will be prefixed with a '+' character so that it
is appended to (rather than replace) other 'docinfo' sections.

'docinfo' files::
Two docinfo files are recognized: one named `docinfo` and a second
named like the AsciiDoc source file with a `-docinfo` suffix.  For
example, if the source document is called `mydoc.txt` then the
document information files would be `docinfo.xml` and
`mydoc-docinfo.xml` (for DocBook outputs) and `docinfo.html` and
`mydoc-docinfo.html` (for HTML outputs).  The <> attributes control which docinfo files are included in
the output files.

The contents docinfo templates and files is dependent on the type of
output:

HTML::
  Valid 'head' child elements. Typically 'style' and 'script' elements
  for CSS and JavaScript inclusion.

DocBook::
  Valid 'articleinfo' or 'bookinfo' child elements.  DocBook defines
  numerous elements for document meta-data, for example: copyrights,
  document history and authorship information.  See the DocBook
  `./doc/article-docinfo.xml` example that comes with the AsciiDoc
  distribution.  The rendering of meta-data elements (or not) is
  DocBook processor dependent.


[[X86]]
Preamble
~~~~~~~~
The Preamble is an optional untitled section body between the document
Header and the first Section title.

Sections
~~~~~~~~
In addition to the document title (level 0), AsciiDoc supports four
section levels: 1 (top) to 4 (bottom).  Section levels are delimited
by section <>.  Sections are translated using
configuration file <>. AsciiDoc
generates the following <> specifically for
use in section markup templates:

level::
The `level` attribute is the section level number, it is normally just
the <> level number (1..4). However, if the `leveloffset`
attribute is defined it will be added to the `level` attribute. The
`leveloffset` attribute is useful for <>.

sectnum::
The `-n` (`--section-numbers`) command-line option generates the
`sectnum` (section number) attribute.  The `sectnum` attribute is used
for section numbers in HTML outputs (DocBook section numbering are
handled automatically by the DocBook toolchain commands).

[[X93]]
Section markup templates
^^^^^^^^^^^^^^^^^^^^^^^^
Section markup templates specify output markup and are defined in
AsciiDoc configuration files.  Section markup template names are
derived as follows (in order of precedence):

1. From the title's first positional attribute or 'template'
   attribute. For example, the following three section titles are
   functionally equivalent:
+
.....................................................................
[[terms]]
[glossary]
List of Terms
-------------

["glossary",id="terms"]
List of Terms
-------------

[template="glossary",id="terms"]
List of Terms
-------------
.....................................................................

2. When the title text matches a configuration file
   <> entry.
3. If neither of the above the default `sect` template is used
   (where `` is a number from 1 to 4).

In addition to the normal section template names ('sect1', 'sect2',
'sect3', 'sect4') AsciiDoc has the following templates for
frontmatter, backmatter and other special sections: 'abstract',
'preface', 'colophon', 'dedication', 'glossary', 'bibliography',
'synopsis', 'appendix', 'index'.  These special section templates
generate the corresponding Docbook elements; for HTML outputs they
default to the 'sect1' section template.

Section IDs
^^^^^^^^^^^
If no explicit section ID is specified an ID will be synthesised from
the section title.  The primary purpose of this feature is to ensure
persistence of table of contents links (permalinks): the missing
section IDs are generated dynamically by the JavaScript TOC generator
*after* the page is loaded. If you link to a dynamically generated TOC
address the page will load but the browser will ignore the (as yet
ungenerated) section ID.

The IDs are generated by the following algorithm:

- Replace all non-alphanumeric title characters with underscores.
- Strip leading or trailing underscores.
- Convert to lowercase.
- Prepend the `idprefix` attribute (so there's no possibility of name
  clashes with existing document IDs). Prepend an underscore if the
  `idprefix` attribute is not defined.
- A numbered suffix (`_2`, `_3` ...) is added if a same named
  auto-generated section ID exists.
- If the `ascii-ids` attribute is defined then non-ASCII characters
  are replaced with ASCII equivalents. This attribute may be
  deprecated in future releases and *should be avoided*, it's sole
  purpose is to accommodate deficient downstream applications that
  cannot process non-ASCII ID attributes.

Example: the title 'Jim's House' would generate the ID `_jim_s_house`.

Section ID synthesis can be disabled by undefining the `sectids`
attribute.

[[X16]]
Special Section Titles
^^^^^^^^^^^^^^^^^^^^^^
AsciiDoc has a mechanism for mapping predefined section titles
auto-magically to specific markup templates. For example a title
'Appendix A: Code Reference' will automatically use the 'appendix'
<>. The mappings from title to template
name are specified in `[specialsections]` sections in the Asciidoc
language configuration files (`lang-*.conf`).  Section entries are
formatted like:

  =<template>

`<title>` is a Python regular expression and `<template>` is the name
of a configuration file markup template section. If the `<title>`
matches an AsciiDoc document section title then the backend output is
marked up using the `<template>` markup template (instead of the
default `sect<level>` section template). The `{title}` attribute value
is set to the value of the matched regular expression group named
'title', if there is no 'title' group `{title}` defaults to the whole
of the AsciiDoc section title. If `<template>` is blank then any
existing entry with the same `<title>` will be deleted.

.Special section titles vs. explicit template names
*********************************************************************
AsciiDoc has two mechanisms for specifying non-default section markup
templates: you can specify the template name explicitly (using the
'template' attribute) or indirectly (using 'special section titles').
Specifying a <<X93,section template>> attribute explicitly is
preferred.  Auto-magical 'special section titles' have the following
drawbacks:

- They are non-obvious, you have to know the exact matching
  title for each special section on a language by language basis.
- Section titles are predefined and can only be customised with a
  configuration change.
- The implementation is complicated by multiple languages: every
  special section title has to be defined for each language (in each
  of the `lang-*.conf` files).

Specifying special section template names explicitly does add more
noise to the source document (the 'template' attribute declaration),
but the intention is obvious and the syntax is consistent with other
AsciiDoc elements c.f.  bibliographic, Q&A and glossary lists.

Special section titles have been deprecated but are retained for
backward compatibility.

*********************************************************************

Inline Elements
~~~~~~~~~~~~~~~
<<X34,Inline document elements>> are used to format text and to
perform various types of text substitution. Inline elements and inline
element syntax is defined in the asciidoc(1) configuration files.

Here is a list of AsciiDoc inline elements in the (default) order in
which they are processed:

Special characters::
        These character sequences escape special characters used by
        the backend markup (typically `<`, `>`, and `&` characters).
        See `[specialcharacters]` configuration file sections.

Quotes::
        Elements that markup words and phrases; usually for character
        formatting. See `[quotes]` configuration file sections.

Special Words::
        Word or word phrase patterns singled out for markup without
        the need for further annotation.  See `[specialwords]`
        configuration file sections.

Replacements::
        Each replacement defines a word or word phrase pattern to
        search for along with corresponding replacement text. See
        `[replacements]` configuration file sections.

Attribute references::
        Document attribute names enclosed in braces are replaced by
        the corresponding attribute value.

Inline Macros::
        Inline macros are replaced by the contents of parametrized
        configuration file sections.


Document Processing
-------------------
The AsciiDoc source document is read and processed as follows:

1. The document 'Header' is parsed, header parameter values are
   substituted into the configuration file `[header]` template section
   which is then written to the output file.
2. Each document 'Section' is processed and its constituent elements
   translated to the output file.
3. The configuration file `[footer]` template section is substituted
   and written to the output file.

When a block element is encountered asciidoc(1) determines the type of
block by checking in the following order (first to last): (section)
Titles, BlockMacros, Lists, DelimitedBlocks, Tables, AttributeEntrys,
AttributeLists, BlockTitles, Paragraphs.

The default paragraph definition `[paradef-default]` is last element
to be checked.

Knowing the parsing order will help you devise unambiguous macro, list
and block syntax rules.

Inline substitutions within block elements are performed in the
following default order:

1. Special characters
2. Quotes
3. Special words
4. Replacements
5. Attributes
6. Inline Macros
7. Replacements2

The substitutions and substitution order performed on
Title, Paragraph and DelimitedBlock elements is determined by
configuration file parameters.


Text Formatting
---------------
[[X51]]
Quoted Text
~~~~~~~~~~~
Words and phrases can be formatted by enclosing inline text with
quote characters:

_Emphasized text_::
        Word phrases \'enclosed in single quote characters' (acute
        accents) or \_underline characters_ are emphasized.

*Strong text*::
        Word phrases \*enclosed in asterisk characters* are rendered
        in a strong font (usually bold).

[[X81]]+Monospaced text+::
        Word phrases \+enclosed in plus characters+ are rendered in a
        monospaced font. Word phrases \`enclosed in backtick
        characters` (grave accents) are also rendered in a monospaced
        font but in this case the enclosed text is rendered literally
        and is not subject to further expansion (see <<X80,inline
        literal passthrough>>).

`Single quoted text'::
        Phrases enclosed with a \`single grave accent to the left and
        a single acute accent to the right' are rendered in single
        quotation marks.

``Double quoted text''::
        Phrases enclosed with \\``two grave accents to the left and
        two acute accents to the right'' are rendered in quotation
        marks.

#Unquoted text#::
        Placing \#hashes around text# does nothing, it is a mechanism
        to allow inline attributes to be applied to otherwise
        unformatted text.

New quote types can be defined by editing asciidoc(1) configuration
files. See the <<X7,Configuration Files>> section for details.

.Quoted text behavior
- Quoting cannot be overlapped.
- Different quoting types can be nested.
- To suppress quoted text formatting place a backslash character
  immediately in front of the leading quote character(s). In the case
  of ambiguity between escaped and non-escaped text you will need to
  escape both leading and trailing quotes, in the case of
  multi-character quotes you may even need to escape individual
  characters.

[[X96]]
Quoted text attributes
^^^^^^^^^^^^^^^^^^^^^^
Quoted text can be prefixed with an <<X21,attribute list>>.  The first
positional attribute ('role' attribute) is translated by AsciiDoc to
an HTML 'span' element 'class' attribute or a DocBook 'phrase' element
'role' attribute.

DocBook XSL Stylesheets translate DocBook 'phrase' elements with
'role' attributes to corresponding HTML 'span' elements with the same
'class' attributes; CSS can then be used
http://www.sagehill.net/docbookxsl/UsingCSS.html[to style the
generated HTML].  Thus CSS styling can be applied to both DocBook and
AsciiDoc generated HTML outputs.  You can also specify multiple class
names separated by spaces.

CSS rules for text color, text background color, text size and text
decorators are included in the distributed AsciiDoc CSS files and are
used in conjunction with AsciiDoc 'xhtml11', 'html5' and 'docbook'
outputs. The CSS class names are:

- '<color>' (text foreground color).
- '<color>-background' (text background color).
- 'big' and 'small' (text size).
- 'underline', 'overline' and 'line-through' (strike through) text
  decorators.

Where '<color>' can be any of the
http://en.wikipedia.org/wiki/Web_colors#HTML_color_names[sixteen HTML
color names].  Examples:

  [red]#Obvious# and [big red yellow-background]*very obvious*.

  [underline]#Underline text#, [overline]#overline text# and
  [blue line-through]*bold blue and line-through*.

is rendered as:

[red]#Obvious# and [big red yellow-background]*very obvious*.

[underline]#Underline text#, [overline]#overline text# and
[bold blue line-through]*bold blue and line-through*.

NOTE: Color and text decorator attributes are rendered for XHTML and
HTML 5 outputs using CSS stylesheets.  The mechanism to implement
color and text decorator attributes is provided for DocBook toolchains
via the DocBook 'phrase' element 'role' attribute, but the actual
rendering is toolchain specific and is not part of the AsciiDoc
distribution.

[[X52]]
Constrained and Unconstrained Quotes
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
There are actually two types of quotes:

Constrained quotes
++++++++++++++++++
Quoted must be bounded by white space or commonly adjoining
punctuation characters. These are the most commonly used type of
quote.

Unconstrained quotes
++++++++++++++++++++
Unconstrained quotes have no boundary constraints and can be placed
anywhere within inline text. For consistency and to make them easier
to remember unconstrained quotes are double-ups of the `_`, `*`, `+`
and `#` constrained quotes:

  __unconstrained emphasized text__
  **unconstrained strong text**
  ++unconstrained monospaced text++
  ##unconstrained unquoted text##

The following example emboldens the letter F:

  **F**ile Open...

Superscripts and Subscripts
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Put \^carets on either^ side of the text to be superscripted, put
\~tildes on either side~ of text to be subscripted.  For example, the
following line:

  e^πi^+1 = 0. H~2~O and x^10^. Some ^super text^
  and ~some sub text~

Is rendered like:

e^πi^+1 = 0. H~2~O and x^10^. Some ^super text^
and ~some sub text~

Superscripts and subscripts are implemented as <<X52,unconstrained
quotes>> and they can be escaped with a leading backslash and prefixed
with with an attribute list.

Line Breaks
~~~~~~~~~~~
A plus character preceded by at least one space character at the end
of a non-blank line forces a line break. It generates a line break
(`br`) tag for HTML outputs and a custom XML `asciidoc-br` processing
instruction for DocBook outputs. The `asciidoc-br` processing
instruction is handled by <<X43,a2x(1)>>.

Page Breaks
~~~~~~~~~~~
A line of three or more less-than (`<<<`) characters will generate a
hard page break in DocBook and printed HTML outputs.  It uses the CSS
`page-break-after` property for HTML outputs and a custom XML
`asciidoc-pagebreak` processing instruction for DocBook outputs. The
`asciidoc-pagebreak` processing instruction is handled by
<<X43,a2x(1)>>. Hard page breaks are sometimes handy but as a general
rule you should let your page processor generate page breaks for you.

Rulers
~~~~~~
A line of three or more apostrophe characters will generate a ruler
line.  It generates a ruler (`hr`) tag for HTML outputs and a custom
XML `asciidoc-hr` processing instruction for DocBook outputs. The
`asciidoc-hr` processing instruction is handled by <<X43,a2x(1)>>.

Tabs
~~~~
By default tab characters input files will translated to 8 spaces. Tab
expansion is set with the 'tabsize' entry in the configuration file
`[miscellaneous]` section and can be overridden in included files by
setting a 'tabsize' attribute in the `include` macro's attribute list.
For example:

  include::addendum.txt[tabsize=2]

The tab size can also be set using the attribute command-line option,
for example `--attribute tabsize=4`

Replacements
~~~~~~~~~~~~
The following replacements are defined in the default AsciiDoc
configuration:

  (C) copyright, (TM) trademark, (R) registered trademark,
  -- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
  double arrow, <= left double arrow.

Which are rendered as:

(C) copyright, (TM) trademark, (R) registered trademark,
-- em dash, ... ellipsis, -> right arrow, <- left arrow, => right
double arrow, <= left double arrow.

You can also include arbitrary entity references in the AsciiDoc
source. Examples:

  ➊ ¶

renders:

➊ ¶

To render a replacement literally escape it with a leading back-slash.

The <<X7,Configuration Files>> section explains how to configure your
own replacements.

Special Words
~~~~~~~~~~~~~
Words defined in `[specialwords]` configuration file sections are
automatically marked up without having to be explicitly notated.

The <<X7,Configuration Files>> section explains how to add and replace
special words.


[[X17]]
Titles
------
Document and section titles can be in either of two formats:

Two line titles
~~~~~~~~~~~~~~~
A two line title consists of a title line, starting hard against the
left margin, and an underline. Section underlines consist a repeated
character pairs spanning the width of the preceding title (give or
take up to two characters):

The default title underlines for each of the document levels are:


  Level 0 (top level):     ======================
  Level 1:                 ----------------------
  Level 2:                 ~~~~~~~~~~~~~~~~~~~~~~
  Level 3:                 ^^^^^^^^^^^^^^^^^^^^^^
  Level 4 (bottom level):  ++++++++++++++++++++++

Examples:

  Level One Section Title
  -----------------------

  Level 2 Subsection Title
  ~~~~~~~~~~~~~~~~~~~~~~~~

[[X46]]
One line titles
~~~~~~~~~~~~~~~
One line titles consist of a single line delimited on either side by
one or more equals characters (the number of equals characters
corresponds to the section level minus one).  Here are some examples:

  = Document Title (level 0) =
  == Section title (level 1) ==
  === Section title (level 2) ===
  ==== Section title (level 3) ====
  ===== Section title (level 4) =====

[NOTE]
=====================================================================
- One or more spaces must fall between the title and the delimiters.
- The trailing title delimiter is optional.
- The one-line title syntax can be changed by editing the
  configuration file `[titles]` section `sect0`...`sect4` entries.
=====================================================================

Floating titles
~~~~~~~~~~~~~~~
Setting the title's first positional attribute or 'style' attribute to
'float' generates a free-floating title. A free-floating title is
rendered just like a normal section title but is not formally
associated with a text body and is not part of the regular section
hierarchy so the normal ordering rules do not apply. Floating titles
can also be used in contexts where section titles are illegal: for
example sidebar and admonition blocks.  Example:

  [float]
  The second day
  ~~~~~~~~~~~~~~

Floating titles do not appear in a document's table of contents.


[[X42]]
Block Titles
------------
A 'BlockTitle' element is a single line beginning with a period
followed by the title text. A BlockTitle is applied to the immediately
following Paragraph, DelimitedBlock, List, Table or BlockMacro. For
example:

........................
.Notes
- Note 1.
- Note 2.
........................

is rendered as:

.Notes
- Note 1.
- Note 2.


[[X41]]
BlockId Element
---------------
A 'BlockId' is a single line block element containing a unique
identifier enclosed in double square brackets. It is used to assign an
identifier to the ensuing block element. For example:

  [[chapter-titles]]
  Chapter titles can be ...

The preceding example identifies the ensuing paragraph so it can be
referenced from other locations, for example with
`<<chapter-titles,chapter titles>>`.

'BlockId' elements can be applied to Title, Paragraph, List,
DelimitedBlock, Table and BlockMacro elements.  The BlockId element
sets the `{id}` attribute for substitution in the subsequent block's
markup template. If a second positional argument is supplied it sets
the `{reftext}` attribute which is used to set the DocBook `xreflabel`
attribute.

The 'BlockId' element has the same syntax and serves the same function
to the <<X30,anchor inline macro>>.

[[X79]]
AttributeList Element
---------------------
An 'AttributeList' block element is an <<X21,attribute list>> on a
line by itself:

- 'AttributeList' attributes are only applied to the immediately
  following block element -- the attributes are made available to the
  block's markup template.
- Multiple contiguous 'AttributeList' elements are additively combined
  in the order they appear..
- The first positional attribute in the list is often used to specify
  the ensuing element's <<X23,style>>.

Attribute value substitution
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
By default, only substitutions that take place inside attribute list
values are attribute references, this is because not all attributes
are destined to be marked up and rendered as text (for example the
table 'cols' attribute). To perform normal inline text substitutions
(special characters, quotes, macros, replacements) on an attribute
value you need to enclose it in single quotes. In the following quote
block the second attribute value in the AttributeList is quoted to
ensure the 'http' macro is expanded to a hyperlink.

---------------------------------------------------------------------
[quote,'http://en.wikipedia.org/wiki/Samuel_Johnson[Samuel Johnson]']
_____________________________________________________________________
Sir, a woman's preaching is like a dog's walking on his hind legs. It
is not done well; but you are surprised to find it done at all.
_____________________________________________________________________
---------------------------------------------------------------------

Common attributes
~~~~~~~~~~~~~~~~~
Most block elements support the following attributes:

[cols="1e,1,5a",frame="topbot",options="header"]
|====================================================================
|Name |Backends |Description

|id |html4, html5, xhtml11, docbook |
Unique identifier typically serve as link targets.
Can also be set by the 'BlockId' element.

|role |html4, html5, xhtml11, docbook |
Role contains a string used to classify or subclassify an element and
can be applied to AsciiDoc block elements.  The AsciiDoc 'role'
attribute is translated to the 'role' attribute in DocBook outputs and
is included in the 'class' attribute in HTML outputs, in this respect
it behaves like the <<X96,quoted text role attribute>>.

DocBook XSL Stylesheets translate DocBook 'role' attributes to HTML
'class' attributes; CSS can then be used
http://www.sagehill.net/docbookxsl/UsingCSS.html[to style the
generated HTML].

|reftext |docbook |
'reftext' is used to set the DocBook 'xreflabel' attribute.
The 'reftext' attribute can an also be set by the 'BlockId' element.

|====================================================================


Paragraphs
----------
Paragraphs are blocks of text terminated by a blank line, the end of
file, or the start of a delimited block or a list.  There are three
paragraph syntaxes: normal, indented (literal) and admonition which
are rendered, by default, with the corresponding paragraph style.

Each syntax has a default style, but you can explicitly apply any
paragraph style to any paragraph syntax. You can also apply
<<X104,delimited block>> styles to single paragraphs.

The built-in paragraph styles are: 'normal', 'literal', 'verse',
'quote', 'listing', 'TIP', 'NOTE', 'IMPORTANT', 'WARNING', 'CAUTION',
'abstract', 'partintro', 'comment', 'example', 'sidebar', 'source',
'music', 'latex', 'graphviz'.

normal paragraph syntax
~~~~~~~~~~~~~~~~~~~~~~~
Normal paragraph syntax consists of one or more non-blank lines of
text. The first line must start hard against the left margin (no
intervening white space). The default processing expectation is that
of a normal paragraph of text.

[[X85]]
literal paragraph syntax
~~~~~~~~~~~~~~~~~~~~~~~~
Literal paragraphs are rendered verbatim in a monospaced font without
any distinguishing background or border.  By default there is no text
formatting or substitutions within Literal paragraphs apart from
Special Characters and Callouts.

The 'literal' style is applied implicitly to indented paragraphs i.e.
where the first line of the paragraph is indented by one or more space
or tab characters.  For example:

---------------------------------------------------------------------
  Consul *necessitatibus* per id,
  consetetur, eu pro everti postulant
  homero verear ea mea, qui.
---------------------------------------------------------------------

Renders:

  Consul *necessitatibus* per id,
  consetetur, eu pro everti postulant
  homero verear ea mea, qui.

NOTE: Because <<X64,lists>> can be indented it's possible for your
indented paragraph to be misinterpreted as a list -- in situations
like this apply the 'literal' style to a normal paragraph.

Instead of using a paragraph indent you could apply the 'literal'
style explicitly, for example:

---------------------------------------------------------------------
[literal]
Consul *necessitatibus* per id,
consetetur, eu pro everti postulant
homero verear ea mea, qui.
---------------------------------------------------------------------

Renders:

[literal]
Consul *necessitatibus* per id,
consetetur, eu pro everti postulant
homero verear ea mea, qui.

[[X94]]
quote and verse paragraph styles
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The optional 'attribution' and 'citetitle' attributes (positional
attributes 2 and 3) specify the author and source respectively.

The 'verse' style retains the line breaks, for example:

---------------------------------------------------------------------
[verse, William Blake, from Auguries of Innocence]
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.
---------------------------------------------------------------------

Which is rendered as:

[verse, William Blake, from Auguries of Innocence]
To see a world in a grain of sand,
And a heaven in a wild flower,
Hold infinity in the palm of your hand,
And eternity in an hour.

The 'quote' style flows the text at left and right margins, for
example:

---------------------------------------------------------------------
[quote, Bertrand Russell, The World of Mathematics (1956)]
A good notation has subtlety and suggestiveness which at times makes
it almost seem like a live teacher.
---------------------------------------------------------------------

Which is rendered as:

[quote, Bertrand Russell, The World of Mathematics (1956)]
A good notation has subtlety and suggestiveness which at times makes
it almost seem like a live teacher.

[[X28]]
Admonition Paragraphs
~~~~~~~~~~~~~~~~~~~~~
'TIP', 'NOTE', 'IMPORTANT', 'WARNING' and 'CAUTION' admonishment
paragraph styles are generated by placing `NOTE:`, `TIP:`,
`IMPORTANT:`, `WARNING:` or `CAUTION:` as the first word of the
paragraph. For example:

  NOTE: This is an example note.

Alternatively, you can specify the paragraph admonition style
explicitly using an <<X79,AttributeList element>>. For example:

  [NOTE]
  This is an example note.

Renders:

NOTE: This is an example note.

TIP: If your admonition requires more than a single paragraph use an
<<X22,admonition block>> instead.

[[X47]]
Admonition Icons and Captions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
NOTE: Admonition customization with `icons`, `iconsdir`, `icon` and
`caption` attributes does not apply when generating DocBook output. If
you are going the DocBook route then the <<X43,a2x(1)>> `--no-icons`
and `--icons-dir` options can be used to set the appropriate XSL
Stylesheets parameters.

By default the asciidoc(1) HTML backends generate text captions
instead of admonition icon image links. To generate links to icon
images define the <<X45,`icons`>> attribute, for example using the `-a
icons` command-line option.

The <<X44,`iconsdir`>> attribute sets the location of linked icon
images.

You can override the default icon image using the `icon` attribute to
specify the path of the linked image. For example:

  [icon="./images/icons/wink.png"]
  NOTE: What lovely war.

Use the `caption` attribute to customize the admonition captions (not
applicable to `docbook` backend). The following example suppresses the
icon image and customizes the caption of a 'NOTE' admonition
(undefining the `icons` attribute with `icons=None` is only necessary
if <<X45,admonition icons>> have been enabled):

  [icons=None, caption="My Special Note"]
  NOTE: This is my special note.

This subsection also applies to <<X22,Admonition Blocks>>.


[[X104]]
Delimited Blocks
----------------
Delimited blocks are blocks of text enveloped by leading and trailing
delimiter lines (normally a series of four or more repeated
characters). The behavior of Delimited Blocks is specified by entries
in configuration file `[blockdef-*]` sections.

Predefined Delimited Blocks
~~~~~~~~~~~~~~~~~~~~~~~~~~~
AsciiDoc ships with a number of predefined DelimitedBlocks (see the
`asciidoc.conf` configuration file in the asciidoc(1) program
directory):

Predefined delimited block underlines:

  CommentBlock:     //////////////////////////
  PassthroughBlock: ++++++++++++++++++++++++++
  ListingBlock:     --------------------------
  LiteralBlock:     ..........................
  SidebarBlock:     **************************
  QuoteBlock:       __________________________
  ExampleBlock:     ==========================
  OpenBlock:        --

.Default DelimitedBlock substitutions
[cols="2e,7*^",frame="topbot",options="header,autowidth"]
|=====================================================
| |Attributes |Callouts |Macros | Quotes |Replacements
|Special chars |Special words

|PassthroughBlock |Yes |No  |Yes |No  |No  |No  |No
|ListingBlock     |No  |Yes |No  |No  |No  |Yes |No
|LiteralBlock     |No  |Yes |No  |No  |No  |Yes |No
|SidebarBlock     |Yes |No  |Yes |Yes |Yes |Yes |Yes
|QuoteBlock       |Yes |No  |Yes |Yes |Yes |Yes |Yes
|ExampleBlock     |Yes |No  |Yes |Yes |Yes |Yes |Yes
|OpenBlock        |Yes |No  |Yes |Yes |Yes |Yes |Yes
|=====================================================

Listing Blocks
~~~~~~~~~~~~~~
'ListingBlocks' are rendered verbatim in a monospaced font, they
retain line and whitespace formatting and are often distinguished by a
background or border. There is no text formatting or substitutions
within Listing blocks apart from Special Characters and Callouts.
Listing blocks are often used for computer output and file listings.

Here's an example:

[listing]
......................................
--------------------------------------
#include <stdio.h>

int main() {
   printf("Hello World!\n");
   exit(0);
}
--------------------------------------
......................................

Which will be rendered like:

--------------------------------------
#include <stdio.h>

int main() {
    printf("Hello World!\n");
    exit(0);
}
--------------------------------------

By convention <<X59,filter blocks>> use the listing block syntax and
are implemented as distinct listing block styles.

[[X65]]
Literal Blocks
~~~~~~~~~~~~~~
'LiteralBlocks' are rendered just like <<X85,literal paragraphs>>.
Example:

---------------------------------------------------------------------
...................................
Consul *necessitatibus* per id,
consetetur, eu pro everti postulant
homero verear ea mea, qui.
...................................
---------------------------------------------------------------------

Renders:
...................................
Consul *necessitatibus* per id,
consetetur, eu pro everti postulant
homero verear ea mea, qui.
...................................

If the 'listing' style is applied to a LiteralBlock it will be
rendered as a ListingBlock (this is handy if you have a listing
containing a ListingBlock).

Sidebar Blocks
~~~~~~~~~~~~~~
A sidebar is a short piece of text presented outside the narrative
flow of the main text. The sidebar is normally presented inside a
bordered box to set it apart from the main text.

The sidebar body is treated like a normal section body.

Here's an example:

---------------------------------------------------------------------
.An Example Sidebar
************************************************
Any AsciiDoc SectionBody element (apart from
SidebarBlocks) can be placed inside a sidebar.
************************************************
---------------------------------------------------------------------

Which will be rendered like:

.An Example Sidebar
************************************************
Any AsciiDoc SectionBody element (apart from
SidebarBlocks) can be placed inside a sidebar.
************************************************

[[X26]]
Comment Blocks
~~~~~~~~~~~~~~
The contents of 'CommentBlocks' are not processed; they are useful for
annotations and for excluding new or outdated content that you don't
want displayed. CommentBlocks are never written to output files.
Example:

---------------------------------------------------------------------
//////////////////////////////////////////
CommentBlock contents are not processed by
asciidoc(1).
//////////////////////////////////////////
---------------------------------------------------------------------

See also <<X25,Comment Lines>>.

NOTE: System macros are executed inside comment blocks.

[[X76]]
Passthrough Blocks
~~~~~~~~~~~~~~~~~~
By default the block contents is subject only to 'attributes' and
'macros' substitutions (use an explicit 'subs' attribute to apply
different substitutions).  PassthroughBlock content will often be
backend specific. Here's an example:

---------------------------------------------------------------------
[subs="quotes"]
++++++++++++++++++++++++++++++++++++++
<table border="1"><tr>
  <td>*Cell 1*</td>
  <td>*Cell 2*</td>
</tr></table>
++++++++++++++++++++++++++++++++++++++
---------------------------------------------------------------------

The following styles can be applied to passthrough blocks:

pass::
  No substitutions are performed. This is equivalent to `subs="none"`.

asciimath, latexmath::
  By default no substitutions are performed, the contents are rendered
  as <<X78,mathematical formulas>>.

Quote Blocks
~~~~~~~~~~~~
'QuoteBlocks' are used for quoted passages of text. There are two
styles: 'quote' and 'verse'. The style behavior is identical to
<<X94,quote and verse paragraphs>> except that blocks can contain
multiple paragraphs and, in the case of the 'quote' style, other
section elements.  The first positional attribute sets the style, if
no attributes are specified the 'quote' style is used.  The optional
'attribution' and 'citetitle' attributes (positional attributes 2 and
3) specify the quote's author and source. For example:

---------------------------------------------------------------------
[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
____________________________________________________________________
As he spoke there was the sharp sound of horses' hoofs and
grating wheels against the curb, followed by a sharp pull at the
bell. Holmes whistled.

"A pair, by the sound," said he. "Yes," he continued, glancing
out of the window. "A nice little brougham and a pair of
beauties. A hundred and fifty guineas apiece. There's money in
this case, Watson, if there is nothing else."
____________________________________________________________________
---------------------------------------------------------------------

Which is rendered as:

[quote, Sir Arthur Conan Doyle, The Adventures of Sherlock Holmes]
____________________________________________________________________
As he spoke there was the sharp sound of horses' hoofs and
grating wheels against the curb, followed by a sharp pull at the
bell. Holmes whistled.

"A pair, by the sound," said he. "Yes," he continued, glancing
out of the window. "A nice little brougham and a pair of
beauties. A hundred and fifty guineas apiece. There's money in
this case, Watson, if there is nothing else."
____________________________________________________________________

[[X48]]
Example Blocks
~~~~~~~~~~~~~~
'ExampleBlocks' encapsulate the DocBook Example element and are used
for, well, examples.  Example blocks can be titled by preceding them
with a 'BlockTitle'.  DocBook toolchains will normally automatically
number examples and generate a 'List of Examples' backmatter section.

Example blocks are delimited by lines of equals characters and can
contain any block elements apart from Titles, BlockTitles and
Sidebars) inside an example block. For example:

---------------------------------------------------------------------
.An example
=====================================================================
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens.
=====================================================================
---------------------------------------------------------------------

Renders:

.An example
=====================================================================
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens.
=====================================================================

A title prefix that can be inserted with the `caption` attribute
(HTML backends). For example:

---------------------------------------------------------------------
[caption="Example 1: "]
.An example with a custom caption
=====================================================================
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens.
=====================================================================
---------------------------------------------------------------------

[[X22]]
Admonition Blocks
~~~~~~~~~~~~~~~~~
The 'ExampleBlock' definition includes a set of admonition
<<X23,styles>> ('NOTE', 'TIP', 'IMPORTANT', 'WARNING', 'CAUTION') for
generating admonition blocks (admonitions containing more than a
<<X28,single paragraph>>).  Just precede the 'ExampleBlock' with an
attribute list specifying the admonition style name. For example:

---------------------------------------------------------------------
[NOTE]
.A NOTE admonition block
=====================================================================
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens.

. Fusce euismod commodo velit.
. Vivamus fringilla mi eu lacus.
  .. Fusce euismod commodo velit.
  .. Vivamus fringilla mi eu lacus.
. Donec eget arcu bibendum
  nunc consequat lobortis.
=====================================================================
---------------------------------------------------------------------

Renders:

[NOTE]
.A NOTE admonition block
=====================================================================
Qui in magna commodo, est labitur dolorum an. Est ne magna primis
adolescens.

. Fusce euismod commodo velit.
. Vivamus fringilla mi eu lacus.
  .. Fusce euismod commodo velit.
  .. Vivamus fringilla mi eu lacus.
. Donec eget arcu bibendum
  nunc consequat lobortis.
=====================================================================

See also <<X47,Admonition Icons and Captions>>.

[[X29]]
Open Blocks
~~~~~~~~~~~
Open blocks are special:

- The open block delimiter is line containing two hyphen characters
  (instead of four or more repeated characters).

- They can be used to group block elements for <<X15,List item
  continuation>>.

- Open blocks can be styled to behave like any other type of delimited
  block.  The  following built-in styles can be applied to open
  blocks: 'literal', 'verse', 'quote', 'listing', 'TIP', 'NOTE',
  'IMPORTANT', 'WARNING', 'CAUTION', 'abstract', 'partintro',
  'comment', 'example', 'sidebar', 'source', 'music', 'latex',
  'graphviz'. For example, the following open block and listing block
  are functionally identical:

  [listing]
  --
  Lorum ipsum ...
  --

  ---------------
  Lorum ipsum ...
  ---------------

- An unstyled open block groups section elements but otherwise does
  nothing.

Open blocks are used to generate document abstracts and book part
introductions:

- Apply the 'abstract' style to generate an abstract, for example:

  [abstract]
  --
  In this paper we will ...
  --

. Apply the 'partintro' style to generate a book part introduction for
  a multi-part book, for example:

  [partintro]
  .Optional part introduction title
  --
  Optional part introduction goes here.
  --


[[X64]]
Lists
-----
.List types
- Bulleted lists. Also known as itemized or unordered lists.
- Numbered lists. Also called ordered lists.
- Labeled lists. Sometimes called variable or definition lists.
- Callout lists (a list of callout annotations).

.List behavior
- List item indentation is optional and does not determine nesting,
  indentation does however make the source more readable.
- Another list or a literal paragraph immediately following a list
  item will be implicitly included in the list item; use <<X15, list
  item continuation>> to explicitly append other block elements to a
  list item.
- A comment block or a comment line block macro element will terminate
  a list -- use inline comment lines to put comments inside lists.
- The `listindex` <<X60,intrinsic attribute>> is the current list item
  index (1..). If this attribute is used outside a list then it's value
  is the number of items in the most recently closed list. Useful for
  displaying the number of items in a list.

Bulleted Lists
~~~~~~~~~~~~~~
Bulleted list items start with a single dash or one to five asterisks
followed by some white space then some text. Bulleted list syntaxes
are:

...................
- List item.
* List item.
** List item.
*** List item.
**** List item.
***** List item.
...................

Numbered Lists
~~~~~~~~~~~~~~
List item numbers are explicit or implicit.

.Explicit numbering
List items begin with a number followed by some white space then the
item text. The numbers can be decimal (arabic), roman (upper or lower
case) or alpha (upper or lower case). Decimal and alpha numbers are
terminated with a period, roman numbers are terminated with a closing
parenthesis. The different terminators are necessary to ensure 'i',
'v' and 'x' roman numbers are are distinguishable from 'x', 'v' and
'x' alpha numbers. Examples:

.....................................................................
1.   Arabic (decimal) numbered list item.
a.   Lower case alpha (letter) numbered list item.
F.   Upper case alpha (letter) numbered list item.
iii) Lower case roman numbered list item.
IX)  Upper case roman numbered list item.
.....................................................................

.Implicit numbering
List items begin one to five period characters, followed by some white
space then the item text. Examples:

.....................................................................
. Arabic (decimal) numbered list item.
.. Lower case alpha (letter) numbered list item.
... Lower case roman numbered list item.
.... Upper case alpha (letter) numbered list item.
..... Upper case roman numbered list item.
.....................................................................

You can use the 'style' attribute (also the first positional
attribute) to specify an alternative numbering style.  The numbered
list style can be one of the following values: 'arabic', 'loweralpha',
'upperalpha', 'lowerroman', 'upperroman'.

Here are some examples of bulleted and numbered lists:

---------------------------------------------------------------------
- Praesent eget purus quis magna eleifend eleifend.
  1. Fusce euismod commodo velit.
    a. Fusce euismod commodo velit.
    b. Vivamus fringilla mi eu lacus.
    c. Donec eget arcu bibendum nunc consequat lobortis.
  2. Vivamus fringilla mi eu lacus.
    i)  Fusce euismod commodo velit.
    ii) Vivamus fringilla mi eu lacus.
  3. Donec eget arcu bibendum nunc consequat lobortis.
  4. Nam fermentum mattis ante.
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  * Fusce euismod commodo velit.
  ** Qui in magna commodo, est labitur dolorum an. Est ne magna primis
     adolescens. Sit munere ponderum dignissim et. Minim luptatum et
     vel.
  ** Vivamus fringilla mi eu lacus.
  * Donec eget arcu bibendum nunc consequat lobortis.
- Nulla porttitor vulputate libero.
  . Fusce euismod commodo velit.
  . Vivamus fringilla mi eu lacus.
[upperroman]
    .. Fusce euismod commodo velit.
    .. Vivamus fringilla mi eu lacus.
  . Donec eget arcu bibendum nunc consequat lobortis.
---------------------------------------------------------------------

Which render as:

- Praesent eget purus quis magna eleifend eleifend.
  1. Fusce euismod commodo velit.
    a. Fusce euismod commodo velit.
    b. Vivamus fringilla mi eu lacus.
    c. Donec eget arcu bibendum nunc consequat lobortis.
  2. Vivamus fringilla mi eu lacus.
    i)  Fusce euismod commodo velit.
    ii) Vivamus fringilla mi eu lacus.
  3. Donec eget arcu bibendum nunc consequat lobortis.
  4. Nam fermentum mattis ante.
- Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  * Fusce euismod commodo velit.
  ** Qui in magna commodo, est labitur dolorum an. Est ne magna primis
     adolescens. Sit munere ponderum dignissim et. Minim luptatum et
     vel.
  ** Vivamus fringilla mi eu lacus.
  * Donec eget arcu bibendum nunc consequat lobortis.
- Nulla porttitor vulputate libero.
  . Fusce euismod commodo velit.
  . Vivamus fringilla mi eu lacus.
[upperroman]
    .. Fusce euismod commodo velit.
    .. Vivamus fringilla mi eu lacus.
  . Donec eget arcu bibendum nunc consequat lobortis.

A predefined 'compact' option is available to bulleted and numbered
lists -- this translates to the DocBook 'spacing="compact"' lists
attribute which may or may not be processed by the DocBook toolchain.
Example:

  [options="compact"]
  - Compact list item.
  - Another compact list item.

TIP: To apply the 'compact' option globally define a document-wide
'compact-option' attribute, e.g. using the `-a compact-option`
command-line option.

You can set the list start number using the 'start' attribute (works
for HTML outputs and DocBook outputs processed by DocBook XSL
Stylesheets). Example:

  [start=7]
  . List item 7.
  . List item 8.

Labeled Lists
~~~~~~~~~~~~~
Labeled list items consist of one or more text labels followed by the
text of the list item.

An item label begins a line with an alphanumeric character hard
against the left margin and ends with two, three or four colons or two
semi-colons. A list item can have multiple labels, one per line.

The list item text consists of one or more lines of text starting
after the last label (either on the same line or a new line) and can
be followed by nested List or ListParagraph elements. Item text can be
optionally indented.

Here are some examples:

---------------------------------------------------------------------
In::
Lorem::
  Fusce euismod commodo velit.

  Fusce euismod commodo velit.

Ipsum:: Vivamus fringilla mi eu lacus.
  * Vivamus fringilla mi eu lacus.
  * Donec eget arcu bibendum nunc consequat lobortis.
Dolor::
  Donec eget arcu bibendum nunc consequat lobortis.
  Suspendisse;;
    A massa id sem aliquam auctor.
  Morbi;;
    Pretium nulla vel lorem.
  In;;
    Dictum mauris in urna.
    Vivamus::: Fringilla mi eu lacus.
    Donec:::   Eget arcu bibendum nunc consequat lobortis.
---------------------------------------------------------------------

Which render as:

In::
Lorem::
  Fusce euismod commodo velit.

  Fusce euismod commodo velit.

Ipsum:: Vivamus fringilla mi eu lacus.
  * Vivamus fringilla mi eu lacus.
  * Donec eget arcu bibendum nunc consequat lobortis.
Dolor::
  Donec eget arcu bibendum nunc consequat lobortis.
  Suspendisse;;
    A massa id sem aliquam auctor.
  Morbi;;
    Pretium nulla vel lorem.
  In;;
    Dictum mauris in urna.
    Vivamus::: Fringilla mi eu lacus.
    Donec:::   Eget arcu bibendum nunc consequat lobortis.

Horizontal labeled list style
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The 'horizontal' labeled list style (also the first positional
attribute) places the list text side-by-side with the label instead of
under the label. Here is an example:

---------------------------------------------------------------------
[horizontal]
*Lorem*:: Fusce euismod commodo velit.  Qui in magna commodo, est
labitur dolorum an. Est ne magna primis adolescens.

  Fusce euismod commodo velit.

*Ipsum*:: Vivamus fringilla mi eu lacus.
- Vivamus fringilla mi eu lacus.
- Donec eget arcu bibendum nunc consequat lobortis.

*Dolor*::
  - Vivamus fringilla mi eu lacus.
  - Donec eget arcu bibendum nunc consequat lobortis.

---------------------------------------------------------------------

Which render as:

[horizontal]
*Lorem*:: Fusce euismod commodo velit.  Qui in magna commodo, est
labitur dolorum an. Est ne magna primis adolescens.

  Fusce euismod commodo velit.

*Ipsum*:: Vivamus fringilla mi eu lacus.
- Vivamus fringilla mi eu lacus.
- Donec eget arcu bibendum nunc consequat lobortis.

*Dolor*::
  - Vivamus fringilla mi eu lacus.
  - Donec eget arcu bibendum nunc consequat lobortis.

[NOTE]
=====================================================================
- Current PDF toolchains do not make a good job of determining
  the relative column widths for horizontal labeled lists.
- Nested horizontal labeled lists will generate DocBook validation
  errors because the 'DocBook XML V4.2' DTD does not permit nested
  informal tables (although <<X13,DocBook XSL Stylesheets>> and
  <<X31,dblatex>> process them correctly).
- The label width can be set as a percentage of the total width by
  setting the 'width' attribute e.g. `width="10%"`
=====================================================================

Question and Answer Lists
~~~~~~~~~~~~~~~~~~~~~~~~~
AsciiDoc comes pre-configured with a 'qanda' style labeled list for generating
DocBook question and answer (Q&A) lists. Example:

---------------------------------------------------------------------
[qanda]
Question one::
        Answer one.
Question two::
        Answer two.
---------------------------------------------------------------------

Renders:

[qanda]
Question one::
        Answer one.
Question two::
        Answer two.

Glossary Lists
~~~~~~~~~~~~~~
AsciiDoc comes pre-configured with a 'glossary' style labeled list for
generating DocBook glossary lists. Example:

---------------------------------------------------------------------
[glossary]
A glossary term::
    The corresponding definition.
A second glossary term::
    The corresponding definition.
---------------------------------------------------------------------

For working examples see the `article.txt` and `book.txt` documents in
the AsciiDoc `./doc` distribution directory.

NOTE: To generate valid DocBook output glossary lists must be located
in a section that uses the 'glossary' <<X93,section markup template>>.

Bibliography Lists
~~~~~~~~~~~~~~~~~~
AsciiDoc comes with a predefined 'bibliography' bulleted list style
generating DocBook bibliography entries. Example:

---------------------------------------------------------------------
[bibliography]
.Optional list title
- [[[taoup]]] Eric Steven Raymond. 'The Art of UNIX
  Programming'. Addison-Wesley. ISBN 0-13-142901-9.
- [[[walsh-muellner]]] Norman Walsh & Leonard Muellner.
  'DocBook - The Definitive Guide'. O'Reilly & Associates.
  1999. ISBN 1-56592-580-7.
---------------------------------------------------------------------

The `[[[<reference>]]]` syntax is a bibliography entry anchor, it
generates an anchor named `<reference>` and additionally displays
`[<reference>]` at the anchor position. For example `[[[taoup]]]`
generates an anchor named `taoup` that displays `[taoup]` at the
anchor position. Cite the reference from elsewhere your document using
`<<taoup>>`, this displays a hyperlink (`[taoup]`) to the
corresponding bibliography entry anchor.

For working examples see the `article.txt` and `book.txt` documents in
the AsciiDoc `./doc` distribution directory.

NOTE: To generate valid DocBook output bibliography lists must be
located in a <<X93,bibliography section>>.

[[X15]]
List Item Continuation
~~~~~~~~~~~~~~~~~~~~~~
Another list or a literal paragraph immediately following a list item
is implicitly appended to the list item; to append other block
elements to a list item you need to explicitly join them to the list
item with a 'list continuation' (a separator line containing a single
plus character). Multiple block elements can be appended to a list
item using list continuations (provided they are legal list item
children in the backend markup).

Here are some examples of list item continuations: list item one
contains multiple continuations; list item two is continued with an
<<X29,OpenBlock>> containing multiple elements:

---------------------------------------------------------------------
1. List item one.
+
List item one continued with a second paragraph followed by an
Indented block.
+
.................
$ ls *.sh
$ mv *.sh ~/tmp
.................
+
List item continued with a third paragraph.

2. List item two continued with an open block.
+
--
This paragraph is part of the preceding list item.

a. This list is nested and does not require explicit item continuation.
+
This paragraph is part of the preceding list item.

b. List item b.

This paragraph belongs to item two of the outer list.
--
---------------------------------------------------------------------

Renders:

1. List item one.
+
List item one continued with a second paragraph followed by an
Indented block.
+
.................
$ ls *.sh
$ mv *.sh ~/tmp
.................
+
List item continued with a third paragraph.

2. List item two continued with an open block.
+
--
This paragraph is part of the preceding list item.

a. This list is nested and does not require explicit item continuation.
+
This paragraph is part of the preceding list item.

b. List item b.

This paragraph belongs to item two of the outer list.
--


[[X92]]
Footnotes
---------
The shipped AsciiDoc configuration includes three footnote inline
macros:

`footnote:[<text>]`::
  Generates a footnote with text `<text>`.

`footnoteref:[<id>,<text>]`::
  Generates a footnote with a reference ID `<id>` and text `<text>`.

`footnoteref:[<id>]`::
  Generates a reference to the footnote with ID `<id>`.

The footnote text can span multiple lines.

The 'xhtml11' and 'html5' backends render footnotes dynamically using
JavaScript; 'html4' outputs do not use JavaScript and leave the
footnotes inline; 'docbook' footnotes are processed by the downstream
DocBook toolchain.

Example footnotes:

  A footnote footnote:[An example footnote.];
  a second footnote with a reference ID footnoteref:[note2,Second footnote.];
  finally a reference to the second footnote footnoteref:[note2].

Renders:

A footnote footnote:[An example footnote.];
a second footnote with a reference ID footnoteref:[note2,Second footnote.];
finally a reference to the second footnote footnoteref:[note2].


Indexes
-------
The shipped AsciiDoc configuration includes the inline macros for
generating DocBook index entries.

`indexterm:[<primary>,<secondary>,<tertiary>]`::
`(((<primary>,<secondary>,<tertiary>)))`::
    This inline macro generates an index term (the `<secondary>` and
    `<tertiary>` positional attributes are optional). Example:
    `indexterm:[Tigers,Big cats]` (or, using the alternative syntax
    `(((Tigers,Big cats)))`.  Index terms that have secondary and
    tertiary entries also generate separate index terms for the
    secondary and tertiary entries. The index terms appear in the
    index, not the primary text flow.

`indexterm2:[<primary>]`::
`((<primary>))`::
    This inline macro generates an index term that appears in both the
    index and the primary text flow.  The `<primary>` should not be
    padded to the left or right with white space characters.

For working examples see the `article.txt` and `book.txt` documents in
the AsciiDoc `./doc` distribution directory.

NOTE: Index entries only really make sense if you are generating
DocBook markup -- DocBook conversion programs automatically generate
an index at the point an 'Index' section appears in source document.


[[X105]]
Callouts
--------
Callouts are a mechanism for annotating verbatim text (for example:
source code, computer output and user input). Callout markers are
placed inside the annotated text while the actual annotations are
presented in a callout list after the annotated text. Here's an
example:

---------------------------------------------------------------------
 .MS-DOS directory listing
 -----------------------------------------------------
 10/17/97   9:04         <DIR>    bin
 10/16/97  14:11         <DIR>    DOS            \<1>
 10/16/97  14:40         <DIR>    Program Files
 10/16/97  14:46         <DIR>    TEMP
 10/17/97   9:04         <DIR>    tmp
 10/16/97  14:37         <DIR>    WINNT
 10/16/97  14:25             119  AUTOEXEC.BAT   \<2>
  2/13/94   6:21          54,619  COMMAND.COM    \<2>
 10/16/97  14:25             115  CONFIG.SYS     \<2>
 11/16/97  17:17      61,865,984  pagefile.sys
  2/13/94   6:21           9,349  WINA20.386     \<3>
 -----------------------------------------------------

 \<1> This directory holds MS-DOS.
 \<2> System startup code for DOS.
 \<3> Some sort of Windows 3.1 hack.
---------------------------------------------------------------------

Which renders:

.MS-DOS directory listing
-----------------------------------------------------
10/17/97   9:04         <DIR>    bin
10/16/97  14:11         <DIR>    DOS            <1>
10/16/97  14:40         <DIR>    Program Files
10/16/97  14:46         <DIR>    TEMP
10/17/97   9:04         <DIR>    tmp
10/16/97  14:37         <DIR>    WINNT
10/16/97  14:25             119  AUTOEXEC.BAT   <2>
 2/13/94   6:21          54,619  COMMAND.COM    <2>
10/16/97  14:25             115  CONFIG.SYS     <2>
11/16/97  17:17      61,865,984  pagefile.sys
 2/13/94   6:21           9,349  WINA20.386     <3>
-----------------------------------------------------

<1> This directory holds MS-DOS.
<2> System startup code for DOS.
<3> Some sort of Windows 3.1 hack.

.Explanation
- The callout marks are whole numbers enclosed in angle brackets --
  they refer to the correspondingly numbered item in the following
  callout list.
- By default callout marks are confined to 'LiteralParagraphs',
  'LiteralBlocks' and 'ListingBlocks' (although this is a
  configuration file option and can be changed).
- Callout list item numbering is fairly relaxed -- list items can
  start with `<n>`, `n>` or `>` where `n` is the optional list item
  number (in the latter case list items starting with a single `>`
  character are implicitly numbered starting at one).
- Callout lists should not be nested.
- Callout lists start list items hard against the left margin.
- If you want to present a number inside angle brackets you'll need to
  escape it with a backslash to prevent it being interpreted as a
  callout mark.

NOTE: Define the AsciiDoc 'icons' attribute (for example using the `-a
icons` command-line option) to display callout icons.

Implementation Notes
~~~~~~~~~~~~~~~~~~~~
Callout marks are generated by the 'callout' inline macro while
callout lists are generated using the 'callout' list definition. The
'callout' macro and 'callout' list are special in that they work
together. The 'callout' inline macro is not enabled by the normal
'macros' substitutions option, instead it has its own 'callouts'
substitution option.

The following attributes are available during inline callout macro
substitution:

`{index}`::
    The callout list item index inside the angle brackets.
`{coid}`::
    An identifier formatted like `CO<listnumber>-<index>` that
    uniquely identifies the callout mark. For example `CO2-4`
    identifies the fourth callout mark in the second set of callout
    marks.

The `{coids}` attribute can be used during callout list item
substitution -- it is a space delimited list of callout IDs that refer
to the explanatory list item.

Including callouts in included code
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You can annotate working code examples with callouts -- just remember
to put the callouts inside source code comments. This example displays
the `test.py` source file (containing a single callout) using the
'source' (code highlighter) filter:

.AsciiDoc source
---------------------------------------------------------------------
 [source,python]
 -------------------------------------------
 \include::test.py[]
 -------------------------------------------

 \<1> Print statement.
---------------------------------------------------------------------

.Included `test.py` source
---------------------------------------------------------------------
print 'Hello World!'   # \<1>
---------------------------------------------------------------------


Macros
------
Macros are a mechanism for substituting parametrized text into output
documents.

Macros have a 'name', a single 'target' argument and an 'attribute
list'.  The usual syntax is `<name>:<target>[<attrlist>]` (for
inline macros) and `<name>::<target>[<attrlist>]` (for block
macros).  Here are some examples:

  http://www.docbook.org/[DocBook.org]
  include::chapt1.txt[tabsize=2]
  mailto:srackham@gmail.com[]

.Macro behavior
- `<name>` is the macro name. It can only contain letters, digits or
  dash characters and cannot start with a dash.
- The optional `<target>` cannot contain white space characters.
- `<attrlist>` is a <<X21,list of attributes>> enclosed in square
  brackets.
- `]` characters inside attribute lists must be escaped with a
  backslash.
- Expansion of macro references can normally be escaped by prefixing a
  backslash character (see the AsciiDoc 'FAQ' for examples of
  exceptions to this rule).
- Attribute references in block macros are expanded.
- The substitutions performed prior to Inline macro macro expansion
  are determined by the inline context.
- Macros are processed in the order they appear in the configuration
  file(s).
- Calls to inline macros can be nested inside different inline macros
  (an inline macro call cannot contain a nested call to itself).
- In addition to `<name>`, `<target>` and `<attrlist>` the
  `<passtext>` and `<subslist>` named groups are available to
  <<X77,passthrough macros>>. A macro is a passthrough macro if the
  definition includes a `<passtext>` named group.

Inline Macros
~~~~~~~~~~~~~
Inline Macros occur in an inline element context. Predefined Inline
macros include 'URLs', 'image' and 'link' macros.

URLs
^^^^
'http', 'https', 'ftp', 'file', 'mailto' and 'callto' URLs are
rendered using predefined inline macros.

- If you don't need a custom link caption you can enter the 'http',
  'https', 'ftp', 'file' URLs and email addresses without any special
  macro syntax.
- If the `<attrlist>` is empty the URL is displayed.

Here are some examples:

  http://www.docbook.org/[DocBook.org]
  http://www.docbook.org/
  mailto:joe.bloggs@foobar.com[email Joe Bloggs]
  joe.bloggs@foobar.com

Which are rendered:

http://www.docbook.org/[DocBook.org]

http://www.docbook.org/

mailto:joe.bloggs@foobar.com[email Joe Bloggs]

joe.bloggs@foobar.com

If the `<target>` necessitates space characters use `%20`, for example
`large%20image.png`.

Internal Cross References
^^^^^^^^^^^^^^^^^^^^^^^^^
Two AsciiDoc inline macros are provided for creating hypertext links
within an AsciiDoc document. You can use either the standard macro
syntax or the (preferred) alternative.

[[X30]]
anchor
++++++
Used to specify hypertext link targets:

  [[<id>,<xreflabel>]]
  anchor:<id>[<xreflabel>]

The `<id>` is a unique string that conforms to the output markup's
anchor syntax. The optional `<xreflabel>` is the text to be displayed
by captionless 'xref' macros that refer to this anchor. The optional
`<xreflabel>` is only really useful when generating DocBook output.
Example anchor:

  [[X1]]

You may have noticed that the syntax of this inline element is the
same as that of the <<X41,BlockId block element>>, this is no
coincidence since they are functionally equivalent.

xref
++++
Creates a hypertext link to a document anchor.

  <<<id>,<caption>>>
  xref:<id>[<caption>]

The `<id>` refers to an anchor ID. The optional `<caption>` is the
link's displayed text. Example:

  <<X21,attribute lists>>

If `<caption>` is not specified then the displayed text is
auto-generated:

- The AsciiDoc 'xhtml11' and 'html5' backends display the `<id>`
  enclosed in square brackets.
- If DocBook is produced the DocBook toolchain is responsible for the
  displayed text which will normally be the referenced figure, table
  or section title number followed by the element's title text.

Here is an example:

---------------------------------------------------------------------
[[tiger_image]]
.Tyger tyger
image::tiger.png[]

This can be seen in <<tiger_image>>.
---------------------------------------------------------------------

Linking to Local Documents
^^^^^^^^^^^^^^^^^^^^^^^^^^
Hypertext links to files on the local file system are specified using
the 'link' inline macro.

  link:<target>[<caption>]

The 'link' macro generates relative URLs. The link macro `<target>` is
the target file name (relative to the file system location of the
referring document). The optional `<caption>` is the link's displayed
text. If `<caption>` is not specified then `<target>` is displayed.
Example:

  link:downloads/foo.zip[download foo.zip]

You can use the `<filename>#<id>` syntax to refer to an anchor within
a target document but this usually only makes sense when targeting
HTML documents.

[[X9]]
Images
^^^^^^
Inline images are inserted into the output document using the 'image'
macro. The inline syntax is:

  image:<target>[<attributes>]

The contents of the image file `<target>` is displayed. To display the
image its file format must be supported by the target backend
application. HTML and DocBook applications normally support PNG or JPG
files.

`<target>` file name paths are relative to the location of the
referring document.

[[X55]]
.Image macro attributes
- The optional 'alt' attribute is also the first positional attribute,
  it specifies alternative text which is displayed if the output
  application is unable to display the image file (see also
  http://htmlhelp.com/feature/art3.htm[Use of ALT texts in IMGs]). For
  example:

  image:images/logo.png[Company Logo]

- The optional 'title' attribute provides a title for the image. The
  <<X49,block image macro>> renders the title alongside the image.
  The inline image macro displays the title as a popup ``tooltip'' in
  visual browsers (AsciiDoc HTML outputs only).

- The optional `width` and `height` attributes scale the image size
  and can be used in any combination. The units are pixels.  The
  following example scales the previous example to a height of 32
  pixels:

  image:images/logo.png["Company Logo",height=32]

- The optional `link` attribute is used to link the image to an
  external document. The following example links a screenshot
  thumbnail to a full size version:

  image:screen-thumbnail.png[height=32,link="screen.png"]

- The optional `scaledwidth` attribute is only used in DocBook block
  images (specifically for PDF documents). The following example
  scales the images to 75% of the available print width:

  image::images/logo.png[scaledwidth="75%",alt="Company Logo"]

- The image `scale` attribute sets the DocBook `imagedata` element
  `scale` attribute.

- The optional `align` attribute is used for horizontal image
  alignment.  Allowed values are `center`, `left` and `right`. For
  example:

  image::images/tiger.png["Tiger image",align="left"]

- The optional `float` attribute floats the image `left` or `right` on
  the page (works with HTML outputs only, has no effect on DocBook
  outputs). `float` and `align` attributes are mutually exclusive.
  Use the `unfloat::[]` block macro to stop floating.

Comment Lines
^^^^^^^^^^^^^
See <<X25,comment block macro>>.

Block Macros
~~~~~~~~~~~~
A Block macro reference must be contained in a single line separated
either side by a blank line or a block delimiter.

Block macros behave just like Inline macros, with the following
differences:

- They occur in a block context.
- The default syntax is `<name>::<target>[<attrlist>]` (two
  colons, not one).
- Markup template section names end in `-blockmacro` instead of
  `-inlinemacro`.

Block Identifier
^^^^^^^^^^^^^^^^
The Block Identifier macro sets the `id` attribute and has the same
syntax as the <<X30,anchor inline macro>> since it performs
essentially the same function -- block templates use the `id`
attribute as a block element ID. For example:

  [[X30]]

This is equivalent to the `[id="X30"]` <<X79,AttributeList element>>).

[[X49]]
Images
^^^^^^
The 'image' block macro is used to display images in a block context.
The syntax is:

  image::<target>[<attributes>]

The block `image` macro has the same <<X55,macro attributes>> as it's
<<X9,inline image macro>> counterpart.

Block images can be titled by preceding the 'image' macro with a
'BlockTitle'.  DocBook toolchains normally number titled block images
and optionally list them in an automatically generated 'List of
Figures' backmatter section.

This example:

  .Main circuit board
  image::images/layout.png[J14P main circuit board]

is equivalent to:

  image::images/layout.png["J14P main circuit board",
                            title="Main circuit board"]

A title prefix that can be inserted with the `caption` attribute
(HTML backends). For example:

  .Main circuit board
  [caption="Figure 2: "]
  image::images/layout.png[J14P main circuit board]

[[X66]]
.Embedding images in XHTML documents
*********************************************************************
If you define the `data-uri` attribute then images will be embedded in
XHTML outputs using the
http://en.wikipedia.org/wiki/Data:_URI_scheme[data URI scheme].  You
can use the 'data-uri' attribute with the 'xhtml11' and 'html5'
backends to produce single-file XHTML documents with embedded images
and CSS, for example:

  $ asciidoc -a data-uri mydocument.txt

[NOTE]
======
- All current popular browsers support data URIs, although versions
  of Internet Explorer prior to version 8 do not.
- Some browsers limit the size of data URIs.
======
*********************************************************************

[[X25]]
Comment Lines
^^^^^^^^^^^^^
Single lines starting with two forward slashes hard up against the
left margin are treated as comments. Comment lines do not appear in
the output unless the 'showcomments' attribute is defined.  Comment
lines have been implemented as both block and inline macros so a
comment line can appear as a stand-alone block or within block elements
that support inline macro expansion. Example comment line:

  // This is a comment.

If the 'showcomments' attribute is defined comment lines are written
to the output:

- In DocBook the comment lines are enclosed by the 'remark' element
  (which may or may not be rendered by your toolchain).
- The 'showcomments' attribute does not expose <<X26,Comment Blocks>>.
  Comment Blocks are never passed to the output.

System Macros
~~~~~~~~~~~~~
System macros are block macros that perform a predefined task and are
hardwired into the asciidoc(1) program.

- You can escape system macros with a leading backslash character
  (as you can with other macros).
- The syntax and tasks performed by system macros is built into
  asciidoc(1) so they don't appear in configuration files.  You can
  however customize the syntax by adding entries to a configuration
  file `[macros]` section.

[[X63]]
Include Macros
^^^^^^^^^^^^^^
The `include` and `include1`  system macros to include the contents of
a named file into the source document.

The `include` macro includes a file as if it were part of the parent
document -- tabs are expanded and system macros processed. The
contents of `include1` files are not subject to tab expansion or
system macro processing nor are attribute or lower priority
substitutions performed. The `include1` macro's intended use is to
include verbatim embedded CSS or scripts into configuration file
headers.  Example:

------------------------------------
\include::chapter1.txt[tabsize=4]
------------------------------------

.Include macro behavior
- If the included file name is specified with a relative path then the
  path is relative to the location of the referring document.
- Include macros can appear inside configuration files.
- Files included from within 'DelimitedBlocks' are read to completion
  to avoid false end-of-block underline termination.
- Attribute references are expanded inside the include 'target'; if an
  attribute is undefined then the included file is silently skipped.
- The 'tabsize' macro attribute sets the number of space characters to
  be used for tab expansion in the included file (not applicable to
  `include1` macro).
- The 'depth' macro attribute sets the maximum permitted number of
  subsequent nested includes (not applicable to `include1` macro which
  does not process nested includes). Setting 'depth' to '1' disables
  nesting inside the included file. By default, nesting is limited to
  a depth of ten.
- If the he 'warnings' attribute is set to 'False' (or any other
  Python literal that evaluates to boolean false) then no warning
  message is printed if the included file does not exist. By default
  'warnings' are enabled.
- Internally the `include1` macro is translated to the `include1`
  system attribute which means it must be evaluated in a region where
  attribute substitution is enabled. To inhibit nested substitution in
  included files it is preferable to use the `include` macro and set
  the attribute `depth=1`.

Conditional Inclusion Macros
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Lines of text in the source document can be selectively included or
excluded from processing based on the existence (or not) of a document
attribute.

Document text between the `ifdef` and `endif` macros is included if a
document attribute is defined:

  ifdef::<attribute>[]
  :
  endif::<attribute>[]

Document text between the `ifndef` and `endif` macros is not included
if a document attribute is defined:

  ifndef::<attribute>[]
  :
  endif::<attribute>[]

`<attribute>` is an attribute name which is optional in the trailing
`endif` macro.

If you only want to process a single line of text then the text can be
put inside the square brackets and the `endif` macro omitted, for
example:

  ifdef::revnumber[Version number 42]

Is equivalent to:

  ifdef::revnumber[]
  Version number 42
  endif::revnumber[]

'ifdef' and 'ifndef' macros also accept multiple attribute names:

- Multiple ',' separated attribute names evaluate to defined if one
  or more of the attributes is defined, otherwise it's value is
  undefined.
- Multiple '+' separated attribute names evaluate to defined if all
  of the attributes is defined, otherwise it's value is undefined.

Document text between the `ifeval` and `endif` macros is included if
the Python expression inside the square brackets is true. Example:

  ifeval::[{rs458}==2]
  :
  endif::[]

- Document attribute references are expanded before the expression is
  evaluated.
- If an attribute reference is undefined then the expression is
  considered false.

Take a look at the `*.conf` configuration files in the AsciiDoc
distribution for examples of conditional inclusion macro usage.

Executable system macros
^^^^^^^^^^^^^^^^^^^^^^^^
The 'eval', 'sys' and 'sys2' block macros exhibit the same behavior as
their same named <<X24, system attribute references>>. The difference
is that system macros occur in a block macro context whereas system
attributes are confined to inline contexts where attribute
substitution is enabled.

The following example displays a long directory listing inside a
literal block:

  ------------------
  sys::[ls -l *.txt]
  ------------------

NOTE: There are no block macro versions of the 'eval3' and 'sys3'
system attributes.

Template System Macro
^^^^^^^^^^^^^^^^^^^^^
The `template` block macro allows the inclusion of one configuration
file template section within another.  The following example includes
the `[admonitionblock]` section in the `[admonitionparagraph]`
section:

  [admonitionparagraph]
  template::[admonitionblock]

.Template macro behavior
- The `template::[]` macro is useful for factoring configuration file
  markup.
- `template::[]` macros cannot be nested.
- `template::[]` macro expansion is applied after all configuration
  files have been read.


[[X77]]
Passthrough macros
~~~~~~~~~~~~~~~~~~
Passthrough macros are analogous to <<X76,passthrough blocks>> and are
used to pass text directly to the output. The substitution performed
on the text is determined by the macro definition but can be overridden
by the `<subslist>`.  The usual syntax is
`<name>:<subslist>[<passtext>]` (for inline macros) and
`<name>::<subslist>[<passtext>]` (for block macros). Passthroughs, by
definition, take precedence over all other text substitutions.

pass::
  Inline and block. Passes text unmodified (apart from explicitly
  specified substitutions). Examples:

  pass:[<q>To be or not to be</q>]
  pass:attributes,quotes[<u>the '{author}'</u>]

asciimath, latexmath::
  Inline and block. Passes text unmodified.  Used for
  <<X78,mathematical formulas>>.

\+++::
  Inline and block. The triple-plus passthrough is functionally
  identical to the 'pass' macro but you don't have to escape `]`
  characters and you can prefix with quoted attributes in the inline
  version. Example:

  Red [red]+++`sum_(i=1)\^n i=(n(n+1))/2`$+++ AsciiMathML formula

$$::
  Inline and block. The double-dollar passthrough is functionally
  identical to the triple-plus passthrough with one exception: special
  characters are escaped. Example:

  $$`[[a,b],[c,d]]((n),(k))`$$

[[X80]]`::
  Text quoted with single backtick characters constitutes an 'inline
  literal' passthrough. The enclosed text is rendered in a monospaced
  font and is only subject to special character substitution.  This
  makes sense since monospace text is usually intended to be rendered
  literally and often contains characters that would otherwise have to
  be escaped. If you need monospaced text containing inline
  substitutions use a <<X81,plus character instead of a backtick>>.

Macro Definitions
~~~~~~~~~~~~~~~~~
Each entry in the configuration `[macros]` section is a macro
definition which can take one of the following forms:

`<pattern>=<name>[<subslist]`:: Inline macro definition.
`<pattern>=#<name>[<subslist]`:: Block macro definition.
`<pattern>=+<name>[<subslist]`:: System macro definition.
`<pattern>`:: Delete the existing macro with this `<pattern>`.

`<pattern>` is a Python regular expression and `<name>` is the name of
a markup template. If `<name>` is omitted then it is the value of the
regular expression match group named 'name'.  The optional
`[<subslist]` is a comma-separated list of substitution names enclosed
in `[]` brackets, it sets the default substitutions for passthrough
text, if omitted then no passthrough substitutions are performed.

.Pattern named groups
The following named groups can be used in macro `<pattern>` regular
expressions and are available as markup template attributes:

name::
  The macro name.

target::
  The macro target.

attrlist::
  The macro attribute list.

passtext::
  Contents of this group are passed unmodified to the output subject
  only to 'subslist' substitutions.

subslist::
  Processed as a comma-separated list of substitution names for
  'passtext' substitution, overrides the the macro definition
  'subslist'.

.Here's what happens during macro substitution
- Each contextually relevant macro 'pattern' from the `[macros]`
  section is matched against the input source line.
- If a match is found the text to be substituted is loaded from a
  configuration markup template section named like
  `<name>-inlinemacro` or `<name>-blockmacro` (depending on the macro
  type).
- Global and macro attribute list attributes are substituted in the
  macro's markup template.
- The substituted template replaces the macro reference in the output
  document.


[[X98]]
HTML 5 audio and video block macros
-----------------------------------
The 'html5' backend 'audio' and 'video' block macros generate the HTML
5 'audio' and 'video' elements respectively.  They follow the usual
AsciiDoc block macro syntax `<name>::<target>[<attrlist>]` where:

[horizontal]
`<name>`:: 'audio' or 'video'.
`<target>`:: The URL or file name of the video or audio file.
`<attrlist>`:: A list of named attributes (see below).

.Audio macro attributes
[options="header",cols="1,5",frame="topbot"]
|====================================================================
|Name | Value
|options
|A comma separated list of one or more of the following items:
'autoplay', 'loop' which correspond to the same-named HTML 5 'audio'
element boolean attributes.  By default the player 'controls' are
enabled, include the 'nocontrols' option value to hide them.
|====================================================================

.Video macro attributes
[options="header",cols="1,5",frame="topbot"]
|====================================================================
|Name   | Value
|height | The height of the player in pixels.
|width  | The width of the player in pixels.
|poster | The URL or file name of an image representing the video.
|options
|A comma separated list of one or more of the following items:
'autoplay', 'loop' and 'nocontrols'. The 'autoplay' and 'loop' options
correspond to the same-named HTML 5 'video' element boolean
attributes.  By default the player 'controls' are enabled, include the
'nocontrols' option value to hide them.
|====================================================================

Examples:

---------------------------------------------------------------------
audio::images/example.ogg[]

video::gizmo.ogv[width=200,options="nocontrols,autoplay"]

.Example video
video::gizmo.ogv[]

video::http://www.808.dk/pics/video/gizmo.ogv[]
---------------------------------------------------------------------

If your needs are more complex put raw HTML 5 in a markup block, for
example (from http://www.808.dk/?code-html-5-video):

---------------------------------------------------------------------
++++
<video poster="pics/video/gizmo.jpg" id="video" style="cursor: pointer;" >
  <source src="pics/video/gizmo.mp4" />
  <source src="pics/video/gizmo.webm" type="video/webm" />
  <source src="pics/video/gizmo.ogv" type="video/ogg" />
  Video not playing? <a href="pics/video/gizmo.mp4">Download file</a> instead.
</video>

<script type="text/javascript">
  var video = document.getElementById('video');
  video.addEventListener('click',function(){
    video.play();
  },false);
</script>
++++
---------------------------------------------------------------------


Tables
------
The AsciiDoc table syntax looks and behaves like other delimited block
types and supports standard <<X73,block configuration entries>>.
Formatting is easy to read and, just as importantly, easy to enter.

- Cells and columns can be formatted using built-in customizable styles.
- Horizontal and vertical cell alignment can be set on columns and
  cell.
- Horizontal and vertical cell spanning is supported.

.Use tables sparingly
*********************************************************************
When technical users first start creating documents, tables (complete
with column spanning and table nesting) are often considered very
important. The reality is that tables are seldom used, even in
technical documentation.

Try this exercise: thumb through your library of technical books,
you'll be surprised just how seldom tables are actually used, even
less seldom are tables containing block elements (such as paragraphs
or lists) or spanned cells. This is no accident, like figures, tables
are outside the normal document flow -- tables are for consulting not
for reading.

Tables are designed for, and should normally only be used for,
displaying column oriented tabular data.
*********************************************************************

Example tables
~~~~~~~~~~~~~~

.Simple table
[width="15%"]
|=======
|1 |2 |A
|3 |4 |B
|5 |6 |C
|=======

.AsciiDoc source
---------------------------------------------------------------------
[width="15%"]
|=======
|1 |2 |A
|3 |4 |B
|5 |6 |C
|=======
---------------------------------------------------------------------

.Columns formatted with strong, monospaced and emphasis styles
[width="50%",cols=">s,^m,e",frame="topbot",options="header,footer"]
|==========================
|      2+|Columns 2 and 3
|1       |Item 1  |Item 1
|2       |Item 2  |Item 2
|3       |Item 3  |Item 3
|4       |Item 4  |Item 4
|footer 1|footer 2|footer 3
|==========================

.AsciiDoc source
---------------------------------------------------------------------
.An example table
[width="50%",cols=">s,^m,e",frame="topbot",options="header,footer"]
|==========================
|      2+|Columns 2 and 3
|1       |Item 1  |Item 1
|2       |Item 2  |Item 2
|3       |Item 3  |Item 3
|4       |Item 4  |Item 4
|footer 1|footer 2|footer 3
|==========================
---------------------------------------------------------------------

.Horizontal and vertical source data
[width="80%",cols="3,^2,^2,10",options="header"]
|=========================================================
|Date |Duration |Avg HR |Notes

|22-Aug-08 |10:24 | 157 |
Worked out MSHR (max sustainable heart rate) by going hard
for this interval.

|22-Aug-08 |23:03 | 152 |
Back-to-back with previous interval.

|24-Aug-08 |40:00 | 145 |
Moderately hard interspersed with 3x 3min intervals (2min
hard + 1min really hard taking the HR up to 160).

|=========================================================

Short cells can be entered horizontally, longer cells vertically.  The
default behavior is to strip leading and trailing blank lines within a
cell. These characteristics aid readability and data entry.

.AsciiDoc source
---------------------------------------------------------------------
.Windtrainer workouts
[width="80%",cols="3,^2,^2,10",options="header"]
|=========================================================
|Date |Duration |Avg HR |Notes

|22-Aug-08 |10:24 | 157 |
Worked out MSHR (max sustainable heart rate) by going hard
for this interval.

|22-Aug-08 |23:03 | 152 |
Back-to-back with previous interval.

|24-Aug-08 |40:00 | 145 |
Moderately hard interspersed with 3x 3min intervals (2min
hard + 1min really hard taking the HR up to 160).

|=========================================================
---------------------------------------------------------------------

.A table with externally sourced CSV data
[format="csv",cols="^1,4*2",options="header"]
|===================================================
ID,Customer Name,Contact Name,Customer Address,Phone
include::customers.csv[]
|===================================================

.AsciiDoc source
---------------------------------------------------------------------
[format="csv",cols="^1,4*2",options="header"]
|===================================================
ID,Customer Name,Contact Name,Customer Address,Phone
\include::customers.csv[]
|===================================================
---------------------------------------------------------------------


.Cell spans, alignments and styles
[cols="e,m,^,>s",width="25%"]
|============================
|1 >s|2 |3 |4
^|5 2.2+^.^|6 .3+<.>m|7
^|8
|9 2+>|10
|============================

.AsciiDoc source
---------------------------------------------------------------------
[cols="e,m,^,>s",width="25%"]
|============================
|1 >s|2 |3 |4
^|5 2.2+^.^|6 .3+<.>m|7
^|8
|9 2+>|10
|============================
---------------------------------------------------------------------

[[X68]]
Table input data formats
~~~~~~~~~~~~~~~~~~~~~~~~
AsciiDoc table data can be 'psv', 'dsv' or 'csv' formatted.  The
default table format is 'psv'.

AsciiDoc 'psv' ('Prefix Separated Values') and 'dsv' ('Delimiter
Separated Values') formats are cell oriented -- the table is treated
as a sequence of cells -- there are no explicit row separators.

- 'psv' prefixes each cell with a separator whereas 'dsv' delimits
  cells with a separator.
- 'psv' and 'dsv' separators are Python regular expressions.
- The default 'psv' separator contains <<X84, cell specifier>> related
  named regular expression groups.
- The default 'dsv' separator is `:|\n` (a colon or a new line
  character).
- 'psv' and 'dsv' cell separators can be escaped by preceding them
  with a backslash character.

Here are four 'psv' cells (the second item spans two columns; the
last contains an escaped separator):

  |One 2+|Two and three |A \| separator character

'csv'  is the quasi-standard row oriented 'Comma Separated Values
(CSV)' format commonly used to import and export spreadsheet and
database data.

[[X69]]
Table attributes
~~~~~~~~~~~~~~~~
Tables can be customized by the following attributes:

format::
'psv' (default), 'dsv' or 'csv' (See <<X68, Table Data Formats>>).

separator::
The cell separator. A Python regular expression ('psv' and 'dsv'
formats) or a single character ('csv' format).

frame::
Defines the table border and can take the following values: 'topbot'
(top and bottom), 'all' (all sides), 'none' and 'sides' (left and
right sides). The default value is 'all'.

grid::
Defines which ruler lines are drawn between table rows and columns.
The 'grid' attribute value can be any of the following values: 'none',
'cols', 'rows' and 'all'. The default value is 'all'.

align::
Use the 'align' attribute to horizontally align the table on the
page (works with HTML outputs only, has no effect on DocBook outputs).
The following values are valid: 'left', 'right', and 'center'.

float::
Use the 'float' attribute to float the table 'left' or 'right' on the
page (works with HTML outputs only, has no effect on DocBook outputs).
Floating only makes sense in conjunction with a table 'width'
attribute value of less than 100% (otherwise the table will take up
all the available space).  'float' and 'align' attributes are mutually
exclusive.  Use the `unfloat::[]` block macro to stop floating.

halign::
Use the 'halign' attribute to horizontally align all cells in a table.
The following values are valid: 'left', 'right', and 'center'
(defaults to 'left'). Overridden by <<X70,Column specifiers>>  and
<<X84,Cell specifiers>>.

valign::
Use the 'valign' attribute to vertically align all cells in a table.
The following values are valid: 'top', 'bottom', and 'middle'
(defaults to 'top'). Overridden by <<X70,Column specifiers>>  and
<<X84,Cell specifiers>>.

options::
The 'options' attribute can contain comma separated values, for
example: 'header', 'footer'. By default header and footer rows are
omitted.  See <<X74,attribute options>> for a complete list of
available table options.

cols::
The 'cols' attribute is a comma separated list of <<X70,column
specifiers>>. For example `cols="2<p,2*,4p,>"`.

- If 'cols' is present it must specify all columns.
- If the 'cols' attribute is not specified the number of columns is
  calculated as the number of data items in the *first line* of the
  table.
- The degenerate form for the 'cols' attribute is an integer
  specifying the number of columns e.g. `cols=4`.

width::
The 'width' attribute is expressed as a percentage value
('"1%"'...'"99%"'). The width specifies the table width relative to
the available width. HTML backends use this value to set the table
width attribute. It's a bit more complicated with DocBook, see the
<<X89,DocBook table widths>> sidebar.

filter::
The 'filter' attribute defines an external shell command that is
invoked for each cell. The built-in 'asciidoc' table style is
implemented using a filter.

[[X89]]
.DocBook table widths
**********************************************************************
The AsciiDoc docbook backend generates CALS tables. CALS tables do not
support a table width attribute -- table width can only be controlled
by specifying absolute column widths.

Specifying absolute column widths is not media independent because
different presentation media have different physical dimensions. To
get round this limitation both
http://www.sagehill.net/docbookxsl/Tables.html#TableWidth[DocBook XSL
Stylesheets] and
http://dblatex.sourceforge.net/doc/manual/ch03s05.html#sec-table-width[dblatex]
have implemented table width processing instructions for setting the
table width as a percentage of the available width. AsciiDoc emits
these processing instructions if the 'width' attribute is set along
with proportional column widths (the AsciiDoc docbook backend
'pageunits' attribute defaults to '*').

To generate DocBook tables with absolute column widths set the
'pageunits' attribute to a CALS absolute unit such as 'pt' and set the
'pagewidth' attribute to match the width of the presentation media.
**********************************************************************

[[X70]]
Column Specifiers
~~~~~~~~~~~~~~~~~
Column specifiers define how columns are rendered and appear in the
table <<X69,cols attribute>>.  A column specifier consists of an
optional column multiplier followed by optional alignment, width and
style values and is formatted like:

  [<multiplier>*][<align>][<width>][<style>]

- All components are optional. The multiplier must be first and the
  style last. The order of `<align>` or `<width>` is not important.
- Column `<width>` can be either an integer proportional value (1...)
  or a percentage (1%...100%). The default value is 1. To ensure
  portability across different backends, there is no provision for
  absolute column widths (not to be confused with output column width
  <<X72,markup attributes>> which are available in both percentage and
  absolute units).
- The '<align>' column alignment specifier is formatted like:

  [<horizontal>][.<vertical>]
+
Where `<horizontal>` and `<vertical>` are one of the following
characters: `<`, `^` or `>` which represent 'left', 'center' and
'right' horizontal alignment or 'top', 'middle' and 'bottom' vertical
alignment respectively.

- A `<multiplier>` can be used to specify repeated columns e.g.
  `cols="4*<"` specifies four left-justified columns. The default
  multiplier value is 1.
- The `<style>` name specifies a <<X71,table style>> to used to markup
  column cells (you can use the full style names if you wish but the
  first letter is normally sufficient).
- Column specific styles are not applied to header rows.

[[X84]]
Cell Specifiers
~~~~~~~~~~~~~~~
Cell specifiers allow individual cells in 'psv' formatted tables to be
spanned, multiplied, aligned and styled.  Cell specifiers prefix 'psv'
`|` delimiters and are formatted like:

  [<span>*|+][<align>][<style>]

- '<span>' specifies horizontal and vertical cell spans ('+' operator) or
  the number of times the cell is replicated ('*' operator). '<span>'
  is formatted like:

  [<colspan>][.<rowspan>]
+
Where `<colspan>` and `<rowspan>` are integers specifying the number of
columns and rows to span.

- `<align>` specifies horizontal and vertical cell alignment an is the
  same as in <<X70,column specifiers>>.
- A `<style>` value is the first letter of <<X71,table style>> name.

For example, the following 'psv' formatted cell will span two columns
and the text will be centered and emphasized:

  `2+^e| Cell text`

[[X71]]
Table styles
~~~~~~~~~~~~
Table styles can be applied to the entire table (by setting the
'style' attribute in the table's attribute list) or on a per column
basis (by specifying the style in the table's <<X69,cols attribute>>).
Table data can be formatted using the following predefined styles:

default::
The default style: AsciiDoc inline text formatting; blank lines are
treated as paragraph breaks.

emphasis::
Like default but all text is emphasised.

monospaced::
Like default but all text is in a monospaced font.

strong::
Like default but all text is bold.

header::
Apply the same style as the table header. Normally used to create a
vertical header in the first column.

asciidoc::
With this style table cells can contain any of the AsciiDoc elements
that are allowed inside document sections. This style runs asciidoc(1)
as a filter to process cell contents. See also <<X83,Docbook table
limitations>>.

literal::
No text formatting; monospaced font; all line breaks are retained
(the same as the AsciiDoc <<X65,LiteralBlock>> element).

verse::
All line breaks are retained (just like the AsciiDoc <<X94,verse
paragraph style>>).

[[X72]]
Markup attributes
~~~~~~~~~~~~~~~~~
AsciiDoc makes a number of attributes available to table markup
templates and tags. Column specific attributes are available when
substituting the 'colspec' cell data tags.

pageunits::
DocBook backend only. Specifies table column absolute width units.
Defaults to '*'.

pagewidth::
DocBook backend only. The nominal output page width in 'pageunit'
units. Used to calculate CALS tables absolute column and table
widths. Defaults to '425'.

tableabswidth::
Integer value calculated from 'width' and 'pagewidth' attributes.
In 'pageunit' units.

tablepcwidth::
Table width expressed as a percentage of the available width. Integer
value (0..100).

colabswidth::
Integer value calculated from 'cols' column width, 'width' and
'pagewidth' attributes.  In 'pageunit' units.

colpcwidth::
Column width expressed as a percentage of the table width. Integer
value (0..100).

colcount::
Total number of table columns.

rowcount::
Total number of table rows.

halign::
Horizontal cell content alignment: 'left', 'right' or 'center'.

valign::
Vertical cell content alignment: 'top', 'bottom' or 'middle'.

colnumber, colstart::
The number of the leftmost column occupied by the cell (1...).

colend::
The number of the rightmost column occupied by the cell (1...).

colspan::
Number of columns the cell should span.

rowspan::
Number of rows the cell should span (1...).

morerows::
Number of additional rows the cell should span (0...).

Nested tables
~~~~~~~~~~~~~
An alternative 'psv' separator character '!' can be used (instead of
'|') in nested tables. This allows a single level of table nesting.
Columns containing nested tables must use the 'asciidoc' style. An
example can be found in `./examples/website/newtables.txt`.

[[X83]]
DocBook table limitations
~~~~~~~~~~~~~~~~~~~~~~~~~
Fully implementing tables is not trivial, some DocBook toolchains do
better than others.  AsciiDoc HTML table outputs are rendered
correctly in all the popular browsers -- if your DocBook generated
tables don't look right compare them with the output generated by the
AsciiDoc 'xhtml11' backend or try a different DocBook toolchain.  Here
is a list of things to be aware of:

- Although nested tables are not legal in DocBook 4 the FOP and
  dblatex toolchains will process them correctly.  If you use `a2x(1)`
  you will need to include the `--no-xmllint` option to suppress
  DocBook validation errors.
+
NOTE: In theory you can nest DocBook 4 tables one level using the
'entrytbl' element, but not all toolchains process 'entrytbl'.

- DocBook only allows a subset of block elements inside table cells so
  not all AsciiDoc elements produce valid DocBook inside table cells.
  If you get validation errors running `a2x(1)` try the `--no-xmllint`
  option, toolchains will often process nested block elements such as
  sidebar blocks and floating titles correctly even though, strictly
  speaking, they are not legal.

- Text formatting in cells using the 'monospaced' table style will
  raise validation errors because the DocBook 'literal' element was
  not designed to support formatted text (using the 'literal' element
  is a kludge on the part of AsciiDoc as there is no easy way to set
  the font style in DocBook.

- Cell alignments are ignored for 'verse', 'literal' or 'asciidoc'
  table styles.


[[X1]]
Manpage Documents
-----------------
Sooner or later, if you program in a UNIX environment, you're going
to have to write a man page.

By observing a couple of additional conventions (detailed below) you
can write AsciiDoc files that will generate HTML and PDF man pages
plus the native manpage roff format.  The easiest way to generate roff
manpages from AsciiDoc source is to use the a2x(1) command. The
following example generates a roff formatted manpage file called
`asciidoc.1` (a2x(1) uses asciidoc(1) to convert `asciidoc.1.txt` to
DocBook which it then converts to roff using DocBook XSL Stylesheets):

  a2x --doctype manpage --format manpage asciidoc.1.txt

.Viewing and printing manpage files
**********************************************************************
Use the `man(1)` command to view the manpage file:

  $ man -l asciidoc.1

To print a high quality man page to a postscript printer:

  $ man -l -Tps asciidoc.1 | lpr

You could also create a PDF version of the man page by converting
PostScript to PDF using `ps2pdf(1)`:

  $ man -l -Tps asciidoc.1 | ps2pdf - asciidoc.1.pdf

The `ps2pdf(1)` command is included in the Ghostscript distribution.
**********************************************************************

To find out more about man pages view the `man(7)` manpage
(`man 7 man` and `man man-pages` commands).


Document Header
~~~~~~~~~~~~~~~
A manpage document Header is mandatory. The title line contains the
man page name followed immediately by the manual section number in
brackets, for example 'ASCIIDOC(1)'. The title name should not contain
white space and the manual section number is a single digit optionally
followed by a single character.

The NAME Section
~~~~~~~~~~~~~~~~
The first manpage section is mandatory, must be titled 'NAME' and must
contain a single paragraph (usually a single line) consisting of a
list of one or more comma separated command name(s) separated from the
command purpose by a dash character. The dash must have at least one
white space character on either side. For example:

  printf, fprintf, sprintf - print formatted output

The SYNOPSIS Section
~~~~~~~~~~~~~~~~~~~~
The second manpage section is mandatory and must be titled 'SYNOPSIS'.

refmiscinfo attributes
~~~~~~~~~~~~~~~~~~~~~~
In addition to the automatically created man page <<X60,intrinsic
attributes>> you can assign DocBook
http://www.docbook.org/tdg5/en/html/refmiscinfo.html[refmiscinfo]
element 'source', 'version' and 'manual' values using AsciiDoc
`{mansource}`, `{manversion}` and `{manmanual}` attributes
respectively. This example is from the AsciiDoc header of a man page
source file:

  :man source:   AsciiDoc
  :man version:  {revnumber}
  :man manual:   AsciiDoc Manual


[[X78]]
Mathematical Formulas
---------------------
The 'asciimath' and 'latexmath' <<X77,passthrough macros>> along with
'asciimath' and 'latexmath'  <<X76,passthrough blocks>> provide a
(backend dependent) mechanism for rendering mathematical formulas. You
can use the following math markups:

NOTE: The 'latexmath' macro used to include 'LaTeX Math' in DocBook
outputs is not the same as the 'latexmath' macro used to include
'LaTeX MathML' in XHTML outputs.  'LaTeX Math' applies to DocBook
outputs that are processed by <<X31,dblatex>> and is normally used to
generate PDF files.  'LaTeXMathML' is very much a subset of 'LaTeX
Math' and applies to XHTML documents.

LaTeX Math
~~~~~~~~~~
ftp://ftp.ams.org/pub/tex/doc/amsmath/short-math-guide.pdf[LaTeX
math] can be included in documents that are processed by
<<X31,dblatex(1)>>.  Example inline formula:

  latexmath:[$C = \alpha + \beta Y^{\gamma} + \epsilon$]

For more examples see the {website}[AsciiDoc website] or the
distributed `doc/latexmath.txt` file.

ASCIIMathML
~~~~~~~~~~~
/////////////////////////////////////////////////////////////////////
The older ASCIIMathML 1.47 version is used instead of version 2
because:

1. Version 2 doesn't work when embedded.
2. Version 2 is much larger.
/////////////////////////////////////////////////////////////////////

http://www1.chapman.edu/~jipsen/mathml/asciimath.html[ASCIIMathML]
formulas can be included in XHTML documents generated using the
'xhtml11' and 'html5' backends. To enable ASCIIMathML support you must
define the 'asciimath' attribute, for example using the `-a asciimath`
command-line option.  Example inline formula:

  asciimath:[`x/x={(1,if x!=0),(text{undefined},if x=0):}`]

For more examples see the {website}[AsciiDoc website] or the
distributed `doc/asciimathml.txt` file.

LaTeXMathML
~~~~~~~~~~~
/////////////////////////////////////////////////////////////////////
There is an http://math.etsu.edu/LaTeXMathML/[extended LaTeXMathML
version] by Jeff Knisley, in addition to a JavaScript file it requires
the inclusion of a CSS file.
/////////////////////////////////////////////////////////////////////

'LaTeXMathML' allows LaTeX Math style formulas to be included in XHTML
documents generated using the AsciiDoc 'xhtml11' and 'html5' backends.
AsciiDoc uses the
http://www.maths.nottingham.ac.uk/personal/drw/lm.html[original
LaTeXMathML] by Douglas Woodall.  'LaTeXMathML' is derived from
ASCIIMathML and is for users who are more familiar with or prefer
using LaTeX math formulas (it recognizes a subset of LaTeX Math, the
differences are documented on the 'LaTeXMathML' web page).  To enable
LaTeXMathML support you must define the 'latexmath' attribute, for
example using the `-a latexmath` command-line option.  Example inline
formula:

  latexmath:[$\sum_{n=1}^\infty \frac{1}{2^n}$]

For more examples see the {website}[AsciiDoc website] or the
distributed `doc/latexmathml.txt` file.

MathML
~~~~~~
http://www.w3.org/Math/[MathML] is a low level XML markup for
mathematics. AsciiDoc has no macros for MathML but users familiar with
this markup could use passthrough macros and passthrough blocks to
include MathML in output documents.


[[X7]]
Configuration Files
-------------------
AsciiDoc source file syntax and output file markup is largely
controlled by a set of cascading, text based, configuration files.  At
runtime The AsciiDoc default configuration files are combined with
optional user and document specific configuration files.

Configuration File Format
~~~~~~~~~~~~~~~~~~~~~~~~~
Configuration files contain named sections. Each section begins with a
section name in square brackets []. The section body consists of the
lines of text between adjacent section headings.

- Section names consist of one or more alphanumeric, underscore or
  dash characters and cannot begin or end with a dash.
- Lines starting with a '#' character are treated as comments and
  ignored.
- If the section name is prefixed with a '+' character then the
  section contents is appended to the contents of an already existing
  same-named section.
- Otherwise same-named sections and section entries override
  previously loaded sections and section entries (this is sometimes
  referred to as 'cascading').  Consequently, downstream configuration
  files need only contain those sections and section entries that need
  to be overridden.

TIP: When creating custom configuration files you only need to include
the sections and entries that differ from the default configuration.

TIP: The best way to learn about configuration files is to read the
default configuration files in the AsciiDoc distribution in
conjunction with asciidoc(1) output files. You can view configuration
file load sequence by turning on the asciidoc(1) `-v` (`--verbose`)
command-line option.

AsciiDoc reserves the following section names for specific purposes:

miscellaneous::
        Configuration options that don't belong anywhere else.
attributes::
        Attribute name/value entries.
specialcharacters::
        Special characters reserved by the backend markup.
tags::
        Backend markup tags.
quotes::
        Definitions for quoted inline character formatting.
specialwords::
        Lists of words and phrases singled out for special markup.
replacements, replacements2, replacements3::
        Find and replace substitution definitions.
specialsections::
        Used to single out special section names for specific markup.
macros::
        Macro syntax definitions.
titles::
        Heading, section and block title definitions.
paradef-*::
        Paragraph element definitions.
blockdef-*::
        DelimitedBlock element definitions.
listdef-*::
        List element definitions.
listtags-*::
        List element tag definitions.
tabledef-*::
        Table element definitions.
tabletags-*::
        Table element tag definitions.

Each line of text in these sections is a 'section entry'. Section
entries share the following syntax:

name=value::
        The entry value is set to value.
name=::
        The entry value is set to a zero length string.
name!::
        The entry is undefined (deleted from the configuration). This
        syntax only applies to 'attributes' and 'miscellaneous'
        sections.

.Section entry behavior
- All equals characters inside the `name` must be escaped with a
  backslash character.
- `name` and `value` are stripped of leading and trailing white space.
- Attribute names, tag entry names and markup template section names
  consist of one or more alphanumeric, underscore or dash characters.
  Names should not begin or end with a dash.
- A blank configuration file section (one without any entries) deletes
  any preceding section with the same name (applies to non-markup
  template sections).


Miscellaneous section
~~~~~~~~~~~~~~~~~~~~~
The optional `[miscellaneous]` section specifies the following
`name=value` options:

newline::
        Output file line termination characters. Can include any
        valid Python string escape sequences. The default value is
        `\r\n` (carriage return, line feed). Should not be quoted or
        contain explicit spaces (use `\x20` instead). For example:

        $ asciidoc -a 'newline=\n' -b docbook mydoc.txt

outfilesuffix::
        The default extension for the output file, for example
        `outfilesuffix=.html`. Defaults to backend name.
tabsize::
        The number of spaces to expand tab characters, for example
        `tabsize=4`. Defaults to 8. A 'tabsize' of zero suppresses tab
        expansion (useful when piping included files through block
        filters). Included files can override this option using the
        'tabsize' attribute.
pagewidth, pageunits::
        These global table related options are documented in the
        <<X4,Table Configuration File Definitions>> sub-section.

NOTE: `[miscellaneous]` configuration file entries can be set using
the asciidoc(1) `-a` (`--attribute`) command-line option.

Titles section
~~~~~~~~~~~~~~
sectiontitle::
        Two line section title pattern. The entry value is a Python
        regular expression containing the named group 'title'.

underlines::
        A comma separated list of document and section title underline
        character pairs starting with the section level 0 and ending
        with section level 4 underline. The default setting is:

        underlines="==","--","~~","^^","++"

sect0...sect4::
        One line section title patterns. The entry value is a Python
        regular expression containing the named group 'title'.

blocktitle::
        <<X42,BlockTitle element>> pattern.  The entry value is a
        Python regular expression containing the named group 'title'.

subs::
        A comma separated list of substitutions that are performed on
        the document header and section titles. Defaults to 'normal'
        substitution.

Tags section
~~~~~~~~~~~~
The `[tags]` section contains backend tag definitions (one per
line). Tags are used to translate AsciiDoc elements to backend
markup.

An AsciiDoc tag definition is formatted like
`<tagname>=<starttag>|<endtag>`. For example:

  emphasis=<em>|</em>

In this example asciidoc(1) replaces the | character with the
emphasized text from the AsciiDoc input file and writes the result to
the output file.

Use the `{brvbar}` attribute reference if you need to include a | pipe
character inside tag text.

Attributes section
~~~~~~~~~~~~~~~~~~
The optional `[attributes]` section contains predefined attributes.

If the attribute value requires leading or trailing spaces then the
text text should be enclosed in quotation mark (") characters.

To delete a attribute insert a `name!` entry in a downstream
configuration file or use the asciidoc(1) `--attribute name!`
command-line option (an attribute name suffixed with a `!` character
deletes the attribute)

Special Characters section
~~~~~~~~~~~~~~~~~~~~~~~~~~
The `[specialcharacters]` section specifies how to escape characters
reserved by the backend markup. Each translation is specified on a
single line formatted like:

  <special_character>=<translated_characters>

Special characters are normally confined to those that resolve
markup ambiguity (in the case of HTML and XML markups the ampersand,
less than and greater than characters).  The following example causes
all occurrences of the `<` character to be replaced by `<`.

  <=<

Quoted Text section
~~~~~~~~~~~~~~~~~~~
Quoting is used primarily for text formatting.  The `[quotes]` section
defines AsciiDoc quoting characters and their corresponding backend
markup tags.  Each section entry value is the name of a of a `[tags]`
section entry. The entry name is the character (or characters) that
quote the text.  The following examples are taken from AsciiDoc
configuration files:

  [quotes]
  _=emphasis

  [tags]
  emphasis=<em>|</em>

You can specify the left and right quote strings separately by
separating them with a | character, for example:

  ``|''=quoted

Omitting the tag will disable quoting, for example, if you don't want
superscripts or subscripts put the following in a custom configuration
file or edit the global `asciidoc.conf` configuration file:

  [quotes]
  ^=
  ~=

<<X52,Unconstrained quotes>> are differentiated from constrained
quotes by prefixing the tag name with a hash character, for example:

  __=#emphasis

.Quoted text behavior
- Quote characters must be non-alphanumeric.
- To minimize quoting ambiguity try not to use the same quote
  characters in different quote types.

Special Words section
~~~~~~~~~~~~~~~~~~~~~
The `[specialwords]` section is used to single out words and phrases
that you want to consistently format in some way throughout your
document without having to repeatedly specify the markup. The name of
each entry corresponds to a markup template section and the entry
value consists of a list of words and phrases to be marked up. For
example:

  [specialwords]
  strongwords=NOTE IMPORTANT

  [strongwords]
  <strong>{words}</strong>

The examples specifies that any occurrence of `NOTE` or `IMPORTANT`
should appear in a bold font.

Words and word phrases are treated as Python regular expressions: for
example, the word `^NOTE` would only match `NOTE` if appeared at
the start of a line.

AsciiDoc comes with three built-in Special Word types:
'emphasizedwords', 'monospacedwords' and 'strongwords', each has a
corresponding (backend specific) markup template section. Edit the
configuration files to customize existing Special Words and to add new
ones.

.Special word behavior
- Word list entries must be separated by space characters.
- Word list entries with embedded spaces should be enclosed in quotation (")
  characters.
- A `[specialwords]` section entry of the form
  +name=word1{nbsp}[word2...]+ adds words to existing `name` entries.
- A `[specialwords]` section entry of the form `name` undefines
  (deletes) all existing `name` words.
- Since word list entries are processed as Python regular expressions
  you need to be careful to escape regular expression special
  characters.
- By default Special Words are substituted before Inline Macros, this
  may lead to undesirable consequences. For example the special word
  `foobar` would be expanded inside the macro call
  `http://www.foobar.com[]`.  A possible solution is to emphasize
  whole words only by defining the word using regular expression
  characters, for example `\bfoobar\b`.
- If the first matched character of a special word is a backslash then
  the remaining characters are output without markup i.e. the
  backslash can be used to escape special word markup.  For example
  the special word `\\?\b[Tt]en\b` will mark up the words `Ten` and
  `ten` only if they are not preceded by a backslash.

[[X10]]
Replacements section
~~~~~~~~~~~~~~~~~~~~
`[replacements]`, `[replacements2]` and `[replacements3]`
configuration file entries specify find and replace text and are
formatted like:

  <find_pattern>=<replacement_text>

The find text can be a Python regular expression; the replace text can
contain Python regular expression group references.

Use Replacement shortcuts for often used macro references, for
example (the second replacement allows us to backslash escape the
macro name):

  NEW!=image:./images/smallnew.png[New!]
  \\NEW!=NEW!

The only difference between the three replacement types is how they
are applied. By default 'replacements' and 'replacement2' are applied
in <<X102,normal>> substitution contexts whereas 'replacements3' needs
to be configured explicitly and should only be used in backend
configuration files.

.Replacement behavior
- The built-in replacements can be escaped with a backslash.
- If the find or replace text has leading or trailing spaces then the
  text should be enclosed in quotation (") characters.
- Since the find text is processed as a regular expression you need to
  be careful to escape regular expression special characters.
- Replacements are performed in the same order they appear in the
  configuration file replacements section.

Markup Template Sections
~~~~~~~~~~~~~~~~~~~~~~~~
Markup template sections supply backend markup for translating
AsciiDoc elements.  Since the text is normally backend dependent
you'll find these sections in the backend specific configuration
files. Template sections differ from other sections in that they
contain a single block of text instead of per line 'name=value'
entries. A markup template section body can contain:

- Attribute references
- System macro calls.
- A document content placeholder

The document content placeholder is a single | character and is
replaced by text from the source element.  Use the `{brvbar}`
attribute reference if you need a literal | character in the template.

[[X27]]
Configuration file names, precedence and locations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Configuration files have a `.conf` file name extension; they are
loaded from the following locations:

1. The directory containing the asciidoc executable.
2. If there is no `asciidoc.conf` file in the directory containing the
   asciidoc executable then load from the global configuration
   directory (normally `/etc/asciidoc` or `/usr/local/etc/asciidoc`)
   i.e. the global configuration files directory is skipped if
   AsciiDoc configuration files are installed in the same directory as
   the asciidoc executable. This allows both a system wide copy and
   multiple local copies of AsciiDoc to coexist on the same host PC.
3. The user's `$HOME/.asciidoc` directory (if it exists).
4. The directory containing the AsciiDoc source file.
5. Explicit configuration files specified using:
   - The `conf-files` attribute (one or more file names separated by a
     `|` character). These files are loaded in the order they are
     specified and prior to files specified using the `--conf-file`
     command-line option.
   - The asciidoc(1) `--conf-file`) command-line option.  The
     `--conf-file` option can be specified multiple times, in which
     case configuration files will be processed in the same order they
     appear on the command-line.
6. <<X100,Backend plugin>> configuration files are loaded from
   subdirectories named like `backends/<backend>` in locations 1, 2
   and 3.
7. <<X59,Filter>> configuration files are loaded from subdirectories
   named like `filters/<filter>` in locations 1, 2 and 3.

Configuration files from the above locations are loaded in the
following order:

- The `[attributes]` section only from:
  * `asciidoc.conf` in location 3
  * Files from location 5.
+
This first pass makes locally set attributes available in the global
`asciidoc.conf` file.

- `asciidoc.conf` from locations 1, 2, 3.
- 'attributes', 'titles' and 'specialcharacters' sections from the
  `asciidoc.conf` in location 4.
- The document header is parsed at this point and we can assume the
  'backend' and 'doctype' have now been defined.
- Backend plugin `<backend>.conf` and `<backend>-<doctype>.conf` files
  from locations 6.  If a backend plugin is not found then try
  locations 1, 2 and 3 for `<backend>.conf` and
  `<backend>-<doctype>.conf` backend configuration files.
- Filter conf files from locations 7.
- `lang-<lang>.conf` from locations 1, 2, 3.
- `asciidoc.conf` from location 4.
- `<backend>.conf` and `<backend>-<doctype>.conf` from location 4.
- Filter conf files from location 4.
- `<docfile>.conf` and `<docfile>-<backend>.conf` from location 4.
- Configuration files from location 5.

Where:

- `<backend>` and `<doctype>` are values specified by the asciidoc(1)
  `-b` (`--backend`) and `-d` (`--doctype`) command-line options.
- `<infile>` is the path name of the AsciiDoc input file without the
  file name extension.
- `<lang>` is a two letter country code set by the the AsciiDoc 'lang'
  attribute.

[NOTE]
=====================================================================
The backend and language global configuration files are loaded *after*
the header has been parsed.  This means that you can set most
attributes in the document header. Here's an example header:

  Life's Mysteries
  ================
  :author: Hu Nose
  :doctype: book
  :toc:
  :icons:
  :data-uri:
  :lang: en
  :encoding: iso-8859-1

Attributes set in the document header take precedence over
configuration file attributes.

=====================================================================

TIP: Use the asciidoc(1) `-v` (`--verbose`) command-line option to see
which configuration files are loaded and the order in which they are
loaded.


Document Attributes
-------------------
A document attribute is comprised of a 'name' and a textual 'value'
and is used for textual substitution in AsciiDoc documents and
configuration files. An attribute reference (an attribute name
enclosed in braces) is replaced by the corresponding attribute
value. Attribute names are case insensitive and can only contain
alphanumeric, dash and underscore characters.

There are four sources of document attributes (from highest to lowest
precedence):

- Command-line attributes.
- AttributeEntry, AttributeList, Macro and BlockId elements.
- Configuration file `[attributes]` sections.
- Intrinsic attributes.

Within each of these divisions the last processed entry takes
precedence.

NOTE: If an attribute is not defined then the line containing the
attribute reference is dropped. This property is used extensively in
AsciiDoc configuration files to facilitate conditional markup
generation.


[[X18]]
Attribute Entries
-----------------
The `AttributeEntry` block element allows document attributes to be
assigned within an AsciiDoc document. Attribute entries are added to
the global document attributes dictionary. The attribute name/value
syntax is a single line like:

  :<name>: <value>

For example:

  :Author Initials: JB

This will set an attribute reference `{authorinitials}` to the value
'JB' in the current document.

To delete (undefine) an attribute use the following syntax:

  :<name>!:

.AttributeEntry behavior
- The attribute entry line begins with colon -- no white space allowed
  in left margin.
- AsciiDoc converts the `<name>` to a legal attribute name (lower
  case, alphanumeric, dash and underscore characters only -- all other
  characters deleted). This allows more human friendly text to be
  used.
- Leading and trailing white space is stripped from the `<value>`.
- Lines ending in a space followed by a plus character are continued
  to the next line, for example:

  :description: AsciiDoc is a text document format for writing notes, +
                documentation, articles, books, slideshows, web pages +
                and man pages.

- If the `<value>` is blank then the corresponding attribute value is
  set to an empty string.
- Attribute references contained in the entry `<value>` will be
  expanded.
- By default AttributeEntry values are substituted for
  `specialcharacters` and `attributes` (see above), if you want to
  change or disable AttributeEntry substitution use the <<X77,pass:[]
  inline macro>> syntax.
- Attribute entries in the document Header are available for header
  markup template substitution.
- Attribute elements override configuration file and intrinsic
  attributes but do not override command-line attributes.

Here are some more attribute entry examples:

---------------------------------------------------------------------
AsciiDoc User Manual
====================
:author:    Stuart Rackham
:email:     srackham@gmail.com
:revdate:   April 23, 2004
:revnumber: 5.1.1
---------------------------------------------------------------------

Which creates these attributes:

  {author}, {firstname}, {lastname}, {authorinitials}, {email},
  {revdate}, {revnumber}

The previous example is equivalent to this <<X95,document header>>:

---------------------------------------------------------------------
AsciiDoc User Manual
====================
Stuart Rackham <srackham@gmail.com>
5.1.1, April 23, 2004
---------------------------------------------------------------------

Setting configuration entries
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
A variant of the Attribute Entry syntax allows configuration file
section entries and markup template sections to be set from within an
AsciiDoc document:

  :<section_name>.[<entry_name>]: <entry_value>

Where `<section_name>` is the configuration section name,
`<entry_name>` is the name of the entry and `<entry_value>` is the
optional entry value. This example sets the default labeled list
style to 'horizontal':

  :listdef-labeled.style: horizontal

It is exactly equivalent to a configuration file containing:

  [listdef-labeled]
  style=horizontal

- If the `<entry_name>` is omitted then the entire section is
  substituted with the `<entry_value>`. This feature should only be
  used to set markup template sections. The following example sets the
  'xref2' inline macro markup template:

  :xref2-inlinemacro.: <a href="#{1}">{2?{2}}</a>

- No substitution is performed on configuration file attribute entries
  and they cannot be undefined.
- This feature can only be used in attribute entries -- configuration
  attributes cannot be set using the asciidoc(1) command `--attribute`
  option.

[[X62]]
.Attribute entries promote clarity and eliminate repetition
*********************************************************************
URLs and file names in AsciiDoc macros are often quite long -- they
break paragraph flow and readability suffers.  The problem is
compounded by redundancy if the same name is used repeatedly.
Attribute entries can be used to make your documents easier to read
and write, here are some examples:

  :1:         http://freshmeat.net/projects/asciidoc/
  :homepage:  http://methods.co.nz/asciidoc/[AsciiDoc home page]
  :new:       image:./images/smallnew.png[]
  :footnote1: footnote:[A meaningless latin term]

  Using previously defined attributes: See the {1}[Freshmeat summary]
  or the {homepage} for something new {new}. Lorem ispum {footnote1}.

.Note
- The attribute entry definition must precede it's usage.
- You are not limited to URLs or file names, entire macro calls or
  arbitrary lines of text can be abbreviated.
- Shared attributes entries could be grouped into a separate file and
  <<X63,included>> in multiple documents.
*********************************************************************


[[X21]]
Attribute Lists
---------------
- An attribute list is a comma separated list of attribute values.
- The entire list is enclosed in square brackets.
- Attribute lists are used to pass parameters to macros, blocks (using
  the <<X79,AttributeList element>>) and inline quotes.

The list consists of zero or more positional attribute values followed
by zero or more named attribute values.  Here are three examples: a
single unquoted positional attribute; three unquoted positional
attribute values; one positional attribute followed by two named
attributes; the unquoted attribute value in the final example contains
comma (`,`) and double-quote (`"`) character entities:

  [Hello]
  [quote, Bertrand Russell, The World of Mathematics (1956)]
  ["22 times", backcolor="#0e0e0e", options="noborders,wide"]
  [A footnote, "with an image" image:smallnew.png[]]

.Attribute list behavior
- If one or more attribute values contains a comma the all string
  values must be quoted (enclosed in double quotation mark
  characters).
- If the list contains any named or quoted attributes then all string
  attribute values must be quoted.
- To include a double quotation mark (") character in a quoted
  attribute value the the quotation mark must be escaped with a
  backslash.
- List attributes take precedence over existing attributes.
- List attributes can only be referenced in configuration file markup
  templates and tags, they are not available elsewhere in the
  document.
- Setting a named attribute to `None` undefines the attribute.
- Positional attributes are referred to as `{1}`,`{2}`,`{3}`,...
- Attribute `{0}` refers to the entire list (excluding the enclosing
  square brackets).
- Named attribute names cannot contain dash characters.

[[X75]]
Options attribute
~~~~~~~~~~~~~~~~~
If the attribute list contains an attribute named `options` it is
processed as a comma separated list of option names:

- Each name generates an attribute named like `<option>-option` (where
  `<option>` is the option name) with an empty string value.  For
  example `[options="opt1,opt2,opt3"]` is equivalent to setting the
  following three attributes
  `[opt1-option="",opt2-option="",opt2-option=""]`.
- If you define a an option attribute globally (for example with an
  <<X18,attribute entry>>) then it will apply to all elements in the
  document.
- AsciiDoc implements a number of predefined options which are listed
  in the <<X74,Attribute Options appendix>>.

Macro Attribute lists
~~~~~~~~~~~~~~~~~~~~~
Macros calls are suffixed with an attribute list. The list may be
empty but it cannot be omitted. List entries are used to pass
attribute values to macro markup templates.


Attribute References
--------------------
An attribute reference is an attribute name (possibly followed by an
additional parameters) enclosed in curly braces.  When an attribute
reference is encountered it is evaluated and replaced by its
corresponding text value.  If the attribute is undefined the line
containing the attribute is dropped.

There are three types of attribute reference: 'Simple', 'Conditional'
and 'System'.

.Attribute reference evaluation
- You can suppress attribute reference expansion by placing a
  backslash character immediately in front of the opening brace
  character.
- By default attribute references are not expanded in
  'LiteralParagraphs', 'ListingBlocks' or 'LiteralBlocks'.
- Attribute substitution proceeds line by line in reverse line order.
- Attribute reference evaluation is performed in the following order:
  'Simple' then 'Conditional' and finally 'System'.

Simple Attributes References
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Simple attribute references take the form `{<name>}`. If the
attribute name is defined its text value is substituted otherwise the
line containing the reference is dropped from the output.

Conditional Attribute References
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Additional parameters are used in conjunction with attribute names to
calculate a substitution value. Conditional attribute references take
the following forms:

`{<names>=<value>}`::
        `<value>` is substituted if the attribute `<names>` is
        undefined otherwise its value is substituted. `<value>` can
        contain simple attribute references.

`{<names>?<value>}`::
        `<value>` is substituted if the attribute `<names>` is defined
        otherwise an empty string is substituted.  `<value>` can
        contain simple attribute references.

`{<names>!<value>}`::
        `<value>` is substituted if the attribute `<names>` is
        undefined otherwise an empty string is substituted.  `<value>`
        can contain simple attribute references.

`{<names>#<value>}`::
        `<value>` is substituted if the attribute `<names>` is defined
        otherwise the undefined attribute entry causes the containing
        line to be dropped.  `<value>` can contain simple attribute
        references.

`{<names>%<value>}`::
        `<value>` is substituted if the attribute `<names>` is not
        defined otherwise the containing line is dropped.  `<value>`
        can contain simple attribute references.

`{<names>@<regexp>:<value1>[:<value2>]}`::
        `<value1>` is substituted if the value of attribute `<names>`
        matches the regular expression `<regexp>` otherwise `<value2>`
        is substituted. If attribute `<names>` is not defined the
        containing line is dropped. If `<value2>` is omitted an empty
        string is assumed. The values and the regular expression can
        contain simple attribute references.  To embed colons in the
        values or the regular expression escape them with backslashes.

`{<names>$<regexp>:<value1>[:<value2>]}`::
        Same behavior as the previous ternary attribute except for
        the following cases:

        `{<names>$<regexp>:<value>}`;;
                Substitutes `<value>` if `<names>` matches `<regexp>`
                otherwise the result is undefined and the containing
                line is dropped.

        `{<names>$<regexp>::<value>}`;;
                Substitutes `<value>` if `<names>` does not match
                `<regexp>` otherwise the result is undefined and the
                containing line is dropped.

The attribute `<names>` parameter normally consists of a single
attribute name but it can be any one of the following:

- A single attribute name which evaluates to the attributes value.
- Multiple ',' separated attribute names which evaluates to an empty
  string if one or more of the attributes is defined, otherwise it's
  value is undefined.
- Multiple '+' separated attribute names which evaluates to an empty
  string if all of the attributes are defined, otherwise it's value is
  undefined.

Conditional attributes with single attribute names are evaluated first
so they can be used inside the multi-attribute conditional `<value>`.

Conditional attribute examples
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Conditional attributes are mainly used in AsciiDoc configuration
files -- see the distribution `.conf` files for examples.

Attribute equality test::
  If `{backend}` is 'docbook45' or 'xhtml11' the example evaluates to
  ``DocBook 4.5 or XHTML 1.1 backend'' otherwise it evaluates to
  ``some other backend'':

  {backend@docbook45|xhtml11:DocBook 4.5 or XHTML 1.1 backend:some other backend}

Attribute value map::
  This example maps the `frame` attribute values [`topbot`, `all`,
  `none`, `sides`] to [`hsides`, `border`, `void`, `vsides`]:

  {frame@topbot:hsides}{frame@all:border}{frame@none:void}{frame@sides:vsides}


[[X24]]
System Attribute References
~~~~~~~~~~~~~~~~~~~~~~~~~~~
System attribute references generate the attribute text value by
executing a predefined action that is parametrized by one or more
arguments. The syntax is `{<action>:<arguments>}`.

`{counter:<attrname>[:<seed>]}`::
        Increments the document attribute (if the attribute is
        undefined it is set to `1`). Returns the new attribute value.

        - Counters generate global (document wide) attributes.
        - The optional `<seed>` specifies the counter's initial value;
          it can be a number or a single letter; defaults to '1'.
        - `<seed>` can contain simple and conditional attribute
          references.
        - The 'counter' system attribute will not be executed if the
          containing line is dropped by the prior evaluation of an
          undefined attribute.

`{counter2:<attrname>[:<seed>]}`::
        Same as `counter` except the it always returns a blank string.

`{eval:<expression>}`::
        Substitutes the result of the Python `<expression>`.

        - If `<expression>` evaluates to `None` or `False` the
          reference is deemed undefined and the line containing the
          reference is dropped from the output.
        - If the expression evaluates to `True` the attribute
          evaluates to an empty string.
        - `<expression>` can contain simple and conditional attribute
          references.
        - The 'eval' system attribute can be nested inside other
          system attributes.

`{eval3:<command>}`::
        Passthrough version of `{eval:<expression>}` -- the generated
        output is written directly to the output without any further
        substitutions.

`{include:<filename>}`::
        Substitutes contents of the file named `<filename>`.

        - The included file is read at the time of attribute
          substitution.
        - If the file does not exist a warning is emitted and the line
          containing the reference is dropped from the output file.
        - Tabs are expanded based on the current 'tabsize' attribute
          value.

`{set:<attrname>[!][:<value>]}`::
        Sets or unsets document attribute. Normally only used in
        configuration file markup templates (use
        <<X18,AttributeEntries>> in AsciiDoc documents).

        - If the attribute name is followed by an exclamation mark
          the attribute becomes undefined.
        - If `<value>` is omitted the attribute is set to a blank
          string.
        - `<value>` can contain simple and conditional attribute
          references.
        - Returns a blank string unless the attribute is undefined in
          which case the return value is undefined and the enclosing
          line will be dropped.

`{set2:<attrname>[!][:<value>]}`::
        Same as `set` except that the attribute scope is local to the
        template.

`{sys:<command>}`::
        Substitutes the stdout generated by the execution of the shell
        `<command>`.

`{sys2:<command>}`::
        Substitutes the stdout and stderr generated by the execution
        of the shell `<command>`.

`{sys3:<command>}`::
        Passthrough version of `{sys:<command>}` -- the generated
        output is written directly to the output without any further
        substitutions.

`{template:<template>}`::
        Substitutes the contents of the configuration file section
        named `<template>`. Attribute references contained in the
        template are substituted.

.System reference behavior
- System attribute arguments can contain non-system attribute
  references.
- Closing brace characters inside system attribute arguments must be
  escaped with a backslash.

[[X60]]
Intrinsic Attributes
--------------------
Intrinsic attributes are simple attributes that are created
automatically from: AsciiDoc document header parameters; asciidoc(1)
command-line arguments; attributes defined in the default
configuration files; the execution context.  Here's the list of
predefined intrinsic attributes:

  {amp}                 ampersand (&) character entity
  {asciidoc-args}       used to pass inherited arguments to asciidoc filters
  {asciidoc-confdir}    the asciidoc(1) global configuration directory
  {asciidoc-dir}        the asciidoc(1) application directory
  {asciidoc-file}       the full path name of the asciidoc(1) script
  {asciidoc-version}    the version of asciidoc(1)
  {author}              author's full name
  {authored}            empty string '' if {author} or {email} defined,
  {authorinitials}      author initials (from document header)
  {backend-<backend>}   empty string ''
  {<backend>-<doctype>} empty string ''
  {backend}             document backend specified by `-b` option
  {backend-confdir}     the directory containing the <backend>.conf file
  {backslash}           backslash character
  {basebackend-<base>}  empty string ''
  {basebackend}         html or docbook
  {blockname}           current block name (note 8).
  {brvbar}              broken vertical bar (|) character
  {docdate}             document last modified date
  {docdir}              document input directory name  (note 5)
  {docfile}             document file name  (note 5)
  {docname}             document file name without extension (note 6)
  {doctime}             document last modified time
  {doctitle}            document title (from document header)
  {doctype-<doctype>}   empty string ''
  {doctype}             document type specified by `-d` option
  {email}               author's email address (from document header)
  {empty}               empty string ''
  {encoding}            specifies input and output encoding
  {filetype-<fileext>}  empty string ''
  {filetype}            output file name file extension
  {firstname}           author first name (from document header)
  {gt}                  greater than (>) character entity
  {id}                  running block id generated by BlockId elements
  {indir}               input file directory name (note 2,5)
  {infile}              input file name (note 2,5)
  {lastname}            author last name (from document header)
  {ldquo}               Left double quote character (note 7)
  {level}               title level 1..4 (in section titles)
  {listindex}           the list index (1..) of the most recent list item
  {localdate}           the current date
  {localtime}           the current time
  {lsquo}               Left single quote character (note 7)
  {lt}                  less than (<) character entity
  {manname}             manpage name (defined in NAME section)
  {manpurpose}          manpage (defined in NAME section)
  {mantitle}            document title minus the manpage volume number
  {manvolnum}           manpage volume number (1..8) (from document header)
  {middlename}          author middle name (from document header)
  {nbsp}                non-breaking space character entity
  {notitle}             do not display the document title
  {outdir}              document output directory name (note 2)
  {outfile}             output file name (note 2)
  {python}              the full path name of the Python interpreter executable
  {rdquo}               Right double quote character (note 7)
  {reftext}             running block xreflabel generated by BlockId elements
  {revdate}             document revision date (from document header)
  {revnumber}           document revision number (from document header)
  {rsquo}               Right single quote character (note 7)
  {sectnum}             formatted section number (in section titles)
  {sp}                  space character
  {showcomments}        send comment lines to the output
  {title}               section title (in titled elements)
  {two-colons}          Two colon characters
  {two-semicolons}      Two semicolon characters
  {user-dir}            the ~/.asciidoc directory (if it exists)
  {verbose}             defined as '' if --verbose command option specified
  {wj}                  Word-joiner
  {zwsp}                Zero-width space character entity

[NOTE]
======
1. Intrinsic attributes are global so avoid defining custom attributes
   with the same names.
2. `{outfile}`, `{outdir}`, `{infile}`, `{indir}` attributes are
   effectively read-only (you can set them but it won't affect the
   input or output file paths).
3.  See also the <<X88,Backend Attributes>> section for attributes
    that relate to AsciiDoc XHTML file generation.
4. The entries that translate to blank strings are designed to be used
   for conditional text inclusion. You can also use the `ifdef`,
   `ifndef` and `endif` System macros for conditional inclusion.
   footnote:[Conditional inclusion using `ifdef` and `ifndef` macros
   differs from attribute conditional inclusion in that the former
   occurs when the file is read while the latter occurs when the
   contents are written.]
5. `{docfile}` and `{docdir}` refer to root document specified on the
   asciidoc(1) command-line; `{infile}` and `{indir}` refer to the
   current input file which may be the root document or an included
   file. When the input is being read from the standard input
   (`stdin`) these attributes are undefined.
6. If the input file is the standard input and the output file is not
   the standard output then `{docname}` is the output file name sans
   file extension.
7. See
   http://en.wikipedia.org/wiki/Non-English_usage_of_quotation_marks[non-English
   usage of quotation marks].
8. The `{blockname}` attribute identifies the style of the current
   block. It applies to delimited blocks, lists and tables. Here is a
   list of `{blockname}` values (does not include filters or custom
   block and style names):

   delimited blocks:: comment, sidebar, open, pass, literal, verse,
   listing, quote, example, note, tip, important, caution, warning,
   abstract, partintro

   lists:: arabic, loweralpha, upperalpha, lowerroman, upperroman,
   labeled, labeled3, labeled4, qanda, horizontal, bibliography,
   glossary

   tables:: table

======


[[X73]]
Block Element Definitions
-------------------------
The syntax and behavior of Paragraph, DelimitedBlock, List and Table
block elements is determined by block definitions contained in
<<X7,AsciiDoc configuration file>> sections.

Each definition consists of a section title followed by one or more
section entries. Each entry defines a block parameter controlling some
aspect of the block's behavior. Here's an example:

---------------------------------------------------------------------
[blockdef-listing]
delimiter=^-{4,}$
template=listingblock
presubs=specialcharacters,callouts
---------------------------------------------------------------------

Configuration file block definition sections are processed
incrementally after each configuration file is loaded. Block
definition section entries are merged into the block definition, this
allows block parameters to be overridden and extended by later
<<X27,loading configuration files>>.

AsciiDoc Paragraph, DelimitedBlock, List and Table block elements
share a common subset of configuration file parameters:

delimiter::
  A Python regular expression that matches the first line of a block
  element -- in the case of DelimitedBlocks and Tables it also matches
  the last line.

template::
  The name of the configuration file markup template section that will
  envelope the block contents. The pipe ('|') character is substituted
  for the block contents. List elements use a set of (list specific)
  tag parameters instead of a single template. The template name can
  contain attribute references allowing dynamic template selection a
  the time of template substitution.

options::
  A comma delimited list of element specific option names. In addition
  to being used internally, options are available during markup tag
  and template substitution as attributes with an empty string value
  named like `<option>-option` (where `<option>` is the option name).
  See <<X74,attribute options>> for a complete list of available
  options.

subs, presubs, postsubs::
  * 'presubs' and 'postsubs' are lists of comma separated substitutions that are
    performed on the block contents. 'presubs' is applied first,
    'postsubs' (if specified) second.

  * 'subs' is an alias for 'presubs'.

  * If a 'filter' is allowed (Paragraphs, DelimitedBlocks and Tables)
    and has been specified then 'presubs' and 'postsubs' substitutions
    are performed before and after the filter is run respectively.

  * Allowed values: 'specialcharacters', 'quotes', 'specialwords',
    'replacements', 'macros', 'attributes', 'callouts'.

  * [[X102]]The following composite values are also allowed:

    'none';;
        No substitutions.
    'normal';;
        The following substitutions in the following order:
        'specialcharacters', 'quotes', 'attributes', 'specialwords',
        'replacements', 'macros', 'replacements2'.
    'verbatim';;
        The following substitutions in the following order:
        'specialcharacters' and 'callouts'.

  * 'normal' and 'verbatim' substitutions can be redefined by with
    `subsnormal` and `subsverbatim` entries in a configuration file
    `[miscellaneous]` section.

  * The substitutions are processed in the order in which they are
    listed and can appear more than once.

filter::
  This optional entry specifies an executable shell command for
  processing block content (Paragraphs, DelimitedBlocks and Tables).
  The filter command can contain attribute references.

posattrs::
  Optional comma separated list of positional attribute names. This
  list maps positional attributes (in the block's <<X21,attribute
  list>>) to named block attributes. The following example, from the
  QuoteBlock definition, maps the first and section positional
  attributes:

  posattrs=attribution,citetitle

style::
  This optional parameter specifies the default style name.


<stylename>-style::
  Optional style definition (see <<X23,Styles>> below).

The following block parameters behave like document attributes and can
be set in block attribute lists and style definitions: 'template',
'options', 'subs', 'presubs', 'postsubs', 'filter'.

[[X23]]
Styles
~~~~~~
A style is a set of block parameter bundled as a single named
parameter. The following example defines a style named 'verbatim':

  verbatim-style=template="literalblock",subs="verbatim"

If a block's <<X21,attribute list>> contains a 'style' attribute then
the corresponding style parameters are be merged into the default
block definition parameters.

- All style parameter names must be suffixed with `-style` and the
  style parameter value is in the form of a list of <<X21,named
  attributes>>.
- The 'template' style parameter is mandatory, other parameters can be
  omitted in which case they inherit their values from the default
  block definition parameters.
- Multi-item style parameters ('subs','presubs','postsubs','posattrs')
  must be specified using Python tuple syntax (rather than a simple
  list of values as they in separate entries) e.g.
  `postsubs=("callouts",)` not `postsubs="callouts"`.

Paragraphs
~~~~~~~~~~
Paragraph translation is controlled by `[paradef-*]` configuration
file section entries. Users can define new types of paragraphs and
modify the behavior of existing types by editing AsciiDoc
configuration files.

Here is the shipped Default paragraph definition:

--------------------------------------------------------------------
[paradef-default]
delimiter=(?P<text>\S.*)
template=paragraph
--------------------------------------------------------------------

The normal paragraph definition has a couple of special properties:

1. It must exist and be defined in a configuration file section named
   `[paradef-default]`.
2. Irrespective of its position in the configuration files default
   paragraph document matches are attempted only after trying all
   other paragraph types.

Paragraph specific block parameter notes:

delimiter::
  This regular expression must contain the named group 'text' which
  matches the text on the first line.  Paragraphs are terminated by a
  blank line, the end of file, or the start of a DelimitedBlock.

options::
  The 'listelement' option specifies that paragraphs of this type will
  automatically be considered part of immediately preceding list
  items.  The 'skip' option causes the paragraph to be treated as a
  comment (see <<X26,CommentBlocks>>).

.Paragraph processing proceeds as follows:
1. The paragraph text is aligned to the left margin.
2. Optional 'presubs' inline substitutions are performed on the
   paragraph text.
3. If a filter command is specified it is executed and the paragraph
   text piped to its standard input; the filter output replaces the
   paragraph text.
4. Optional 'postsubs' inline substitutions are performed on the
   paragraph text.
5. The paragraph text is enveloped by the paragraph's markup template
   and written to the output file.

Delimited Blocks
~~~~~~~~~~~~~~~~
DelimitedBlock 'options' values are:

sectionbody::
    The block contents are processed as a SectionBody.

skip::
    The block is treated as a comment (see <<X26,CommentBlocks>>).
    Preceding <<X21,attribute lists>> and <<X42,block titles>> are not
    consumed.

'presubs', 'postsubs' and 'filter' entries are ignored when
'sectionbody' or 'skip' options are set.

DelimitedBlock processing proceeds as follows:

1. Optional 'presubs' substitutions are performed on the block
   contents.
2. If a filter is specified it is executed and the block's contents
   piped to its standard input. The filter output replaces the block
   contents.
3. Optional 'postsubs' substitutions are performed on the block
   contents.
4. The block contents is enveloped by the block's markup template and
   written to the output file.

TIP: Attribute expansion is performed on the block filter command
before it is executed, this is useful for passing arguments to the
filter.

Lists
~~~~~
List behavior and syntax is determined by `[listdef-*]` configuration
file sections. The user can change existing list behavior and add new
list types by editing configuration files.

List specific block definition notes:

type::
  This is either 'bulleted','numbered','labeled' or 'callout'.

delimiter::
  A Python regular expression that matches the first line of a
  list element entry. This expression can contain the named groups
  'text' (bulleted groups), 'index' and 'text' (numbered lists),
  'label' and 'text' (labeled lists).

tags::
  The `<name>` of the `[listtags-<name>]` configuration file section
  containing list markup tag definitions.  The tag entries ('list',
  'entry', 'label', 'term', 'text') map the AsciiDoc list structure to
  backend markup; see the 'listtags' sections in the AsciiDoc
  distributed backend `.conf` configuration files for examples.

Tables
~~~~~~
Table behavior and syntax is determined by `[tabledef-*]` and
`[tabletags-*]` configuration file sections. The user can change
existing table behavior and add new table types by editing
configuration files.  The following `[tabledef-*]` section entries
generate table output markup elements:

colspec::
  The table 'colspec' tag definition.

headrow, footrow, bodyrow::
  Table header, footer and body row tag definitions. 'headrow' and
  'footrow' table definition entries default to 'bodyrow' if
  they are undefined.

headdata, footdata, bodydata::
  Table header, footer and body data tag definitions. 'headdata' and
  'footdata' table definition entries default to 'bodydata' if they
  are undefined.

paragraph::
  If the 'paragraph' tag is specified then blank lines in the cell
  data are treated as paragraph delimiters and marked up using this
  tag.

[[X4]]
Table behavior is also influenced by the following `[miscellaneous]`
configuration file entries:

pagewidth::
  This integer value is the printable width of the output media. See
  <<X69,table attributes>>.

pageunits::
  The units of width in output markup width attribute values.

.Table definition behavior
- The output markup generation is specifically designed to work with
  the HTML and CALS (DocBook) table models, but should be adaptable to
  most XML table schema.
- Table definitions can be ``mixed in'' from multiple cascading
  configuration files.
- New table definitions inherit the default table and table tags
  definitions (`[tabledef-default]` and `[tabletags-default]`) so you
  only need to override those conf file entries that require
  modification.


[[X59]]
Filters
-------
AsciiDoc filters allow external commands to process AsciiDoc
'Paragraphs', 'DelimitedBlocks' and 'Table' content. Filters are
primarily an extension mechanism for generating specialized outputs.
Filters are implemented using external commands which are specified in
configuration file definitions.

There's nothing special about the filters, they're just standard UNIX
filters: they read text from the standard input, process it, and write
to the standard output.

The asciidoc(1) command `--filter` option can be used to install and
remove filters. The same option is used to unconditionally load a
filter.

Attribute substitution is performed on the filter command prior to
execution -- attributes can be used to pass parameters from the
AsciiDoc source document to the filter.

WARNING: Filters sometimes included executable code. Before installing
a filter you should verify that it is from a trusted source.

Filter Search Paths
~~~~~~~~~~~~~~~~~~~
If the filter command does not specify a directory path then
asciidoc(1) recursively searches for the executable filter command:

- First it looks in the user's `$HOME/.asciidoc/filters` directory.
- Next the global filters directory (usually `/etc/asciidoc/filters`
  or `/usr/local/etc/asciidoc`) directory is searched.
- Then it looks in the asciidoc(1) `./filters` directory.
- Finally it relies on the executing shell to search the environment
  search path (`$PATH`).

Standard practice is to install each filter in it's own sub-directory
with the same name as the filter's style definition. For example the
music filter's style name is 'music' so it's configuration and filter
files are stored in the `filters/music` directory.

Filter Configuration Files
~~~~~~~~~~~~~~~~~~~~~~~~~~
Filters are normally accompanied by a configuration file containing a
Paragraph or DelimitedBlock definition along with corresponding markup
templates.

While it is possible to create new 'Paragraph' or 'DelimitedBlock'
definitions the preferred way to implement a filter is to add a
<<X23,style>> to the existing Paragraph and ListingBlock definitions
(all filters shipped with AsciiDoc use this technique). The filter is
applied to the paragraph or delimited block by preceding it with an
attribute list: the first positional attribute is the style name,
remaining attributes are normally filter specific parameters.

asciidoc(1) auto-loads all `.conf` files found in the filter search
paths unless the container directory also contains a file named
`__noautoload__` (see previous section). The `__noautoload__` feature
is used for filters that will be loaded manually using the `--filter`
option.

[[X56]]
Example Filter
~~~~~~~~~~~~~~
AsciiDoc comes with a toy filter for highlighting source code keywords
and comments.  See also the `./filters/code/code-filter-readme.txt`
file.

NOTE: The purpose of this toy filter is to demonstrate how to write a
filter -- it's much to simplistic to be passed off as a code syntax
highlighter.  If you want a full featured multi-language highlighter
use the {website}source-highlight-filter.html[source code highlighter
filter].

Built-in filters
~~~~~~~~~~~~~~~~
The AsciiDoc distribution includes 'source', 'music', 'latex' and
'graphviz' filters, details are on the
{website}index.html#_filters[AsciiDoc website].

[cols="1e,5",frame="topbot",options="header"]
.Built-in filters list
|====================================================================
|Filter name |Description

|music
|A {website}music-filter.html[music filter] is included in the
distribution `./filters/` directory. It translates music in
http://lilypond.org/[LilyPond] or http://abcnotation.org.uk/[ABC]
notation to standard classical notation.

|source
|A {website}source-highlight-filter.html[source code highlight filter]
is included in the distribution `./filters/` directory.

|latex
|The {website}latex-filter.html[AsciiDoc LaTeX filter] translates
LaTeX source to a PNG image that is automatically inserted into the
AsciiDoc output documents.

|graphviz
|Gouichi Iisaka has written a http://www.graphviz.org/[Graphviz]
filter for AsciiDoc.  Graphviz generates diagrams from a textual
specification. Gouichi Iisaka's Graphviz filter is included in the
AsciiDoc distribution. Here are some
{website}asciidoc-graphviz-sample.html[AsciiDoc Graphviz examples].

|====================================================================

[[X58]]
Filter plugins
~~~~~~~~~~~~~~
Filter <<X101,plugins>> are a mechanism for distributing AsciiDoc
filters.  A filter plugin is a Zip file containing the files that
constitute a filter.  The asciidoc(1) `--filter` option is used to
load and manage filer <<X101,plugins>>.

- Filter plugins <<X27,take precedence>> over built-in filters with
  the same name.
- By default filter plugins are installed in
  `$HOME/.asciidoc/filters/<filter>` where `<filter>` is the filter
  name.


[[X101]]
Plugins
-------
The AsciiDoc plugin architecture is an extension mechanism that allows
additional <<X100,backends>>, <<X58,filters>> and <<X99,themes>> to be
added to AsciiDoc.

- A plugin is a Zip file containing an AsciiDoc backend, filter or
  theme (configuration files, stylesheets, scripts, images).
- The asciidoc(1) `--backend`, `--filter` and `--theme` command-line
  options are used to load and manage plugins. Each of these options
  responds to the plugin management 'install', 'list', 'remove' and
  'build' commands.
- The plugin management command names are reserved and cannot be used
  for filter, backend or theme names.
- The plugin Zip file name always begins with the backend, filter or
  theme name.

Plugin commands and conventions are documented in the asciidoc(1) man
page.  You can find lists of plugins on the
{website}plugins.html[AsciiDoc website].


[[X36]]
Help Commands
-------------
The asciidoc(1) command has a `--help` option which prints help topics
to stdout. The default topic summarizes asciidoc(1) usage:

  $ asciidoc --help

To print a help topic specify the topic name as a command argument.
Help topic names can be shortened so long as they are not ambiguous.
Examples:

  $ asciidoc --help manpage
  $ asciidoc -h m              # Short version of previous example.
  $ asciidoc --help syntax
  $ asciidoc -h s              # Short version of previous example.

Customizing Help
~~~~~~~~~~~~~~~~
To change, delete or add your own help topics edit a help
configuration file.  The help file name `help-<lang>.conf` is based on
the setting of the `lang` attribute, it defaults to `help.conf`
(English).  The <<X27,help file location>> will depend on whether you
want the topics to apply to all users or just the current user.

The help topic files have the same named section format as other
<<X7,configuration files>>. The `help.conf` files are stored in the
same locations and loaded in the same order as other configuration
files.

When the `--help` command-line option is specified AsciiDoc loads the
appropriate help files and then prints the contents of the section
whose name matches the help topic name.  If a topic name is not
specified `default` is used. You don't need to specify the whole help
topic name on the command-line, just enough letters to ensure it's not
ambiguous. If a matching help file section is not found a list of
available topics is printed.


Tips and Tricks
---------------

Know Your Editor
~~~~~~~~~~~~~~~~
Writing AsciiDoc documents will be a whole lot more pleasant if you
know your favorite text editor. Learn how to indent and reformat text
blocks, paragraphs, lists and sentences. <<X20,Tips for 'vim' users>>
follow.

[[X20]]
Vim Commands for Formatting AsciiDoc
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Text Wrap Paragraphs
^^^^^^^^^^^^^^^^^^^^
Use the vim `:gq` command to reformat paragraphs. Setting the
'textwidth' sets the right text wrap margin; for example:

  :set textwidth=70

To reformat a paragraph:

1. Position the cursor at the start of the paragraph.
2. Type `gq}`.

Execute `:help gq` command to read about the vim gq command.

[TIP]
=====================================================================
- Assign the `gq}` command to the Q key with the `nnoremap Q gq}`
  command or put it in your `~/.vimrc` file to so it's always
  available (see the <<X61, Example `~/.vimrc` file>>).
- Put `set` commands in your `~/.vimrc` file so you don't have to
  enter them manually.
- The Vim website (http://www.vim.org) has a wealth of resources,
  including scripts for automated spell checking and ASCII Art
  drawing.
=====================================================================

Format Lists
^^^^^^^^^^^^
The `gq` command can also be used to format bulleted, numbered and
callout lists. First you need to set the `comments`, `formatoptions`
and `formatlistpat` (see the <<X61, Example `~/.vimrc` file>>).

Now you can format simple lists that use dash, asterisk, period and
plus bullets along with numbered ordered lists:

1. Position the cursor at the start of the list.
2. Type `gq}`.

Indent Paragraphs
^^^^^^^^^^^^^^^^^
Indent whole paragraphs by indenting the fist line with the desired
indent and then executing the `gq}` command.

[[X61]]
Example `~/.vimrc` File
^^^^^^^^^^^^^^^^^^^^^^^
---------------------------------------------------------------------
" Use bold bright fonts.
set background=dark

" Show tabs and trailing characters.
set listchars=tab:,trail:
set list

" Don't highlight searched text.
highlight clear Search

" Don't move to matched text while search pattern is being entered.
set noincsearch

" Reformat paragraphs and list.
nnoremap R gq}

" Delete trailing white space and Dos-returns and to expand tabs to spaces.
nnoremap S :set et<CR>:retab!<CR>:%s/[\r \t]\+$//<CR>

autocmd BufRead,BufNewFile *.txt,README,TODO,CHANGELOG,NOTES
        \ setlocal autoindent expandtab tabstop=8 softtabstop=2 shiftwidth=2 filetype=asciidoc
        \ textwidth=70 wrap formatoptions=tcqn
        \ formatlistpat=^\\s*\\d\\+\\.\\s\\+\\\\|^\\s*<\\d\\+>\\s\\+\\\\|^\\s*[a-zA-Z.]\\.\\s\\+\\\\|^\\s*[ivxIVX]\\+\\.\\s\\+
        \ comments=s1:/*,ex:*/,://,b:#,:%,:XCOMM,fb:-,fb:*,fb:+,fb:.,fb:>
---------------------------------------------------------------------

Troubleshooting
~~~~~~~~~~~~~~~
AsciiDoc diagnostic features are detailed in the <<X82,Diagnostics
appendix>>.

Gotchas
~~~~~~~
Incorrect character encoding::
    If you get an error message like `'UTF-8' codec can't decode ...`
    then you source file contains invalid UTF-8 characters -- set the
    AsciiDoc <<X54,encoding attribute>> for the correct character set
    (typically ISO-8859-1 (Latin-1) for European languages).

Invalid output::
    AsciiDoc attempts to validate the input AsciiDoc source but makes
    no attempt to validate the output markup, it leaves that to
    external tools such as `xmllint(1)` (integrated into `a2x(1)`).
    Backend validation cannot be hardcoded into AsciiDoc because
    backends are dynamically configured. The following example
    generates valid HTML but invalid DocBook (the DocBook `literal`
    element cannot contain an `emphasis` element):

    +monospaced text with an _emphasized_ word+

Misinterpreted text formatting::
    You can suppress markup expansion by placing a backslash character
    immediately in front of the element. The following example
    suppresses inline monospaced formatting:

    \+1 for C++.

Overlapping text formatting::
    Overlapping text formatting will generate illegal overlapping
    markup tags which will result in downstream XML parsing errors.
    Here's an example:

    Some *strong markup _that overlaps* emphasized markup_.

Ambiguous underlines::
    A DelimitedBlock can immediately follow a paragraph without an
    intervening blank line, but be careful, a single line paragraph
    underline may be misinterpreted as a section title underline
    resulting in a ``closing block delimiter expected'' error.

Ambiguous ordered list items::
    Lines beginning with numbers at the end of sentences will be
    interpreted as ordered list items.  The following example
    (incorrectly) begins a new list with item number 1999:

    He was last sighted in
    1999. Since then things have moved on.
+
The 'list item out of sequence' warning makes it unlikely that this
problem will go unnoticed.

Special characters in attribute values::
    Special character substitution precedes attribute substitution so
    if attribute values contain special characters you may, depending
    on the substitution context, need to escape the special characters
    yourself. For example:

    $ asciidoc -a 'orgname=Bill & Ben Inc.' mydoc.txt

Attribute lists::
    If any named attribute entries are present then all string
    attribute values must be quoted.  For example:

    ["Desktop screenshot",width=32]

[[X90]]
Combining separate documents
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You have a number of stand-alone AsciiDoc documents that you want to
process as a single document. Simply processing them with a series of
`include` macros won't work because the documents contain (level 0)
document titles.  The solution is to create a top level wrapper
document and use the `leveloffset` attribute to push them all down one
level. For example:

[listing]
.....................................................................
Combined Document Title
=======================

// Push titles down one level.
:leveloffset: 1

\include::document1.txt[]

// Return to normal title levels.
:leveloffset: 0

A Top Level Section
-------------------
Lorum ipsum.

// Push titles down one level.
:leveloffset: 1

\include::document2.txt[]

\include::document3.txt[]
.....................................................................

The document titles in the included documents will now be processed as
level 1 section titles, level 1 sections as level 2 sections and so
on.

- Put a blank line between the `include` macro lines to ensure the
  title of the included document is not seen as part of the last
  paragraph of the previous document.
- You won't want non-title document header lines (for example, Author
  and Revision lines) in the included files -- conditionally exclude
  them if they are necessary for stand-alone processing.

Processing document sections separately
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
You have divided your AsciiDoc document into separate files (one per
top level section) which are combined and processed with the following
top level document:

---------------------------------------------------------------------
Combined Document Title
=======================
Joe Bloggs
v1.0, 12-Aug-03

\include::section1.txt[]

\include::section2.txt[]

\include::section3.txt[]
---------------------------------------------------------------------

You also want to process the section files as separate documents.
This is easy because asciidoc(1) will quite happily process
`section1.txt`, `section2.txt` and `section3.txt` separately -- the
resulting output documents contain the section but have no document
title.

Processing document snippets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Use the `-s` (`--no-header-footer`) command-line option to suppress
header and footer output, this is useful if the processed output is to
be included in another file. For example:

  $ asciidoc -sb docbook section1.txt

asciidoc(1) can be used as a filter, so you can pipe chunks of text
through it. For example:

  $ echo 'Hello *World!*' | asciidoc -s -
  <div class="paragraph"><p>Hello <strong>World!</strong></p></div>

Badges in HTML page footers
~~~~~~~~~~~~~~~~~~~~~~~~~~~
See the `[footer]` section in the AsciiDoc distribution `xhtml11.conf`
configuration file.

Pretty printing AsciiDoc output
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If the indentation and layout of the asciidoc(1) output is not to your
liking you can:

1. Change the indentation and layout of configuration file markup
   template sections. The `{empty}` attribute is useful for outputting
   trailing blank lines in markup templates.

2. Use Dave Raggett's http://tidy.sourceforge.net/[HTML Tidy] program
   to tidy asciidoc(1) output. Example:

   $ asciidoc -b docbook -o - mydoc.txt | tidy -indent -xml >mydoc.xml

3. Use the `xmllint(1)` format option. Example:

   $ xmllint --format mydoc.xml

Supporting minor DocBook DTD variations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The conditional inclusion of DocBook SGML markup at the end of the
distribution `docbook45.conf` file illustrates how to support minor
DTD variations. The included sections override corresponding entries
from preceding sections.

Creating stand-alone HTML documents
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
If you've ever tried to send someone an HTML document that includes
stylesheets and images you'll know that it's not as straight-forward
as exchanging a single file.  AsciiDoc has options to create
stand-alone documents containing embedded images, stylesheets and
scripts.  The following AsciiDoc command creates a single file
containing <<X66,embedded images>>, CSS stylesheets, and JavaScript
(for table of contents and footnotes):

  $ asciidoc -a data-uri -a icons -a toc -a max-width=55em article.txt

You can view the HTML file here: {website}article-standalone.html[]

Shipping stand-alone AsciiDoc source
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Reproducing presentation documents from someone else's source has one
major problem: unless your configuration files are the same as the
creator's you won't get the same output.

The solution is to create a single backend specific configuration file
using the asciidoc(1) `-c` (`--dump-conf`) command-line option. You
then ship this file along with the AsciiDoc source document plus the
`asciidoc.py` script. The only end user requirement is that they have
Python installed (and that they consider you a trusted source). This
example creates a composite HTML configuration file for `mydoc.txt`:

  $ asciidoc -cb xhtml11 mydoc.txt > mydoc-xhtml11.conf

Ship `mydoc.txt`, `mydoc-html.conf`, and `asciidoc.py`. With
these three files (and a Python interpreter) the recipient can
regenerate the HMTL output:

  $ ./asciidoc.py -eb xhtml11 mydoc.txt

The `-e` (`--no-conf`) option excludes the use of implicit
configuration files, ensuring that only entries from the
`mydoc-html.conf` configuration are used.

Inserting blank space
~~~~~~~~~~~~~~~~~~~~~
Adjust your style sheets to add the correct separation between block
elements. Inserting blank paragraphs containing a single non-breaking
space character `{nbsp}` works but is an ad hoc solution compared
to using style sheets.

Closing open sections
~~~~~~~~~~~~~~~~~~~~~
You can close off section tags up to level `N` by calling the
`eval::[Section.setlevel(N)]` system macro. This is useful if you
want to include a section composed of raw markup. The following
example includes a DocBook glossary division at the top section level
(level 0):

---------------------------------------------------------------------
\ifdef::basebackend-docbook[]

\eval::[Section.setlevel(0)]

+++++++++++++++++++++++++++++++
<glossary>
  <title>Glossary
  
  ...
  

+++++++++++++++++++++++++++++++
\endif::basebackend-docbook[]
---------------------------------------------------------------------

Validating output files
~~~~~~~~~~~~~~~~~~~~~~~
Use `xmllint(1)` to check the AsciiDoc generated markup is both well
formed and valid. Here are some examples:

  $ xmllint --nonet --noout --valid docbook-file.xml
  $ xmllint --nonet --noout --valid xhtml11-file.html
  $ xmllint --nonet --noout --valid --html html4-file.html

The `--valid` option checks the file is valid against the document
type's DTD, if the DTD is not installed in your system's catalog then
it will be fetched from its Internet location. If you omit the
`--valid` option the document will only be checked that it is well
formed.

The online http://validator.w3.org/#validate_by_uri+with_options[W3C
Markup Validation Service] is the defacto standard when it comes to
validating HTML (it validates all HTML standards including HTML5).


:numbered!:

[glossary]
Glossary
--------
[glossary]
[[X8]] Block element::
    An AsciiDoc block element is a document entity composed of one or
    more whole lines of text.

[[X34]] Inline element::
    AsciiDoc inline elements occur within block element textual
    content, they perform formatting and substitution tasks.

Formal element::
    An AsciiDoc block element that has a BlockTitle. Formal elements
    are normally listed in front or back matter, for example lists of
    tables, examples and figures.

Verbatim element::
    The word verbatim indicates that white space and line breaks in
    the source document are to be preserved in the output document.


[appendix]
Migration Notes
---------------
[[X53]]
Version 7 to version 8
~~~~~~~~~~~~~~~~~~~~~~
- A new set of quotes has been introduced which may match inline text
  in existing documents -- if they do you'll need to escape the
  matched text with backslashes.
- The index entry inline macro syntax has changed -- if your documents
  include indexes you may need to edit them.
- Replaced a2x(1) `--no-icons` and `--no-copy` options with their
  negated equivalents: `--icons` and `--copy` respectively. The
  default behavior has also changed -- the use of icons and copying of
  icon and CSS files must be specified explicitly with the `--icons`
  and `--copy` options.

The rationale for the changes can be found in the AsciiDoc
`CHANGELOG`.

NOTE: If you want to disable unconstrained quotes, the new alternative
constrained quotes syntax and the new index entry syntax then you can
define the attribute `asciidoc7compatible` (for example by using the
`-a asciidoc7compatible` command-line option).

[[X38]]
[appendix]
Packager Notes
--------------
Read the `README` and `INSTALL` files (in the distribution root
directory) for install prerequisites and procedures.  The distribution
`Makefile.in` (used by `configure` to generate the `Makefile`) is the
canonical installation procedure.


[[X39]]
[appendix]
AsciiDoc Safe Mode
-------------------
AsciiDoc 'safe mode' skips potentially dangerous scripted sections in
AsciiDoc source files by inhibiting the execution of arbitrary code or
the inclusion of arbitrary files.

The safe mode is disabled by default, it can be enabled with the
asciidoc(1) `--safe` command-line option.

.Safe mode constraints
- `eval`, `sys` and `sys2` executable attributes and block macros are
  not executed.
- `include::[]` and `include1::[]` block macro
  files must reside inside the parent file's directory.
- `{include:}` executable attribute files must reside
  inside the source document directory.
- Passthrough Blocks are dropped.

[WARNING]
=====================================================================
The safe mode is not designed to protect against unsafe AsciiDoc
configuration files. Be especially careful when:

1. Implementing filters.
2. Implementing elements that don't escape special characters.
3. Accepting configuration files from untrusted sources.
=====================================================================


[appendix]
Using AsciiDoc with non-English Languages
-----------------------------------------
AsciiDoc can process UTF-8 character sets but there are some things
you need to be aware of:

- If you are generating output documents using a DocBook toolchain
  then you should set the AsciiDoc `lang` attribute to the appropriate
  language (it defaults to `en` (English)). This will ensure things
  like table of contents, figure and table captions and admonition
  captions are output in the specified language.  For example:

  $ a2x -a lang=es doc/article.txt

- If you are outputting HTML directly from asciidoc(1) you'll
  need to set the various `*_caption` attributes to match your target
  language (see the list of captions and titles in the `[attributes]`
  section of the distribution `lang-*.conf` files). The easiest way is
  to create a language `.conf` file (see the AsciiDoc's `lang-en.conf`
  file).
+
NOTE: You still use the 'NOTE', 'CAUTION', 'TIP', 'WARNING',
'IMPORTANT' captions in the AsciiDoc source, they get translated in
the HTML output file.

- asciidoc(1) automatically loads configuration files named like
  `lang-.conf` where `` is a two letter language code that
  matches the current AsciiDoc `lang` attribute. See also
  <>.


[appendix]
Vim Syntax Highlighter
----------------------
Syntax highlighting is incredibly useful, in addition to making
reading AsciiDoc documents much easier syntax highlighting also helps
you catch AsciiDoc syntax errors as you write your documents.

The AsciiDoc `./vim/` distribution directory contains Vim syntax
highlighter and filetype detection scripts for AsciiDoc.  Syntax
highlighting makes it much easier to spot AsciiDoc syntax errors.

If Vim is installed on your system the AsciiDoc installer
(`install.sh`) will automatically install the vim scripts in the Vim
global configuration directory (`/etc/vim`).

You can also turn on syntax highlighting by adding the following line
to the end of you AsciiDoc source files:

  // vim: set syntax=asciidoc:

TIP: Bold fonts are often easier to read, use the Vim `:set
background=dark` command to set bold bright fonts.

NOTE: There are a number of alternative syntax highlighters for
various editors listed on the {website}[AsciiDoc website].

Limitations
~~~~~~~~~~~
The current implementation does a reasonable job but on occasions gets
things wrong:

- Nested quoted text formatting is highlighted according to the outer
  format.
- If a closing Example Block delimiter is sometimes mistaken for a
  title underline. A workaround is to insert a blank line before the
  closing delimiter.
- Lines within a paragraph starting with equals characters may be
  highlighted as single-line titles.
- Lines within a paragraph beginning with a period may be highlighted
  as block titles.


[[X74]]
[appendix]
Attribute Options
-----------------
Here is the list of predefined <>:


[cols="2e,2,2,5",frame="topbot",options="header"]
|====================================================================
|Option|Backends|AsciiDoc Elements|Description

|autowidth |xhtml11, html5, html4 |table|
The column widths are determined by the browser, not the AsciiDoc
'cols' attribute. If there is no 'width' attribute the table width is
also left up to the browser.

|unbreakable |xhtml11, html5 |block elements|
'unbreakable' attempts to keep the block element together on a single
printed page c.f. the 'breakable' and 'unbreakable' docbook (XSL/FO)
options below.

|breakable, unbreakable |docbook (XSL/FO) |table, example, block image|
The 'breakable' options allows block elements to break across page
boundaries; 'unbreakable' attempts to keep the block element together
on a single page. If neither option is specified the default XSL
stylesheet behavior prevails.

|compact |docbook, xhtml11, html5 |bulleted list, numbered list|
Minimizes vertical space in the list

|footer |docbook, xhtml11, html5, html4 |table|
The last row of the table is rendered as a footer.

|header |docbook, xhtml11, html5, html4 |table|
The first row of the table is rendered as a header.

|pgwide |docbook (XSL/FO) |table, block image, horizontal labeled list|
Specifies that the element should be rendered across the full text
width of the page irrespective of the current indentation.

|strong |xhtml11, html5, html4 |labeled lists|
Emboldens label text.
|====================================================================


[[X82]]
[appendix]
Diagnostics
-----------
The `asciidoc(1)` `--verbose` command-line option prints additional
information to stderr: files processed, filters processed, warnings,
system attribute evaluation.

A special attribute named 'trace' enables the output of
element-by-element diagnostic messages detailing output markup
generation to stderr.  The 'trace' attribute can be set on the
command-line or from within the document using <> (the latter allows tracing to be confined to specific
portions of the document).

- Trace messages print the source file name and line number and the
  trace name followed by related markup.
- 'trace names' are normally the names of AsciiDoc elements (see the
  list below).
- The trace message is only printed if the 'trace' attribute value
  matches the start of a 'trace name'. The 'trace' attribute value can
  be any Python regular expression.  If a trace value is not specified
  all trace messages will be printed (this can result in large amounts
  of output if applied to the whole document).

- In the case of inline substitutions:
  * The text before and after the substitution is printed; the before
    text is preceded by a line containing `<<<` and the after text by
    a line containing `>>>`.
  * The 'subs' trace value is an alias for all inline substitutions.

.Trace names
.....................................................................
 block close
 block open

dropped line (a line containing an undefined attribute reference).
floating title
footer
header
list close
list entry close
list entry open
list item close
list item open
list label close
list label open
list open
macro block (a block macro)
name (man page NAME section)
paragraph
preamble close
preamble open
push blockname
pop blockname
section close
section open: level 
subs (all inline substitutions)
table
.....................................................................

Where:

- `` is section level number '0...4'.
- `` is a delimited block name: 'comment', 'sidebar',
  'open', 'pass', 'listing', 'literal', 'quote', 'example'.
- `` is an inline substitution type:
  'specialcharacters','quotes','specialwords', 'replacements',
  'attributes','macros','callouts', 'replacements2', 'replacements3'.

Command-line examples:

. Trace the entire document.

  $ asciidoc -a trace mydoc.txt

. Trace messages whose names start with `quotes` or `macros`:

  $ asciidoc -a 'trace=quotes|macros'  mydoc.txt

. Print the first line of each trace message:

  $ asciidoc -a trace mydoc.txt 2>&1 | grep ^TRACE:

Attribute Entry examples:

. Begin printing all trace messages:

  :trace:

. Print only matched trace messages:

  :trace: quotes|macros

. Turn trace messages off:

  :trace!:


[[X88]]
[appendix]
Backend Attributes
------------------
This table contains a list of optional attributes that influence the
generated outputs.

[cols="1e,1,5a",frame="topbot",options="header"]
|====================================================================
|Name |Backends |Description

|badges |xhtml11, html5 |
Link badges ('XHTML 1.1' and 'CSS') in document footers. By default
badges are omitted ('badges' is undefined).

NOTE: The path names of images, icons and scripts are relative path
names to the output document not the source document.

|data-uri |xhtml11, html5 |
Embed images using the <>.

|css-signature |html5, xhtml11 |
Set a 'CSS signature' for the document (sets the 'id' attribute of the
HTML 'body' element). CSS signatures provide a mechanism that allows
users to personalize the document appearance. The term 'CSS signature'
was http://archivist.incutio.com/viewlist/css-discuss/13291[coined by
Eric Meyer].


|disable-javascript |xhtml11, html5 |
If the `disable-javascript` attribute is defined the `asciidoc.js`
JavaScript is not embedded or linked to the output document.  By
default AsciiDoc automatically embeds or links the `asciidoc.js`
JavaScript to the output document. The script dynamically generates
<> and <>.

|[[X97]] docinfo, docinfo1, docinfo2 |All backends |
These three attributes control which <> will be included in the the header of the output file:

docinfo:: Include `-docinfo.`
docinfo1:: Include `docinfo.`
docinfo2:: Include `docinfo.` and `-docinfo.`

Where `` is the file name (sans extension) of the AsciiDoc
input file and `` is `.html` for HTML outputs or `.xml` for
DocBook outputs. If the input file is the standard input then the
output file name is used. The following example will include the
`mydoc-docinfo.xml` docinfo file in the DocBook `mydoc.xml` output
file:

  $ asciidoc -a docinfo -b docbook mydoc.txt

This next example will include `docinfo.html` and `mydoc-docinfo.html`
docinfo files in the HTML output file:

  $ asciidoc -a docinfo2 -b html4 mydoc.txt


|[[X54]]encoding |html4, html5, xhtml11, docbook |
Set the input and output document character set encoding. For example
the `--attribute encoding=ISO-8859-1` command-line option will set the
character set encoding to `ISO-8859-1`.

- The default encoding is UTF-8.
- This attribute specifies the character set in the output document.
- The encoding name must correspond to a Python codec name or alias.
- The 'encoding' attribute can be set using an AttributeEntry inside
  the document header. For example:

  :encoding: ISO-8859-1

|[[X45]]icons |xhtml11, html5 |
Link admonition paragraph and admonition block icon images and badge
images. By default 'icons' is undefined and text is used in place of
icon images.

|[[X44]]iconsdir |html4, html5, xhtml11, docbook |
The name of the directory containing linked admonition icons,
navigation icons and the `callouts` sub-directory (the `callouts`
sub-directory contains <> number images). 'iconsdir'
defaults to `./images/icons`.

|imagesdir |html4, html5, xhtml11, docbook |
If this attribute is defined it is prepended to the target image file
name paths in inline and block image macros.

|keywords, description, title |html4, html5, xhtml11 |
The 'keywords' and 'description' attributes set the correspondingly
named HTML meta tag contents; the 'title' attribute sets the HTML
title tag contents.  Their principle use is for SEO (Search Engine
Optimisation).  All three are optional, but if they are used they must
appear in the document header (or on the command-line). If 'title' is
not specified the AsciiDoc document title is used.

|linkcss |html5, xhtml11 |
Link CSS stylesheets and JavaScripts. By default 'linkcss' is
undefined in which case stylesheets and scripts are automatically
embedded in the output document.

|[[X103]]max-width |html5, xhtml11 |
Set the document maximum display width (sets the 'body' element CSS
'max-width' property).

|numbered |html4, html5, xhtml11, docbook (XSL Stylesheets) |
Adds section numbers to section titles. The 'docbook' backend ignores
'numbered' attribute entries after the document header.

|plaintext | All backends |
If this global attribute is defined all inline substitutions are
suppressed and block indents are retained.  This option is useful when
dealing with large amounts of imported plain text.

|quirks |xhtml11 |
Include the `xhtml11-quirks.conf` configuration file and
`xhtml11-quirks.css` <> to work around IE6 browser
incompatibilities. This feature is deprecated and its use is
discouraged -- documents are still viewable in IE6 without it.

|revremark |docbook |
A short summary of changes in this document revision. Must be defined
prior to the first document section. The document also needs to be
dated to output this attribute.

|scriptsdir |html5, xhtml11 |
The name of the directory containing linked JavaScripts.
See <>.

|sgml |docbook45 |
The `--backend=docbook45` command-line option produces DocBook 4.5
XML.  You can produce the older DocBook SGML format using the
`--attribute sgml` command-line option.

|stylesdir |html5, xhtml11 |
The name of the directory containing linked or embedded
<>.
See <>.

|stylesheet |html5, xhtml11 |
The file name of an optional additional CSS <>.

|theme |html5, xhtml11 |
Use alternative stylesheet (see <>).

|[[X91]]toc |html5, xhtml11, docbook (XSL Stylesheets) |
Adds a table of contents to the start of an article or book document.
The `toc` attribute can be specified using the `--attribute toc`
command-line option or a `:toc:` attribute entry in the document
header. The 'toc' attribute is defined by default when the 'docbook'
backend is used. To disable table of contents generation undefine the
'toc' attribute by putting a `:toc!:` attribute entry in the document
header or from the command-line with an `--attribute toc!` option.

*xhtml11 and html5 backends*

- JavaScript needs to be enabled in your browser.
- The following example generates a numbered table of contents using a
  JavaScript embedded in the `mydoc.html` output document:

  $ asciidoc -a toc -a numbered mydoc.txt

|toc2 |html5, xhtml11 |
Adds a scrollable table of contents in the left hand margin of an
article or book document. Use the 'max-width' attribute to change the
content width. In all other respects behaves the same as the 'toc'
attribute.

|toc-placement |html5, xhtml11 |
When set to 'auto' (the default value) asciidoc(1) will place the
table of contents in the document header. When 'toc-placement' is set
to 'manual' the TOC can be positioned anywhere in the document by
placing the `toc::[]` block macro at the point you want the TOC to
appear.

NOTE: If you use 'toc-placement' then you also have to define the
<> attribute.

|toc-title |html5, xhtml11 |
Sets the table of contents title (defaults to 'Table of Contents').

|toclevels |html5, xhtml11 |
Sets the number of title levels (1..4) reported in the table of
contents (see the 'toc' attribute above). Defaults to 2 and must be
used with the 'toc' attribute. Example usage:

  $ asciidoc -a toc -a toclevels=3 doc/asciidoc.txt

|====================================================================


[appendix]
License
-------
AsciiDoc is free software; you can redistribute it and/or modify it
under the terms of the 'GNU General Public License version 2' (GPLv2)
as published by the Free Software Foundation.

AsciiDoc is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
General Public License version 2 for more details.

AsciiDoc Highlighter sponsored by O'Reilly Media

Copyright (C) 2002-2011 Stuart Rackham.


================================================
FILE: demo/kitchen-sink/docs/assembly_x86.asm
================================================
section	.text
    global main         ;must be declared for using gcc

main:	                ;tell linker entry point

	mov	edx, len	    ;message length
	mov	ecx, msg	    ;message to write
	mov	ebx, 1	        ;file descriptor (stdout)
	mov	eax, 4	        ;system call number (sys_write)
	int	0x80	        ;call kernel

	mov	eax, 1	        ;system call number (sys_exit)
	int	0x80	        ;call kernel

section	.data

msg	db	'Hello, world!',0xa	;our dear string
len	equ	$ - msg			;length of our dear string


================================================
FILE: demo/kitchen-sink/docs/autohotkey.ahk
================================================
#NoEnv
SetBatchLines -1

CoordMode Mouse, Screen
OnExit GuiClose

zoom := 9

computeSize(){
	global as_x
	as_x := Round(ws_x/zoom/2 - 0.5)
	if (zoom>1) {
		pix := Round(zoom)
	} ele {
		pix := 1
	}
    ToolTip Message %as_x% %zoom% %ws_x% %hws_x% 
}

hdc_frame := DllCall("GetDC", UInt, MagnifierID)

; comment
DrawCross(byRef x="", rX,rY,z, dc){
        ;specify the style, thickness and color of the cross lines
    h_pen := DllCall( "gdi32.dll\CreatePen", Int, 0, Int, 1, UInt, 0x0000FF)
}

;Ctrl ^; Shift +; Win #; Alt !
^NumPadAdd::
^WheelUp::   
^;::   ;comment
    If(zoom < ws_x and ( A_ThisHotKey = "^WheelUp" or A_ThisHotKey ="^NumPadAdd") )
		zoom *= 1.189207115         ; sqrt(sqrt(2))
	Gosub,setZoom
return


================================================
FILE: demo/kitchen-sink/docs/batchfile.bat
================================================
:: batch file highlighting in Ace!
@echo off

CALL set var1=%cd%
echo unhide everything in %var1%!

:: FOR loop in bat is super strange!
FOR /f "tokens=*" %%G IN ('dir /A:D /b') DO (
echo %var1%%%G
attrib -r -a -h -s "%var1%%%G" /D /S
)

pause

REM that's all


================================================
FILE: demo/kitchen-sink/docs/bro.bro
================================================
##! Add countries for the originator and responder of a connection
##! to the connection logs.

module Conn;

export {
	redef record Conn::Info += {
		## Country code for the originator of the connection based 
		## on a GeoIP lookup.
		orig_cc: string &optional &log;
		## Country code for the responser of the connection based 
		## on a GeoIP lookup.
		resp_cc: string &optional &log;
	};
}

event connection_state_remove(c: connection) 
	{
	local orig_loc = lookup_location(c$id$orig_h);
	if ( orig_loc?$country_code )
		c$conn$orig_cc = orig_loc$country_code;

	local resp_loc = lookup_location(c$id$resp_h);
	if ( resp_loc?$country_code )
		c$conn$resp_cc = resp_loc$country_code;
	}

================================================
FILE: demo/kitchen-sink/docs/c9search.c9search_results
================================================
Searching for var in/.c9/metadata/workspace/pluginsregexp, case sensitive, whole word

configs/default.js:
    1: var fs = require("fs");
	2: var argv = require('optimist').argv;
	3: var path = require("path");
	5: var clientExtensions = {};
	6: var clientDirs = fs.readdirSync(__dirname + "/../plugins-client");
	7: for (var i = 0; i < clientDirs.length; i++) {
	8:     var dir = clientDirs[i];
	12:     var name = dir.split(".")[1];
	16: var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();
	17: var fsUrl = "/workspace";
	19: var port = argv.p || process.env.PORT || 3131;
	20: var host = argv.l || "localhost";
	22: var config = {

configs/local.js:
	2: var config = require("./default");

configs/packed.js:
	1: var config = require("./default");


Found 15 matches in 3 files

================================================
FILE: demo/kitchen-sink/docs/c_cpp.cpp
================================================
// compound assignment operators

#include 

#include \
   

#include \
   \
   

#include \
   \
   "iostream"

#include 
#include "boost/asio/io_service.hpp"

#include \
   \
   "iostream" \
   "string" \
   
   
using namespace std;

//
int main ()
{
    int a, b=3; /* foobar */
    a = b; // single line comment\
        continued
    a+=2; // equivalent to a=a+2
    cout << a;
    #if VERBOSE >= 2
        prints("trace message\n");
    #endif
    return 0;
}

/* Print an error message and get out */
#define ABORT                             \
    do {                                  \
        print( "Abort\n" );                \
        exit(8);                          \
} while (0)                      /* Note: No semicolon */

================================================
FILE: demo/kitchen-sink/docs/cirru.cirru
================================================
-- https://github.com/Cirru/cirru-gopher/blob/master/code/scope.cr,

set a (int 2)

print (self)

set c (child)

under c
  under parent
    print a

print $ get c a

set c x (int 3)
print $ get c x

set just-print $ code
  print a

print just-print

eval (self) just-print
eval just-print

print (string "string with space")
print (string "escapes \n \"\\")

brackets ((((()))))

"eval" $ string "eval"

print (add $ (int 1) (int 2))

print $ unwrap $
  map (a $ int 1) (b $ int 2)

print a
  int 1
  , b c
  int 2
  , d

================================================
FILE: demo/kitchen-sink/docs/clojure.clj
================================================
(defn parting
  "returns a String parting in a given language"
  ([] (parting "World"))
  ([name] (parting name "en"))
  ([name language]
    ; condp is similar to a case statement in other languages.
    ; It is described in more detail later.
    ; It is used here to take different actions based on whether the
    ; parameter "language" is set to "en", "es" or something else.
    (condp = language
      "en" (str "Goodbye, " name)
      "es" (str "Adios, " name)
      (throw (IllegalArgumentException.
        (str "unsupported language " language))))))

(println (parting)) ; -> Goodbye, World
(println (parting "Mark")) ; -> Goodbye, Mark
(println (parting "Mark" "es")) ; -> Adios, Mark
(println (parting "Mark", "xy")) ; -> java.lang.IllegalArgumentException: unsupported language xy

================================================
FILE: demo/kitchen-sink/docs/cobol.CBL
================================================
TODO

================================================
FILE: demo/kitchen-sink/docs/coffee.coffee
================================================
#!/usr/bin/env coffee

try
    throw URIError decodeURI(0xC0ffee * 123456.7e-8 / .9)
catch e
    console.log 'qstring' + "qqstring" + '''
        qdoc
    ''' + """
        qqdoc
    """

do ->
    ###
    herecomment
    ###
    re = /regex/imgy.test ///
        heregex  # comment
    ///imgy
    this isnt: `just JavaScript`
    undefined
    
sentence = "#{ 22 / 7 } is a decent approximation of π"

================================================
FILE: demo/kitchen-sink/docs/coldfusion.cfm
================================================




#welcome#

================================================
FILE: demo/kitchen-sink/docs/csharp.cs
================================================
public void HelloWorld() {
    //Say Hello!
    Console.WriteLine("Hello World");
}

================================================
FILE: demo/kitchen-sink/docs/csound_document.csd
================================================
text


0dbfs = 1
prints "hello, world\n"


i 1 0 0







================================================
FILE: demo/kitchen-sink/docs/csound_orchestra.orc
================================================
/*
 * comment
 */
; comment
// comment

instr/**/1,/**/N_a_M_e_,/**/+Name/**///
  iDuration = p3
  outc:a(aSignal)
endin

opcode/**/aUDO,/**/i[],/**/aik//
  aUDO
endop

123 0123456789
0xabcdef0123456789 0XABCDEF
1e2 3e+4 5e-6 7E8 9E+0 1E-2 3. 4.56 .789

"characters$MACRO."
"\\\a\b\n\r\t\012\345\67\""

{{
characters$MACRO.
}}
{{\\\a\b\n\r\t\"\012\345\67}}

+ - ~ ¬ ! * / ^ % << >> < > <= >= == != & # | && || ? : += -= *= /=

0dbfs A4 kr ksmps nchnls nchnls_i sr

do else elseif endif enduntil fi if ithen kthen od then until while
return rireturn

aLabel:
 label2:

goto aLabel
reinit aLabel
cggoto 1==0, aLabel
timout 0, 0, aLabel
loop_ge 0, 0, 0, aLabel

readscore {{
i 1 0 0
}}
pyrun {{
# Python
}}
lua_exec {{
-- Lua
}}

#include/**/"file.udo"
#include/**/|file.udo|

#ifdef MACRO
#else
#ifndef MACRO
#endif
#undef MACRO

#   define MACRO#macro_body#
#define/**/
MACRO/**/
#\#macro
body\##

#define MACRO(ARG1#ARG2) #macro_body#
#define/**/
MACRO(ARG1'ARG2'ARG3)/**/
#\#macro
body\##

$MACRO $MACRO.
$MACRO(x)
@0
@@ 1
$MACRO.(((x#y\)))' "(#'x)\)x\))"# {{x\))x)\)(#'}});


================================================
FILE: demo/kitchen-sink/docs/csound_score.sco
================================================
/*
 * comment
 */
; comment
// comment
a b C d e f i q s t v x y
z
np0 nP1 Np2 NP3
m/**/label;
n label
123 0123456789
0xabcdef0123456789 0XABCDEF
1e2 3e+4 5e-6 7E8 9E+0 1E-2 3. 4.56 .789
"characters$MACRO."
{ 1 I
  { 2 J
    { 3 K
      $I $J $K
    }
  }
}
#include "score.sco"


================================================
FILE: demo/kitchen-sink/docs/css.css
================================================
.text-layer {
    font: 12px Monaco, "Courier New", monospace;
    cursor: text;
}

.blinker {
    animation: blink 1s linear infinite alternate;
}

@keyframes blink {
    0%, 40% {
        opacity: 0; /*
        */
        opacity: 1
    }

    40.5%, 100% {
        opacity: 1
    }
}

@document url(http://c9.io/), url-prefix(http://ace.c9.io/build/),
   domain(c9.io), regexp("https:.*") /**/
{
    /**/
    img[title]:before 
    {
        content: attr(title) "\AImage \
            retrieved from"
            attr(src); /*
            */
        white-space: pre;
        display: block;
        background: url(asdasd); "err
    }
}



================================================
FILE: demo/kitchen-sink/docs/curly.curly
================================================

    

    

    
    
        

{{author_name}}

================================================ FILE: demo/kitchen-sink/docs/d.d ================================================ #!/usr/bin/env rdmd // Computes average line length for standard input. import std.stdio; void main() { ulong lines = 0; double sumLength = 0; foreach (line; stdin.byLine()) { ++lines; sumLength += line.length; } writeln("Average line length: ", lines ? sumLength / lines : 0); } ================================================ FILE: demo/kitchen-sink/docs/dart.dart ================================================ // Go ahead and modify this example. import "dart:html"; // Computes the nth Fibonacci number. int fibonacci(int n) { if (n < 2) return n; return fibonacci(n - 1) + fibonacci(n - 2); } // Displays a Fibonacci number. void main() { int i = 20; String message = "fibonacci($i) = ${fibonacci(i)}"; // This example uses HTML to display the result and it will appear // in a nested HTML frame (an iframe). document.body.append(new HeadingElement.h1()..appendText(message)); } ================================================ FILE: demo/kitchen-sink/docs/diff.diff ================================================ diff --git a/lib/ace/edit_session.js b/lib/ace/edit_session.js index 23fc3fc..ed3b273 100644 --- a/lib/ace/edit_session.js +++ b/lib/ace/edit_session.js @@ -51,6 +51,7 @@ var TextMode = require("./mode/text").Mode; var Range = require("./range").Range; var Document = require("./document").Document; var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; +var SearchHighlight = require("./search_highlight").SearchHighlight; /** * class EditSession @@ -307,6 +308,13 @@ var EditSession = function(text, mode) { return token; }; + this.highlight = function(re) { + if (!this.$searchHighlight) { + var highlight = new SearchHighlight(null, "ace_selected-word", "text"); + this.$searchHighlight = this.addDynamicMarker(highlight); + } + this.$searchHighlight.setRegexp(re); + } /** * EditSession.setUndoManager(undoManager) * - undoManager (UndoManager): The new undo manager @@ -556,7 +564,8 @@ var EditSession = function(text, mode) { type : type || "line", renderer: typeof type == "function" ? type : null, clazz : clazz, - inFront: !!inFront + inFront: !!inFront, + id: id } if (inFront) { diff --git a/lib/ace/editor.js b/lib/ace/editor.js index 834e603..b27ec73 100644 --- a/lib/ace/editor.js +++ b/lib/ace/editor.js @@ -494,7 +494,7 @@ var Editor = function(renderer, session) { * Emitted when a selection has changed. **/ this.onSelectionChange = function(e) { - var session = this.getSession(); + var session = this.session; if (session.$selectionMarker) { session.removeMarker(session.$selectionMarker); @@ -509,12 +509,40 @@ var Editor = function(renderer, session) { this.$updateHighlightActiveLine(); } - var self = this; - if (this.$highlightSelectedWord && !this.$wordHighlightTimer) - this.$wordHighlightTimer = setTimeout(function() { - self.session.$mode.highlightSelection(self); - self.$wordHighlightTimer = null; - }, 30, this); + var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp() }; diff --git a/lib/ace/search_highlight.js b/lib/ace/search_highlight.js new file mode 100644 index 0000000..b2df779 --- /dev/null +++ b/lib/ace/search_highlight.js @@ -0,0 +1,3 @@ +new +empty file ================================================ FILE: demo/kitchen-sink/docs/dot.dot ================================================ // Original source: http://www.graphviz.org/content/lion_share ##"A few people in the field of genetics are using dot to draw "marriage node diagram" pedigree drawings. Here is one I have done of a test pedigree from the FTREE pedigree drawing package (Lion Share was a racehorse)." Contributed by David Duffy. ##Command to get the layout: "dot -Tpng thisfile > thisfile.png" digraph Ped_Lion_Share { # page = "8.2677165,11.692913" ; ratio = "auto" ; mincross = 2.0 ; label = "Pedigree Lion_Share" ; "001" [shape=box , regular=1,style=filled,fillcolor=white ] ; "002" [shape=box , regular=1,style=filled,fillcolor=white ] ; "003" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "004" [shape=box , regular=1,style=filled,fillcolor=white ] ; "005" [shape=box , regular=1,style=filled,fillcolor=white ] ; "006" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "007" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "009" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "014" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "015" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "016" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "ZZ01" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "ZZ02" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "017" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "012" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "008" [shape=box , regular=1,style=filled,fillcolor=white ] ; "011" [shape=box , regular=1,style=filled,fillcolor=white ] ; "013" [shape=box , regular=1,style=filled,fillcolor=white ] ; "010" [shape=box , regular=1,style=filled,fillcolor=white ] ; "023" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "020" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "021" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "018" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "025" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "019" [shape=box , regular=1,style=filled,fillcolor=white ] ; "022" [shape=box , regular=1,style=filled,fillcolor=white ] ; "024" [shape=box , regular=1,style=filled,fillcolor=white ] ; "027" [shape=circle , regular=1,style=filled,fillcolor=white ] ; "026" [shape=box , regular=1,style=filled,fillcolor=white ] ; "028" [shape=box , regular=1,style=filled,fillcolor=grey ] ; "marr0001" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "001" -> "marr0001" [dir=none,weight=1] ; "007" -> "marr0001" [dir=none,weight=1] ; "marr0001" -> "017" [dir=none, weight=2] ; "marr0002" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "001" -> "marr0002" [dir=none,weight=1] ; "ZZ02" -> "marr0002" [dir=none,weight=1] ; "marr0002" -> "012" [dir=none, weight=2] ; "marr0003" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "002" -> "marr0003" [dir=none,weight=1] ; "003" -> "marr0003" [dir=none,weight=1] ; "marr0003" -> "008" [dir=none, weight=2] ; "marr0004" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "002" -> "marr0004" [dir=none,weight=1] ; "006" -> "marr0004" [dir=none,weight=1] ; "marr0004" -> "011" [dir=none, weight=2] ; "marr0005" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "002" -> "marr0005" [dir=none,weight=1] ; "ZZ01" -> "marr0005" [dir=none,weight=1] ; "marr0005" -> "013" [dir=none, weight=2] ; "marr0006" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "004" -> "marr0006" [dir=none,weight=1] ; "009" -> "marr0006" [dir=none,weight=1] ; "marr0006" -> "010" [dir=none, weight=2] ; "marr0007" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "005" -> "marr0007" [dir=none,weight=1] ; "015" -> "marr0007" [dir=none,weight=1] ; "marr0007" -> "023" [dir=none, weight=2] ; "marr0008" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "005" -> "marr0008" [dir=none,weight=1] ; "016" -> "marr0008" [dir=none,weight=1] ; "marr0008" -> "020" [dir=none, weight=2] ; "marr0009" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "005" -> "marr0009" [dir=none,weight=1] ; "012" -> "marr0009" [dir=none,weight=1] ; "marr0009" -> "021" [dir=none, weight=2] ; "marr0010" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "008" -> "marr0010" [dir=none,weight=1] ; "017" -> "marr0010" [dir=none,weight=1] ; "marr0010" -> "018" [dir=none, weight=2] ; "marr0011" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "011" -> "marr0011" [dir=none,weight=1] ; "023" -> "marr0011" [dir=none,weight=1] ; "marr0011" -> "025" [dir=none, weight=2] ; "marr0012" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "013" -> "marr0012" [dir=none,weight=1] ; "014" -> "marr0012" [dir=none,weight=1] ; "marr0012" -> "019" [dir=none, weight=2] ; "marr0013" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "010" -> "marr0013" [dir=none,weight=1] ; "021" -> "marr0013" [dir=none,weight=1] ; "marr0013" -> "022" [dir=none, weight=2] ; "marr0014" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "019" -> "marr0014" [dir=none,weight=1] ; "020" -> "marr0014" [dir=none,weight=1] ; "marr0014" -> "024" [dir=none, weight=2] ; "marr0015" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "022" -> "marr0015" [dir=none,weight=1] ; "025" -> "marr0015" [dir=none,weight=1] ; "marr0015" -> "027" [dir=none, weight=2] ; "marr0016" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "024" -> "marr0016" [dir=none,weight=1] ; "018" -> "marr0016" [dir=none,weight=1] ; "marr0016" -> "026" [dir=none, weight=2] ; "marr0017" [shape=diamond,style=filled,label="",height=.1,width=.1] ; "026" -> "marr0017" [dir=none,weight=1] ; "027" -> "marr0017" [dir=none,weight=1] ; "marr0017" -> "028" [dir=none, weight=2] ; } ================================================ FILE: demo/kitchen-sink/docs/drools.drl ================================================ /* * Copyright 2010 JBoss Inc * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* Original source https://github.com/droolsjbpm/drools/blob/master/drools-examples/ http://docs.jboss.org/drools/ */ package com.example.ace import java.math.BigDecimal import function my.package.Foo.hello declare FactType @author( Bob ) id : String name : String @maxLength(100) @notnull value : BigDecimal end declare FactType2 extends AnotherType end declare trait TraitType extends com.package.AnotherType end declare trait GoldenCustomer balance : long @Alias( "org.acme.foo.accountBalance" ) end global org.slf4j.Logger logger /** * @param name who we'll salute? */ function String hello(String name) { return "Hello "+name+"!"; } rule "Trim all strings" dialect "java" no-loop when // fdsfds $s : String(a == null || == "empty", $g : size) Cheese( name matches "(Buffalo)?\\S*Mozarella" ) CheeseCounter( cheeses contains $var ) // contains with a variable CheeseCounter( cheese memberof $matureCheeses ) Cheese( name soundslike 'foobar' ) Message( routingValue str[startsWith] "R1" ) Cheese( name in ( "stilton", "cheddar", $cheese ) ) Person( eval( age == girlAge + 2 ), sex = 'M' ) then /** * TODO There mus be better way */ retract($s); String a = "fd"; a.toString(); insert($s.trim()); end query isContainedIn( String x, String y ) Location( x, y; ) or ( Location( z, y; ) and isContainedIn( x, z; ) ) end rule "go" salience 10 when $s : String( ) then System.out.println( $s ); end rule "When all English buses are not red" when not(forall( $bus : Bus( nationality == 'english') Bus( this == $bus, color = 'red' ) )) then // What if all english buses are not red? end rule "go1" when String( this == "go1" ) isContainedIn("Office", "House"; ) then System.out.println( "office is in the house" ); end rule "go2" when String( this == "go2" ) isContainedIn("Draw", "House"; ) then System.out.println( "Draw in the House" ); end /** * Go Right */ rule GoRight dialect "mvel" salience (Math.abs( $df.colDiff )) when $df : DirectionDiff(colDiff > 0 ) $target : Cell( row == $df.row, col == ($df.col + 1) ) CellContents( cell == $target, cellType != CellType.WALL ) not Direction(character == $df.fromChar, horizontal == Direction.RIGHT ) then System.out.println( "monster right" ); retract( $df ); insert( new Direction($df.fromChar, Direction.RIGHT, Direction.NONE ) ); end ================================================ FILE: demo/kitchen-sink/docs/eiffel.e ================================================ note description: "Represents a person." class PERSON create make, make_unknown feature {NONE} -- Creation make (a_name: like name) -- Create a person with `a_name' as `name'. do name := a_name ensure name = a_name end make_unknown do ensure name = Void end feature -- Access name: detachable STRING -- Full name or Void if unknown. end ================================================ FILE: demo/kitchen-sink/docs/ejs.ejs ================================================ Cloud9 Rocks! <% if (!isRoot) { %> <% } %> <% entries.forEach(function(entry) { %> <% }) %>
Name Size
..
<%= entry.name %> <%= entry.size %>
================================================ FILE: demo/kitchen-sink/docs/elixir.ex ================================================ defmodule HelloModule do @moduledoc """ This is supposed to be `markdown`. __Yes__ this is [mark](http://down.format) # Truly ## marked * with lists * more * and more Even.with(code) blocks |> with |> samples _Docs are first class citizens in Elixir_ (Jose Valim) """ # A "Hello world" function def some_fun do IO.puts "Juhu Kinners!" end # A private function defp priv do is_regex ~r""" This is a regex spanning several lines. """ x = elem({ :a, :b, :c }, 0) #=> :a end end test_fun = fn(x) -> cond do x > 10 -> :greater_than_ten true -> :maybe_ten end end ================================================ FILE: demo/kitchen-sink/docs/elm.elm ================================================ {- Ace {- 4 -} Elm -} main = lift clock (every second) clock t = collage 400 400 [ filled lightGrey (ngon 12 110) , outlined (solid grey) (ngon 12 110) , hand orange 100 t , hand charcoal 100 (t/60) , hand charcoal 60 (t/720) ] hand clr len time = let angle = degrees (90 - 6 * inSeconds time) in traced (solid clr) <| segment (0,0) (len * cos angle, len * sin angle) ================================================ FILE: demo/kitchen-sink/docs/erlang.erl ================================================ %% A process whose only job is to keep a counter. %% First version -module(counter). -export([start/0, codeswitch/1]). start() -> loop(0). loop(Sum) -> receive {increment, Count} -> loop(Sum+Count); {counter, Pid} -> Pid ! {counter, Sum}, loop(Sum); code_switch -> ?MODULE:codeswitch(Sum) % Force the use of 'codeswitch/1' from the latest MODULE version end. codeswitch(Sum) -> loop(Sum). ================================================ FILE: demo/kitchen-sink/docs/forth.frt ================================================ : HELLO ( -- ) CR ." Hello, world!" ; HELLO Hello, world! : [CHAR] CHAR POSTPONE LITERAL ; IMMEDIATE 0 value ii 0 value jj 0 value KeyAddr 0 value KeyLen create SArray 256 allot \ state array of 256 bytes : KeyArray KeyLen mod KeyAddr ; : get_byte + c@ ; : set_byte + c! ; : as_byte 255 and ; : reset_ij 0 TO ii 0 TO jj ; : i_update 1 + as_byte TO ii ; : j_update ii SArray get_byte + as_byte TO jj ; : swap_s_ij jj SArray get_byte ii SArray get_byte jj SArray set_byte ii SArray set_byte ; : rc4_init ( KeyAddr KeyLen -- ) 256 min TO KeyLen TO KeyAddr 256 0 DO i i SArray set_byte LOOP reset_ij BEGIN ii KeyArray get_byte jj + j_update swap_s_ij ii 255 < WHILE ii i_update REPEAT reset_ij ; : rc4_byte ii i_update jj j_update swap_s_ij ii SArray get_byte jj SArray get_byte + as_byte SArray get_byte xor ; ================================================ FILE: demo/kitchen-sink/docs/fortran.f90 ================================================ #include "globalDefines.h" !========================================================= program main !========================================================= use params_module, only : nx, ny, nz implicit none integer, parameter :: g = 9.81 real, allocatable, dimension(:,:,:) :: array integer :: a, b, c real*8 :: x, y, z b = 5 c = 7 #ifdef ARRAY_COMP allocate(array(10,10,10), status=a) write(c,'(i5.5)') b #endif if(x.lt.5.0) then array(:,:,:) = g else array(:,:,:) = x - y endif return !======================================================== end program main !======================================================== ================================================ FILE: demo/kitchen-sink/docs/ftl.ftl ================================================ <#ftl encoding="utf-8" /> <#setting locale="en_US" /> <#import "library" as lib /> <#-- FreeMarker comment ${abc} <#assign a=12 /> --> ${title!"FreeMarker"}<title> </head> <body> <h1>Hello ${name!""}</h1> <p>Today is: ${.now?date}</p> <#assign x = 13> <#if x > 12 && x lt 14>x equals 13: ${x}</#if> <ul> <#list items as item> <li>${item_index}: ${item.name!?split("\n")[0]}</li> </#list> </ul> User directive: <@lib.function attr1=true attr2='value' attr3=-42.12>Test</@lib.function> <@anotherOne /> <#if variable?exists> Deprecated <#elseif variable??> Better <#else> Default </#if> <img src="images/${user.id}.png" /> </body> </html> ================================================ FILE: demo/kitchen-sink/docs/gcode.gcode ================================================ O003 (DIAMOND SQUARE) N2 G54 G90 G49 G80 N3 M6 T1 (1.ENDMILL) N4 M3 S1800 N5 G0 X-.6 Y2.050 N6 G43 H1 Z.1 N7 G1 Z-.3 F50. N8 G41 D1 Y1.45 N9 G1 X0 F20. N10 G2 J-1.45 (CUTTER COMP CANCEL) N11 G1 Z-.2 F50. N12 Y-.990 N13 G40 N14 G0 X-.6 Y1.590 N15 G0 Z.1 N16 M5 G49 G28 G91 Z0 N17 CALL O9456 N18 #500=0.004 N19 #503=[#500+#501] N20 VC45=0.0006 VS4=0.0007 N21 G90 G10 L20 P3 X5.Y4. Z6.567 N22 G0 X5000 N23 IF [#1 LT 0.370] GOTO 49 N24 X-0.678 Y+.990 N25 G84.3 X-0.1 N26 #4=#5*COS[45] N27 #4=#5*SIN[45] N28 VZOFZ=652.9658 % ================================================ FILE: demo/kitchen-sink/docs/gherkin.feature ================================================ @these @_are_ @tags Feature: Serve coffee Coffee should not be served until paid for Coffee should not be served until the button has been pressed If there is no coffee left then money should be refunded Scenario Outline: Eating Given there are <start> cucumbers When I eat <eat> cucumbers Then I should have <left> cucumbers Examples: | start | eat | left | | 12 | 5 | 7 | | @20 | 5 | 15 | Scenario: Buy last coffee Given there are 1 coffees left in the machine And I have deposited 1$ When I press the coffee button Then I should be served a "coffee" # this a comment """ this is a pystring """ ================================================ FILE: demo/kitchen-sink/docs/glsl.glsl ================================================ uniform float amplitude; attribute float displacement; varying vec3 vNormal; void main() { vNormal = normal; // multiply our displacement by the // amplitude. The amp will get animated // so we'll have animated displacement vec3 newPosition = position + normal * vec3(displacement * amplitude); gl_Position = projectionMatrix * modelViewMatrix * vec4(newPosition,1.0); } ================================================ FILE: demo/kitchen-sink/docs/gobstones.gbs ================================================ program { /* * A gobstons multiline comment * Taken from: * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/" */ sumar(2, 3) } function sumar(a, b) { r := a + b } // unreachable code -- unreachable code # unreachable code procedure hacerAlgo() { Mover(Este) Poner(Rojo) Sacar(Azul) } ================================================ FILE: demo/kitchen-sink/docs/golang.go ================================================ // Concurrent computation of pi. // See http://goo.gl/ZuTZM. // // This demonstrates Go's ability to handle // large numbers of concurrent processes. // It is an unreasonable way to calculate pi. package main import ( "fmt" "math" ) func main() { fmt.Println(pi(5000)) } // pi launches n goroutines to compute an // approximation of pi. func pi(n int) float64 { ch := make(chan float64) for k := 0; k <= n; k++ { go term(ch, float64(k)) } f := 0.0 for k := 0; k <= n; k++ { f += <-ch } return f } func term(ch chan float64, k float64) { ch <- 4 * math.Pow(-1, k) / (2*k + 1) } ================================================ FILE: demo/kitchen-sink/docs/graphqlschema.gql ================================================ # Main Schema schema { query: Query; } scalar Date; # Simple type to contain all scalar types type AllTypes { # Field Description for String testString: String; # Field Description for Int testInt: Int; # Field Description for ID testID: ID; # Field Description for Boolean testBoolean: Boolean; # Field Description for Float testFloat: Float; } interface ISearchable { searchPreview: String!; } union ProductTypes = Movie | Book; # Testing enum enum MovieGenere { ACTION COMEDY THRILLER DRAMA } # Testing Input input SearchByGenere { before: Date; after: Date; genere: MovieGenere!; } # Testing Interface type Movie implements ISearchable { id: ID!; searchPreview: String!; rentPrice: Float; publishDate: Date; genere: MovieGenere; cast: [String]; } # Testing Interface type Book implements ISearchable { id: ID!; searchPreview: String!; price: Float; publishDate: Date; authors: [String]; } type Query { testString: String; testDate; Date; allTypes: AllTypes; allProducts: [ProductTypes]; # searches only movies by genere with sophisticated argument searchMovieByGenere(searchObject: SearchByGenere!): [Movie]; # Searchs all products by text string searchProduct(text: String!): [ISearchable]; } ================================================ FILE: demo/kitchen-sink/docs/groovy.groovy ================================================ //http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy class Employee { def name, salary boolean manager String toString() { return name } } def emps = [new Employee(name:'Guillaume', manager:true, salary:200), new Employee(name:'Graeme', manager:true, salary:200), new Employee(name:'Dierk', manager:false, salary:151), new Employee(name:'Bernd', manager:false, salary:50)] def managers(emps) { emps.findAll { e -> e.isManager() } } assert emps[0..1] == managers(emps) // [Guillaume, Graeme] def highPaid(emps) { threshold = 150 emps.findAll { e -> e.salary > threshold } } assert emps[0..2] == highPaid(emps) // [Guillaume, Graeme, Dierk] def paidMore(amount) { { e -> e.salary > amount} } def highPaid = paidMore(150) assert highPaid(emps[0]) // true assert emps[0..2] == emps.findAll(highPaid) def filename = 'test.txt' new File(filename).withReader{ reader -> doSomethingWith(reader) } def readersText def doSomethingWith(reader) { readersText = reader.text } assert new File(filename).text == readersText ================================================ FILE: demo/kitchen-sink/docs/haml.haml ================================================ !!!5 /[if IE] %a{ :href => 'http://www.mozilla.com/en-US/firefox/' } %h1 Get Firefox -# This is a HAML comment. It will not show in the output HTML -# This is a HAML multiline comment This won't be displayed Nor will this Nor will this. / This is a HTML comment. It will be rendered as HTML / %p This doesn't render... %div %h1 Because it's commented out! .row .col-md-6 .col-md-6 #users.row.green #articles{:style => "border: 5px;"} #lists.list-inline %div#todos.bg-green{:id => "#{@item.type}_#{@item.number}", :class => '#{@item.type} #{@item.urgency}', :phoney => `asdasdasd`} / file: app/views/movies/index.html.haml %ads:{:bleh => 33} %p Date/Time: - now = DateTime.now %strong= now = if now DateTime.parse("December 31, 2006") = "Happy new " + "year!" %sfd.dfdfg #content .title %h1= @title = link_to 'Home', home_url #contents %div#content %div.articles %div.article.title Blah %div.article.date 2006-11-05 %div.article.entry Neil Patrick Harris %div[@user, :greeting] %bar[290] / This is a comment / This is another comment with line break above .row .col-md-6 .col-md-6 .col-md-6 .row .col-md-6 .col-md-6 ================================================ FILE: demo/kitchen-sink/docs/handlebars.hbs ================================================ {{!-- Ace + :-}} --}} <div id="comments"> {{#each comments}} <h2><a href="/posts/{{../permalink}}#{{id}}">{{title}}</a></h2> <div>{{{body}}}</div> {{/each}} </div> ================================================ FILE: demo/kitchen-sink/docs/haskell.hs ================================================ -- Type annotation (optional) fib :: Int -> Integer -- With self-referencing data fib n = fibs !! n where fibs = 0 : scanl (+) 1 fibs -- 0,1,1,2,3,5,... -- Same, coded directly fib n = fibs !! n where fibs = 0 : 1 : next fibs next (a : t@(b:_)) = (a+b) : next t -- Similar idea, using zipWith fib n = fibs !! n where fibs = 0 : 1 : zipWith (+) fibs (tail fibs) -- Using a generator function fib n = fibs (0,1) !! n where fibs (a,b) = a : fibs (b,a+b) ================================================ FILE: demo/kitchen-sink/docs/haskell_cabal.cabal ================================================ name: reload version: 0.1.0.0 synopsis: Initial project template from stack Description: The \'cabal\' command-line program simplifies the process of managing Haskell software by automating the fetching, configuration, compilation and installation of Haskell libraries and programs. homepage: https://github.com/jpmoresmau/dbIDE/reload#readme license: BSD3 license-file: LICENSE author: JP Moresmau maintainer: jpmoresmau@gmail.com copyright: 2016 JP Moresmau category: Web build-type: Simple -- extra-source-files: cabal-version: >=1.10 Flag network-uri description: Get Network.URI from the network-uri package default: True library hs-source-dirs: src exposed-modules: Language.Haskell.Reload build-depends: base >= 4.7 && < 5 , aeson , scotty , wai , text , directory , filepath , bytestring , containers , mime-types , transformers , wai-handler-launch , wai-middleware-static , wai-extra , http-types default-language: Haskell2010 other-modules: Language.Haskell.Reload.FileBrowser ghc-options: -Wall -O2 executable reload-exe hs-source-dirs: app main-is: Main.hs ghc-options: -threaded -O2 -rtsopts -with-rtsopts=-N build-depends: base , reload default-language: Haskell2010 test-suite reload-test type: exitcode-stdio-1.0 hs-source-dirs: test main-is: Spec.hs build-depends: base , reload , hspec , hspec-wai , hspec-wai-json , aeson , directory , filepath , text , containers , unordered-containers , bytestring , wai-extra ghc-options: -threaded -O2 -rtsopts -with-rtsopts=-N default-language: Haskell2010 other-modules: Language.Haskell.Reload.FileBrowserSpec Language.Haskell.ReloadSpec source-repository head type: git location: https://github.com/jpmoresmau/dbIDE/reload ================================================ FILE: demo/kitchen-sink/docs/hjson.hjson ================================================ { # specify rate in requests/second (because comments are helpful!) rate: 1000 // prefer c-style comments? /* feeling old fashioned? */ # did you notice that rate doesn't need quotes? hey: look ma, no quotes for strings either! # best of all notice: [] anything: ? # yes, commas are optional! } ================================================ FILE: demo/kitchen-sink/docs/htaccess ================================================ Redirect /linux http://www.linux.org Redirect 301 /kernel http://www.linux.org # comment RewriteEngine on RewriteCond %{HTTP_USER_AGENT} ^Mozilla.* RewriteRule ^/$ /homepage.max.html [L] RewriteRule ^/$ /homepage.std.html [L] ================================================ FILE: demo/kitchen-sink/docs/html.html ================================================ <!DOCTYPE html> <html> <head> <style type="text/css"> .text-layer { font-family: Monaco, "Courier New", monospace; font-size: 12px; cursor: text; } </style> </head> <body> <h1 style="color:red">Juhu Kinners</h1> </body> </html> ================================================ FILE: demo/kitchen-sink/docs/html_elixir.eex ================================================ <h1>Listing Books</h1> <table> <tr> <th>Title</th> <th>Summary</th> <th></th> <th></th> <th></th> </tr> <%= for book <- @books do %> <tr> <%# comment %> <td><%= book.title %></td> <td><%= book.content %></td> <td><%= link "Show", to: book_path(@conn, :show, book) %></td> <td><%= link "Edit", to: book_path(@conn, :edit, book) %></td> <td><%= link "Delete", to: book_path(@conn, :delete, book), method: :delete, data: [confirm: "Are you sure?"] %></td> </tr> <% end %> </table> <br /> <%= link "New book", to: book_path(@conn, :new) %> ================================================ FILE: demo/kitchen-sink/docs/html_ruby.erb ================================================ <h1>Listing Books</h1> <table> <tr> <th>Title</th> <th>Summary</th> <th></th> <th></th> <th></th> </tr> <% @books.each do |book| %> <tr> <%# comment %> <td><%= book.title %></td> <td><%= book.content %></td> <td><%= link_to 'Show', book %></td> <td><%= link_to 'Edit', edit_book_path(book) %></td> <td><%= link_to 'Remove', book, :confirm => 'Are you sure?', :method => :delete %></td> </tr> <% end %> </table> <br /> <%= link_to 'New book', new_book_path %> ================================================ FILE: demo/kitchen-sink/docs/ini.ini ================================================ [.ShellClassInfo] IconResource=..\logo.png [ViewState] FolderType=Generic ================================================ FILE: demo/kitchen-sink/docs/io.io ================================================ // computes factorial of a number factorial := method(n, if(n == 0, return 1) res := 1 Range 1 to(n) foreach(i, res = res * i) ) ================================================ FILE: demo/kitchen-sink/docs/jade.jade ================================================ !!!doctype !!!5 !!! include something include another_thing // let's talk about it // here it is. a block comment! and another row! but not here. // a far spaced should be lack of block // also not a comment div.attemptAtBlock span#myName #{implicit} !{more_explicit} #idDiv .idDiv test(id="tag") header(id="tag", blah="foo", meh="aads") mixin article(obj, parents) mixin bleh() mixin clever-name -var x = "0"; - y each z - var items = ["one", "two", "three"] each item in items li= item ================================================ FILE: demo/kitchen-sink/docs/java.java ================================================ public class InfiniteLoop { /* * This will cause the program to hang... * * Taken from: * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/ */ public static void main(String[] args) { double d = Double.parseDouble("2.2250738585072012e-308"); // unreachable code System.out.println("Value: " + d); } } ================================================ FILE: demo/kitchen-sink/docs/javascript.js ================================================ function foo(items, nada) { for (var i=0; i<items.length; i++) { alert(items[i] + "juhu\n"); } // Real Tab. } ================================================ FILE: demo/kitchen-sink/docs/json.json ================================================ { "query": { "count": 10, "created": "2011-06-21T08:10:46Z", "lang": "en-US", "results": { "photo": [ { "farm": "6", "id": "5855620975", "isfamily": "0", "isfriend": "0", "ispublic": "1", "owner": "32021554@N04", "secret": "f1f5e8515d", "server": "5110", "title": "7087 bandit cat" }, { "farm": "4", "id": "5856170534", "isfamily": "0", "isfriend": "0", "ispublic": "1", "owner": "32021554@N04", "secret": "ff1efb2a6f", "server": "3217", "title": "6975 rusty cat" }, { "farm": "6", "id": "5856172972", "isfamily": "0", "isfriend": "0", "ispublic": "1", "owner": "51249875@N03", "secret": "6c6887347c", "server": "5192", "title": "watermarked-cats" }, { "farm": "6", "id": "5856168328", "isfamily": "0", "isfriend": "0", "ispublic": "1", "owner": "32021554@N04", "secret": "0c1cfdf64c", "server": "5078", "title": "7020 mandy cat" }, { "farm": "3", "id": "5856171774", "isfamily": "0", "isfriend": "0", "ispublic": "1", "owner": "32021554@N04", "secret": "7f5a3180ab", "server": "2696", "title": "7448 bobby cat" } ] } } } ================================================ FILE: demo/kitchen-sink/docs/jsoniq.jq ================================================ TODO ================================================ FILE: demo/kitchen-sink/docs/jsp.jsp ================================================ <html> <body> <script> var x = "abc"; function y { } </script> <style> .class { background: #124356; } </style> <p> Today's date: <%= (new java.util.Date()).toLocaleString()%> </p> <%! int i = 0; %> <jsp:declaration> int j = 10; </jsp:declaration> <%-- This is JSP comment --%> <%@ directive attribute="value" %> <h2>Select Languages:</h2> <form ACTION="jspCheckBox.jsp"> <input type="checkbox" name="id" value="Java"> Java<BR> <input type="checkbox" name="id" value=".NET"> .NET<BR> <input type="checkbox" name="id" value="PHP"> PHP<BR> <input type="checkbox" name="id" value="C/C++"> C/C++<BR> <input type="checkbox" name="id" value="PERL"> PERL <BR> <input type="submit" value="Submit"> </form> <% String select[] = request.getParameterValues("id"); if (select != null && select.length != 0) { out.println("You have selected: "); for (int i = 0; i < select.length; i++) { out.println(select[i]); } } %> </body> </html> ================================================ FILE: demo/kitchen-sink/docs/jssm.jssm ================================================ machine_name : "Three-state traffic light, plus off and flash-red"; machine_version : 1.2.1; jssm_version : >= 5.0.0; graph_layout : dot; on_init : ${setup}; on_halt : ${finalize}; /* turn on */ Off 'Enable' { follow: ${turned_on}; } -> Red; // main sequence Red 'Proceed' => Green 'Proceed' => Yellow 'Proceed' => Red; // emergency flash red [Red Yellow Green] 'Flash' -> Flash; Flash 'Proceed' { label: 'no change'; } -> Flash 'Exit' -> Red; // turn off [Red Yellow Green Flash] 'Disable' { follow: ${turned_off}; } ~> Off; ================================================ FILE: demo/kitchen-sink/docs/jsx.jsx ================================================ /*EXPECTED hello world! */ class Test { static function run() : void { // console.log("hello world!"); log "hello world!"; } } ================================================ FILE: demo/kitchen-sink/docs/julia.jl ================================================ for op = (:+, :*, :&, :|, :$) @eval ($op)(a,b,c) = ($op)(($op)(a,b),c) end v = α'; function g(x,y) return x * y x + y end cd("data") do open("outfile", "w") do f write(f, data) end end ================================================ FILE: demo/kitchen-sink/docs/kotlin.kt ================================================ /*Taken from http://try.kotlinlang.org/#/Examples/Longer%20examples/Life/Life.kt*/ /** * This is a straightforward implementation of The Game of Life * See http://en.wikipedia.org/wiki/Conway's_Game_of_Life */ package life /* * A field where cells live. Effectively immutable */ class Field( val width: Int, val height: Int, // This function tells the constructor which cells are alive // if init(i, j) is true, the cell (i, j) is alive init: (Int, Int) -> Boolean ) { private val live: Array<Array<Boolean>> = Array(height) { i -> Array(width) { j -> init(i, j) } } private fun liveCount(i: Int, j: Int) = if (i in 0..height - 1 && j in 0..width - 1 && live[i][j]) 1 else 0 // How many neighbors of (i, j) are alive? fun liveNeighbors(i: Int, j: Int) = liveCount(i - 1, j - 1) + liveCount(i - 1, j) + liveCount(i - 1, j + 1) + liveCount(i, j - 1) + liveCount(i, j + 1) + liveCount(i + 1, j - 1) + liveCount(i + 1, j) + liveCount(i + 1, j + 1) // You can say field[i, j], and this function gets called operator fun get(i: Int, j: Int) = live[i][j] } /** * This function takes the present state of the field * and returns a new field representing the next moment of time */ fun next(field: Field): Field { return Field(field.width, field.height) { i, j -> val n = field.liveNeighbors(i, j) if (field[i, j]) // (i, j) is alive n in 2..3 // It remains alive iff it has 2 or 3 neighbors else // (i, j) is dead n == 3 // A new cell is born if there are 3 neighbors alive } } /** A few colony examples here */ fun main(args: Array<String>) { // Simplistic demo runGameOfLife("***", 3) // "Star burst" runGameOfLife(""" _______ ___*___ __***__ ___*___ _______ """, 10) // Stable colony runGameOfLife(""" _____ __*__ _*_*_ __*__ _____ """, 3) // Stable from the step 2 runGameOfLife(""" __**__ __**__ __**__ """, 3) // Oscillating colony runGameOfLife(""" __**____ __**____ ____**__ ____**__ """, 6) // A fancier oscillating colony runGameOfLife(""" ------------------- -------***---***--- ------------------- -----*----*-*----*- -----*----*-*----*- -----*----*-*----*- -------***---***--- ------------------- -------***---***--- -----*----*-*----*- -----*----*-*----*- -----*----*-*----*- ------------------- -------***---***--- ------------------- """, 10) } // UTILITIES fun runGameOfLife(fieldText: String, steps: Int) { var field = makeField(fieldText) for (step in 1..steps) { println("Step: $step") for (i in 0..field.height - 1) { for (j in 0..field.width - 1) { print(if (field[i, j]) "*" else " ") } println("") } field = next(field) } } fun makeField(s: String): Field { val lines = s.replace(" ", "").split('\n').filter({ it.isNotEmpty() }) val longestLine = lines.toList().maxBy { it.length } ?: "" return Field(longestLine.length, lines.size) { i, j -> lines[i][j] == '*' } } ================================================ FILE: demo/kitchen-sink/docs/latex.tex ================================================ \usepackage{amsmath} \title{\LaTeX} \date{} \begin{document} \maketitle \LaTeX{} is a document preparation system for the \TeX{} typesetting program. It offers programmable desktop publishing features and extensive facilities for automating most aspects of typesetting and desktop publishing, including numbering and cross-referencing, tables and figures, page layout, bibliographies, and much more. \LaTeX{} was originally written in 1984 by Leslie Lamport and has become the dominant method for using \TeX; few people write in plain \TeX{} anymore. The current version is \LaTeXe. % This is a comment; it will not be shown in the final output. % The following shows a little of the typesetting power of LaTeX: \begin{align} E &= mc^2 \\ m &= \frac{m_0}{\sqrt{1-\frac{v^2}{c^2}}} \end{align} \end{document} ================================================ FILE: demo/kitchen-sink/docs/less.less ================================================ /* styles.less */ @base: #f938ab; .box-shadow(@style, @c) when (iscolor(@c)) { box-shadow: @style @c; -webkit-box-shadow: @style @c; -moz-box-shadow: @style @c; } .box-shadow(@style, @alpha: 50%) when (isnumber(@alpha)) { .box-shadow(@style, rgba(0, 0, 0, @alpha)); } // Box styles .box { color: saturate(@base, 5%); border-color: lighten(@base, 30%); div { .box-shadow(0 0 5px, 30%) } a { color: @base; &:hover { color: lighten(@base, 50%); } } } ================================================ FILE: demo/kitchen-sink/docs/liquid.liquid ================================================ The following examples can be found in full at http://liquidmarkup.org/ Liquid is an extraction from the e-commerce system Shopify. Shopify powers many thousands of e-commerce stores which all call for unique designs. For this we developed Liquid which allows our customers complete design freedom while maintaining the integrity of our servers. Liquid has been in production use since June 2006 and is now used by many other hosted web applications. It was developed for usage in Ruby on Rails web applications and integrates seamlessly as a plugin but it also works excellently as a stand alone library. Here's what it looks like: <ul id="products"> {% for product in products %} <li> <h2>{{ product.title }}</h2> Only {{ product.price | format_as_money }} <p>{{ product.description | prettyprint | truncate: 200 }}</p> </li> {% endfor %} </ul> Some more features include: <h2>Filters</h2> <p> The word "tobi" in uppercase: {{ 'tobi' | upcase }} </p> <p>The word "tobi" has {{ 'tobi' | size }} letters! </p> <p>Change "Hello world" to "Hi world": {{ 'Hello world' | replace: 'Hello', 'Hi' }} </p> <p>The date today is {{ 'now' | date: "%Y %b %d" }} </p> <h2>If</h2> <p> {% if user.name == 'tobi' or user.name == 'marc' %} hi marc or tobi {% endif %} </p> <h2>Case</h2> <p> {% case template %} {% when 'index' %} Welcome {% when 'product' %} {{ product.vendor | link_to_vendor }} / {{ product.title }} {% else %} {{ page_title }} {% endcase %} </p> <h2>For Loops</h2> <p> {% for item in array %} {{ item }} {% endfor %} </p> <h2>Tables</h2> <p> {% tablerow item in items cols: 3 %} {% if tablerowloop.col_first %} First column: {{ item.variable }} {% else %} Different column: {{ item.variable }} {% endif %} {% endtablerow %} </p> ================================================ FILE: demo/kitchen-sink/docs/lisp.lisp ================================================ (defun prompt-for-cd () "Prompts for CD" (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6)) (prompt-read "Artist" &rest) (or (parse-integer (prompt-read "Rating") :junk-allowed t) 0) (if x (format t "yes") (format t "no" nil) ;and here comment ) 0xFFLL -23ull ;; second line comment '(+ 1 2) (defvar *lines*) ; list of all lines (position-if-not #'sys::whitespacep line :start beg)) (quote (privet 1 2 3)) '(hello world) (* 5 7) (1 2 34 5) (:use "aaaa") (let ((x 10) (y 20)) (print (+ x y)) ) LAmbDa "asdad\0eqweqe" ================================================ FILE: demo/kitchen-sink/docs/livescript.ls ================================================ # Defines an editing mode for [Ace](http://ace.ajax.org). # # Open [test/ace.html](../test/ace.html) to test. require, exports, module <-! define \ace/mode/ls identifier = /(?![\d\s])[$\w\xAA-\uFFDC](?:(?!\s)[$\w\xAA-\uFFDC]|-[A-Za-z])*/$ exports.Mode = class LiveScriptMode extends require(\ace/mode/text)Mode -> @$tokenizer = new (require \ace/tokenizer)Tokenizer LiveScriptMode.Rules if require \ace/mode/matching_brace_outdent @$outdent = new that.MatchingBraceOutdent indenter = // (? : [({[=:] | [-~]> | \b (?: e(?:lse|xport) | d(?:o|efault) | t(?:ry|hen) | finally | import (?:\s* all)? | const | var | let | new | catch (?:\s* #identifier)? ) ) \s* $ // getNextLineIndent: (state, line, tab) -> indent = @$getIndent line {tokens} = @$tokenizer.getLineTokens line, state unless tokens.length and tokens[*-1]type is \comment indent += tab if state is \start and indenter.test line indent toggleCommentLines: (state, doc, startRow, endRow) -> comment = /^(\s*)#/; range = new (require \ace/range)Range 0 0 0 0 for i from startRow to endRow if out = comment.test line = doc.getLine i then line.=replace comment, \$1 else line.=replace /^\s*/ \$&# range.end.row = range.start.row = i range.end.column = line.length + 1 doc.replace range, line 1 - out * 2 checkOutdent: (state, line, input) -> @$outdent?checkOutdent line, input autoOutdent: (state, doc, row) -> @$outdent?autoOutdent doc, row ### Highlight Rules keywordend = /(?![$\w]|-[A-Za-z]|\s*:(?![:=]))/$ stringfill = token: \string, regex: '.+' LiveScriptMode.Rules = start: * token: \keyword regex: //(? :t(?:h(?:is|row|en)|ry|ypeof!?) |c(?:on(?:tinue|st)|a(?:se|tch)|lass) |i(?:n(?:stanceof)?|mp(?:ort(?:\s+all)?|lements)|[fs]) |d(?:e(?:fault|lete|bugger)|o) |f(?:or(?:\s+own)?|inally|unction) |s(?:uper|witch) |e(?:lse|x(?:tends|port)|val) |a(?:nd|rguments) |n(?:ew|ot) |un(?:less|til) |w(?:hile|ith) |o[fr]|return|break|let|var|loop )//$ + keywordend * token: \constant.language regex: '(?:true|false|yes|no|on|off|null|void|undefined)' + keywordend * token: \invalid.illegal regex: '(? :p(?:ackage|r(?:ivate|otected)|ublic) |i(?:mplements|nterface) |enum|static|yield )' + keywordend * token: \language.support.class regex: '(? :R(?:e(?:gExp|ferenceError)|angeError) |S(?:tring|yntaxError) |E(?:rror|valError) |Array|Boolean|Date|Function|Number|Object|TypeError|URIError )' + keywordend * token: \language.support.function regex: '(? :is(?:NaN|Finite) |parse(?:Int|Float) |Math|JSON |(?:en|de)codeURI(?:Component)? )' + keywordend * token: \variable.language regex: '(?:t(?:hat|il|o)|f(?:rom|allthrough)|it|by|e)' + keywordend * token: \identifier regex: identifier + /\s*:(?![:=])/$ * token: \variable regex: identifier * token: \keyword.operator regex: /(?:\.{3}|\s+\?)/$ * token: \keyword.variable regex: /(?:@+|::|\.\.)/$ next : \key * token: \keyword.operator regex: /\.\s*/$ next : \key * token: \string regex: /\\\S[^\s,;)}\]]*/$ * token: \string.doc regex: \''' next : \qdoc * token: \string.doc regex: \""" next : \qqdoc * token: \string regex: \' next : \qstring * token: \string regex: \" next : \qqstring * token: \string regex: \` next : \js * token: \string regex: '<\\[' next : \words * token: \string.regex regex: \// next : \heregex * token: \comment.doc regex: '/\\*' next : \comment * token: \comment regex: '#.*' * token: \string.regex regex: // /(?: [^ [ / \n \\ ]* (?: (?: \\. | \[ [^\]\n\\]* (?:\\.[^\]\n\\]*)* \] ) [^ [ / \n \\ ]* )* )/ [gimy$]{0,4} //$ next : \key * token: \constant.numeric regex: '(?:0x[\\da-fA-F][\\da-fA-F_]* |(?:[2-9]|[12]\\d|3[0-6])r[\\da-zA-Z][\\da-zA-Z_]* |(?:\\d[\\d_]*(?:\\.\\d[\\d_]*)?|\\.\\d[\\d_]*) (?:e[+-]?\\d[\\d_]*)?[\\w$]*)' * token: \lparen regex: '[({[]' * token: \rparen regex: '[)}\\]]' next : \key * token: \keyword.operator regex: \\\S+ * token: \text regex: \\\s+ heregex: * token: \string.regex regex: '.*?//[gimy$?]{0,4}' next : \start * token: \string.regex regex: '\\s*#{' * token: \comment.regex regex: '\\s+(?:#.*)?' * token: \string.regex regex: '\\S+' key: * token: \keyword.operator regex: '[.?@!]+' * token: \identifier regex: identifier next : \start * token: \text regex: '.' next : \start comment: * token: \comment.doc regex: '.*?\\*/' next : \start * token: \comment.doc regex: '.+' qdoc: token: \string regex: ".*?'''" next : \key stringfill qqdoc: token: \string regex: '.*?"""' next : \key stringfill qstring: token: \string regex: /[^\\']*(?:\\.[^\\']*)*'/$ next : \key stringfill qqstring: token: \string regex: /[^\\"]*(?:\\.[^\\"]*)*"/$ next : \key stringfill js: token: \string regex: /[^\\`]*(?:\\.[^\\`]*)*`/$ next : \key stringfill words: token: \string regex: '.*?\\]>' next : \key stringfill ================================================ FILE: demo/kitchen-sink/docs/logiql.logic ================================================ // ancestors parentof("douglas", "john"). parentof("john", "bob"). parentof("bob", "ebbon"). parentof("douglas", "jane"). parentof("jane", "jan"). ancestorof(A, B) <- parentof(A, B). ancestorof(A, C) <- ancestorof(A, B), parentof(B,C). grandparentof(A, B) <- parentof(A, C), parentof(C, B). cousins(A,B) <- grandparentof(C,A), grandparentof(C,B). parentof[`arg](A, B) -> int[32](A), !string(B). ================================================ FILE: demo/kitchen-sink/docs/lsl.lsl ================================================ /* Testing syntax highlighting of Ace Editor for the Linden Scripting Language */ integer someIntNormal = 3672; integer someIntHex = 0x00000000; integer someIntMath = PI_BY_TWO; integer event = 5673; // invalid.illegal key someKeyTexture = TEXTURE_DEFAULT; string someStringSpecial = EOF; some_user_defined_function_without_return_type(string inputAsString) { llSay(PUBLIC_CHANNEL, inputAsString); } string user_defined_function_returning_a_string(key inputAsKey) { return (string)inputAsKey; } default { state_entry() { key someKey = NULL_KEY; someKey = llGetOwner(); string someString = user_defined_function_returning_a_string(someKey); some_user_defined_function_without_return_type(someString); } touch_start(integer num_detected) { list agentsInRegion = llGetAgentList(AGENT_LIST_REGION, []); integer numOfAgents = llGetListLength(agentsInRegion); integer index; // defaults to 0 for (; index <= numOfAgents - 1; index++) // for each agent in region { llRegionSayTo(llList2Key(agentsInRegion, index), PUBLIC_CHANNEL, "Hello, Avatar!"); } } touch_end(integer num_detected) { someIntNormal = 3672; someIntHex = 0x00000000; someIntMath = PI_BY_TWO; event = 5673; // invalid.illegal someKeyTexture = TEXTURE_DEFAULT; someStringSpecial = EOF; llSetInventoryPermMask("some item", MASK_NEXT, PERM_ALL); // reserved.godmode llWhisper(PUBLIC_CHANNEL, "Leaving \"default\" now..."); state other; } } state other { state_entry() { llWhisper(PUBLIC_CHANNEL, "Entered \"state other\", returning to \"default\" again..."); state default; } } ================================================ FILE: demo/kitchen-sink/docs/lua.lua ================================================ --[[-- num_args takes in 5.1 byte code and extracts the number of arguments from its function header. --]]-- function int(t) return t:byte(1)+t:byte(2)*0x100+t:byte(3)*0x10000+t:byte(4)*0x1000000 end function num_args(func) local dump = string.dump(func) local offset, cursor = int(dump:sub(13)), offset + 26 --Get the params and var flag (whether there's a ... in the param) return dump:sub(cursor):byte(), dump:sub(cursor+1):byte() end -- Usage: num_args(function(a,b,c,d, ...) end) -- return 4, 7 -- Python styled string format operator local gm = debug.getmetatable("") gm.__mod=function(self, other) if type(other) ~= "table" then other = {other} end for i,v in ipairs(other) do other[i] = tostring(v) end return self:format(unpack(other)) end print([===[ blah blah %s, (%d %d) ]===]%{"blah", num_args(int)}) --[=[-- table.maxn is deprecated, use # instead. --]=]-- print(table.maxn{1,2,[4]=4,[8]=8) -- outputs 8 instead of 2 print(5 --[[ blah ]]) ================================================ FILE: demo/kitchen-sink/docs/luapage.lp ================================================ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html> <% --[[-- index.lp from the Kepler Project's LuaDoc HTML doclet. http://keplerproject.github.com/luadoc/ --]] %> <head> <title>Reference " type="text/css" />
<%if not options.nomodules and #doc.modules > 0 then%>

Modules

<%for _, modulename in ipairs(doc.modules) do%> <%end%>
<%=modulename%> <%=doc.modules[modulename].summary%>
<%end%> <%if not options.nofiles and #doc.files > 0 then%>

Files

<%for _, filepath in ipairs(doc.files) do%> <%end%>
<%=filepath%>
<%end%>

Valid XHTML 1.0!

================================================ FILE: demo/kitchen-sink/docs/lucene.lucene ================================================ (title:"foo bar" AND body:"quick fox") OR title:fox ================================================ FILE: demo/kitchen-sink/docs/markdown.md ================================================ Ace (Ajax.org Cloud9 Editor) ============================ Ace is a standalone code editor written in JavaScript. Our goal is to create a browser based editor that matches and extends the features, usability and performance of existing native editors such as TextMate, Vim or Eclipse. It can be easily embedded in any web page or JavaScript application. Ace is developed as the primary editor for [Cloud9 IDE](http://www.cloud9ide.com/) and the successor of the Mozilla Skywriter (Bespin) Project. Features -------- * Syntax highlighting * Automatic indent and outdent * An optional command line * Handles huge documents (100,000 lines and more are no problem) * Fully customizable key bindings including VI and Emacs modes * Themes (TextMate themes can be imported) * Search and replace with regular expressions * Highlight matching parentheses * Toggle between soft tabs and real tabs * Displays hidden characters * Drag and drop text using the mouse * Line wrapping * Unstructured / user code folding * Live syntax checker (currently JavaScript/CoffeeScript) Take Ace for a spin! -------------------- Check out the Ace live [demo](http://ajaxorg.github.com/ace/) or get a [Cloud9 IDE account](http://run.cloud9ide.com) to experience Ace while editing one of your own GitHub projects. If you want, you can use Ace as a textarea replacement thanks to the [Ace Bookmarklet](http://ajaxorg.github.com/ace/build/textarea/editor.html). History ------- Previously known as “Bespin” and “Skywriter” it’s now known as Ace (Ajax.org Cloud9 Editor)! Bespin and Ace started as two independent projects, both aiming to build a no-compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the canvas tag, while Ace is the Editor component of the Cloud9 IDE and is using the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace. Both Ajax.org and Mozilla are actively developing and maintaining Ace. Getting the code ---------------- Ace is a community project. We actively encourage and support contributions. The Ace source code is hosted on GitHub. It is released under the BSD License. This license is very simple, and is friendly to all kinds of projects, whether open source or not. Take charge of your editor and add your favorite language highlighting and keybindings! ```bash git clone git://github.com/ajaxorg/ace.git cd ace git submodule update --init --recursive ``` Embedding Ace ------------- Ace can be easily embedded into any existing web page. The Ace git repository ships with a pre-packaged version of Ace inside of the `build` directory. The same packaged files are also available as a separate [download](https://github.com/ajaxorg/ace/downloads). Simply copy the contents of the `src` subdirectory somewhere into your project and take a look at the included demos of how to use Ace. The easiest version is simply: ```html
some text
``` With "editor" being the id of the DOM element, which should be converted to an editor. Note that this element must be explicitly sized and positioned `absolute` or `relative` for Ace to work. e.g. ```css #editor { position: absolute; width: 500px; height: 400px; } ``` To change the theme simply include the Theme's JavaScript file ```html ``` and configure the editor to use the theme: ```javascript editor.setTheme("ace/theme/twilight"); ``` By default the editor only supports plain text mode; many other languages are available as separate modules. After including the mode's JavaScript file: ```html ``` Then the mode can be used like this: ```javascript var JavaScriptMode = require("ace/mode/javascript").Mode; editor.getSession().setMode(new JavaScriptMode()); ``` Documentation ------------- You find a lot more sample code in the [demo app](https://github.com/ajaxorg/ace/blob/master/demo/demo.js). There is also some documentation on the [wiki page](https://github.com/ajaxorg/ace/wiki). If you still need help, feel free to drop a mail on the [ace mailing list](http://groups.google.com/group/ace-discuss). Running Ace ----------- After the checkout Ace works out of the box. No build step is required. Open 'editor.html' in any browser except Google Chrome. Google Chrome doesn't allow XMLHTTPRequests from files loaded from disc (i.e. with a file:/// URL). To open Ace in Chrome simply start the bundled mini HTTP server: ```bash ./static.py ``` Or using Node.JS ```bash ./static.js ``` The editor can then be opened at http://localhost:8888/index.html. Package Ace ----------- To package Ace we use the dryice build tool developed by the Mozilla Skywriter team. Before you can build you need to make sure that the submodules are up to date. ```bash git submodule update --init --recursive ``` Afterwards Ace can be built by calling ```bash ./Makefile.dryice.js normal ``` The packaged Ace will be put in the 'build' folder. To build the bookmarklet version execute ```bash ./Makefile.dryice.js bm ``` Running the Unit Tests ---------------------- The Ace unit tests run on node.js. Before the first run a couple of node modules have to be installed. The easiest way to do this is by using the node package manager (npm). In the Ace base directory simply call ```bash npm link . ``` To run the tests call: ```bash node lib/ace/test/all.js ``` You can also run the tests in your browser by serving: http://localhost:8888/lib/ace/test/tests.html This makes debugging failing tests way more easier. Contributing ------------ Ace wouldn't be what it is without contributions! Feel free to fork and improve/enhance Ace any way you want. If you feel that the editor or the Ace community will benefit from your changes, please open a pull request. To protect the interests of the Ace contributors and users we require contributors to sign a Contributors License Agreement (CLA) before we pull the changes into the main repository. Our CLA is the simplest of agreements, requiring that the contributions you make to an ajax.org project are only those you're allowed to make. This helps us significantly reduce future legal risk for everyone involved. It is easy, helps everyone, takes ten minutes, and only needs to be completed once. There are two versions of the agreement: 1. [The Individual CLA](https://github.com/ajaxorg/ace/raw/master/doc/Contributor_License_Agreement-v2.pdf): use this version if you're working on an ajax.org in your spare time, or can clearly claim ownership of copyright in what you'll be submitting. 2. [The Corporate CLA](https://github.com/ajaxorg/ace/raw/master/doc/Corporate_Contributor_License_Agreement-v2.pdf): have your corporate lawyer review and submit this if your company is going to be contributing to ajax.org projects If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax to us or send it back scanned (or as a photo) by email. Email: fabian.jakobs@web.de Fax: +31 (0) 206388953 Address: Ajax.org B.V. Keizersgracht 241 1016 EA, Amsterdam the Netherlands ================================================ FILE: demo/kitchen-sink/docs/mask.mask ================================================ /* Mask Syntax Demo */ div > ' Test ~[name]'; define :userProfile { header { h4 > @title; button.close; } } :userProfile { @title > ' Hello ~[: username.toUpperCase()]' } style { html, body { background: url('name.png') 0 0 no-repeat; } } button { event click (e) { this.textContent = `name ${e.clientX} !`; } } md > """ - div - span Hello [one](http://google.com) """; header .foo > 'Heading' button .baz x-signal='click: test' disabled > " Hello, world \"Buddy\" " var a = { name: `name ${window.innerWidth}` }; span .foo > "~[bind: a.name]" ================================================ FILE: demo/kitchen-sink/docs/matlab.matlab ================================================ %{ %{ Ace Matlab demo %} %} classdef hello methods function greet(this) disp('Hello!') % say hi end end end % transpose a = [ 'x''y', "x\n\ y", 1' ]' + 2' ================================================ FILE: demo/kitchen-sink/docs/maze.mz ================================================ ## ## () ## ^^ ## ## ## ## ## H1 C2 S1 <> S2 H2 DN ## ## %U <> %D *2 %L IZ .. ## ## ## ## .. ## DN *3 ## ## ## ## ## %R C1 IZ () ## ## ## ## ## ## >/ *1 ## () *3 *1 %L () // Set divisor and dividend S1-> = 9 S2-> = 24 // Holding cells H1-> IF *1 THEN %R ELSE %N H2-> IF *2 THEN %R ELSE %N // Arithmetic DN-> -= 1 IZ-> IF <= 0 THEN %D ELSE %U C1-> IF *3 THEN %D ELSE %R C2-> IF *3 THEN %U ELSE %D ================================================ FILE: demo/kitchen-sink/docs/mel.mel ================================================ // animated duplicates, instances script proc animatedDuplication (int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance) { int $range_start = $rangeStart; int $range_end = $rangeEnd; int $num_of_duplicates = $numOfDuplicates; int $step_size = ($range_end - $range_start) / $num_of_duplicates; int $i = 0; int $temp; currentTime $range_start; // set to range start string $selectedObjects[]; // to store selected objects $selectedObjects = `ls -sl`; // store selected objects select $selectedObjects; while ($i <= $num_of_duplicates) { $temp = $range_start + ($step_size * $i); currentTime ($temp); // seleced the objects to duplicate or instance select $selectedObjects; if($duplicateOrInstance == 0) { duplicate; } else { instance; } $i++; } } ================================================ FILE: demo/kitchen-sink/docs/mixal.mixal ================================================ * PROGRAM START ΔSTART LDA 2000 LOAD A FROM CELL 2000 CMP7 =15= 12345 HLT END START ABC ALF abc ================================================ FILE: demo/kitchen-sink/docs/mushcode.mc ================================================ @create phone &pickup phone=$pick up:@ifelse [u(is,u(mode),ICC)]={@pemit %#=You pick up the [fullname(me)].[set(me,PHONER:%#)][set(me,MODE:CIP)][set([u(INCOMING)],CONNECTED:[num(me)])][set(me,CONNECTED:[u(INCOMING)])]%r[showpicture(PICPICKUP)]%rUse '[color(green,black,psay )]' (or '[color(green,black,p )]') to talk into the phone.;@oemit %#=%N picks up the [fullname(me)].},{@pemit %#=You pick up the phone but no one is there. You hear a dialtone and then hang up. [play(u(DIALTONE))];@oemit %#=%N picks up the phone, but no one is on the other end.} &ringfun phone=[ifelse(eq(comp([u(%0/ringtone)],off),0),[color(black,cyan,INCOMING CALL FROM %1)],[play([switch([u(%0/ringtone)],1,[u(%0/ringtone1)],2,[u(%0/ringtone2)],3,[u(%0/ringtone3)],4,[u(%0/ringtone4)],5,[u(%0/ringtone5)],6,[u(%0/ringtone6)],7,[u(%0/ringtone7)],8,[u(%0/ringtone8)],9,[u(%0/ringtone9)],custom,[u(%0/customtone)],vibrate,[u(%0/vibrate)])])] &ringloop phone=@switch [u(ringstate)]=1,{@emit [setq(q,[u(connecting)])][set(%qq,rangs:0)][set(%qq,mode:WFC)][set(%qq,INCOMING:)];@ifelse [u(%qq/HASVMB)]={@tr me/ROUTEVMB=[u(connecting)];},{@pemit %#=[u(MSGCNC)];}},2,{@pemit %#=The call is connected.[setq(q,[u(CONNECTING)])][set(me,CONNECTED:%qq)][set(%qq,CONNECTED:[num(me)])][set(%qq,MODE:CIP)];@tr me/ciploop;@tr %qq/ciploop;},3,{@emit On [fullname(me)]'s earpiece you hear a ringing sound.[play(u(LINETONE))];@tr me/ringhere;@increment [u(connecting)]/RANGS;@wait 5={@tr me/ringloop};},4,{} &ringstate phone=[setq(q,u(connecting))][setq(1,[gt(u(%qq/rangs),sub(u(%qq/rings),1))])][setq(2,[and(u(is,u(%qq/MODE),CIP),u(is,u(%qq/INCOMING),[num(me)]))][setq(3,[u(is,u(%qq/MODE),ICC)])][ifelse(%q1,1,ifelse(%q2,2,ifelse(%q3,3,4)))] ;comment @@(comment) say [time()] ================================================ FILE: demo/kitchen-sink/docs/mysql.mysql ================================================ TODO ================================================ FILE: demo/kitchen-sink/docs/nsis.nsi ================================================ /* NSIS Mode for Ace */ ; Includes !include MUI2.nsh ; Settings Name "installer_name" OutFile "installer_name.exe" RequestExecutionLevel user CRCCheck on !ifdef x64 InstallDir "$PROGRAMFILES64\installer_name" !else InstallDir "$PROGRAMFILES\installer_name" !endif ; Pages !insertmacro MUI_PAGE_INSTFILES ; Sections Section "section_name" section_index # your code here SectionEnd ; Functions Function .onInit MessageBox MB_OK "Here comes a$\n$\rline-break!" FunctionEnd ================================================ FILE: demo/kitchen-sink/docs/objectivec.m ================================================ @protocol Printing: someParent -(void) print; @end @interface Fraction: NSObject { int numerator; int denominator; } @end @"blah\8" @"a\222sd\d" @"\faw\"\? \' \4 n\\" @"\56" @"\xSF42" -(NSDecimalNumber*)addCount:(id)addObject{ return [count decimalNumberByAdding:addObject.count]; } NS_DURING NS_HANDLER NS_ENDHANDLER @try { if (argc > 1) { @throw [NSException exceptionWithName:@"Throwing a test exception" reason:@"Testing the @throw directive." userInfo:nil]; } } @catch (id theException) { NSLog(@"%@", theException); result = 1 ; } @finally { NSLog(@"This always happens."); result += 2 ; } @synchronized(lock) { NSLog(@"Hello World"); } struct { @defs( NSObject) } char *enc1 = @encode(int); IBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class @class @protocol @public // instance variables @package // instance variables @protected // instance variables @private // instance variables YES NO Nil nil NSApp() NSRectToCGRect (Protocol ProtocolFromString:"NSTableViewDelegate")) [SPPoint pointFromCGPoint:self.position] NSRoundDownToMultipleOfPageSize #import int main( int argc, const char *argv[] ) { printf( "hello world\n" ); return 0; } NSChangeSpelling @"0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count" @selector(lowercaseString) @selector(uppercaseString:) NSFetchRequest *localRequest = [[NSFetchRequest alloc] init]; localRequest.entity = [NSEntityDescription entityForName:@"VNSource" inManagedObjectContext:context]; localRequest.sortDescriptors = [NSArray arrayWithObject:[NSSortDescriptor sortDescriptorWithKey:@"resolution" ascending:YES]]; NSPredicate *predicate = [NSPredicate predicateWithFormat:@"0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"]; [NSPredicate predicateWithFormat:] NSString *predicateString = [NSString stringWithFormat:@"SELF beginsWith[cd] %@", searchString]; NSPredicate *pred = [NSPredicate predicateWithFormat:predicateString]; NSArray *filteredKeys = [[myMutableDictionary allKeys] filteredArrayUsingPredicate:pred]; localRequest.predicate = [NSPredicate predicateWithFormat:@"whichChart = %@" argumentArray: listChartToDownload]; localRequest.fetchBatchSize = 100; arrayRequest = [context executeFetchRequest:localRequest error:&error1]; [localRequest release]; #ifndef Nil #define Nil __DARWIN_NULL /* id of Nil class */ #endif @implementation MyObject - (unsigned int)areaOfWidth:(unsigned int)width height:(unsigned int)height { return width*height; } @end ================================================ FILE: demo/kitchen-sink/docs/ocaml.ml ================================================ (* * Example of early return implementation taken from * http://ocaml.janestreet.com/?q=node/91 *) let with_return (type t) (f : _ -> t) = let module M = struct exception Return of t end in let return = { return = (fun x -> raise (M.Return x)); } in try f return with M.Return x -> x (* Function that uses the 'early return' functionality provided by `with_return` *) let sum_until_first_negative list = with_return (fun r -> List.fold list ~init:0 ~f:(fun acc x -> if x >= 0 then acc + x else r.return acc)) ================================================ FILE: demo/kitchen-sink/docs/pascal.pas ================================================ (***************************************************************************** * A simple bubble sort program. Reads integers, one per line, and prints * * them out in sorted order. Blows up if there are more than 49. * *****************************************************************************) PROGRAM Sort(input, output); CONST (* Max array size. *) MaxElts = 50; TYPE (* Type of the element array. *) IntArrType = ARRAY [1..MaxElts] OF Integer; VAR (* Indexes, exchange temp, array size. *) i, j, tmp, size: integer; (* Array of ints *) arr: IntArrType; (* Read in the integers. *) PROCEDURE ReadArr(VAR size: Integer; VAR a: IntArrType); BEGIN size := 1; WHILE NOT eof DO BEGIN readln(a[size]); IF NOT eof THEN size := size + 1 END END; BEGIN (* Read *) ReadArr(size, arr); (* Sort using bubble sort. *) FOR i := size - 1 DOWNTO 1 DO FOR j := 1 TO i DO IF arr[j] > arr[j + 1] THEN BEGIN tmp := arr[j]; arr[j] := arr[j + 1]; arr[j + 1] := tmp; END; (* Print. *) FOR i := 1 TO size DO writeln(arr[i]) END. ================================================ FILE: demo/kitchen-sink/docs/perl.pl ================================================ #!/usr/bin/perl =begin perl example code for Ace =cut use v5.10; use strict; use warnings; use List::Util qw(first); my @primes; # Put 2 as the first prime so we won't have an empty array push @primes, 2; for my $number_to_check (3 .. 200) { # Check if the current number is divisible by any previous prime # if it is, skip to the next number. Use first to bail out as soon # as we find a prime that divides it. next if (first {$number_to_check % $_ == 0} @primes); # If we reached this point it means $number_to_check is not # divisable by any prime number that came before it. push @primes, $number_to_check; } # List out all of the primes say join(', ', @primes); ================================================ FILE: demo/kitchen-sink/docs/pgsql.pgsql ================================================ BEGIN; /** * Samples from PostgreSQL src/tutorial/basics.source */ CREATE TABLE weather ( city varchar(80), temp_lo int, -- low temperature temp_hi int, -- high temperature prcp real, -- precipitation "date" date ); CREATE TABLE cities ( name varchar(80), location point ); INSERT INTO weather VALUES ('San Francisco', 46, 50, 0.25, '1994-11-27'); INSERT INTO cities VALUES ('San Francisco', '(-194.0, 53.0)'); INSERT INTO weather (city, temp_lo, temp_hi, prcp, "date") VALUES ('San Francisco', 43, 57, 0.0, '1994-11-29'); INSERT INTO weather (date, city, temp_hi, temp_lo) VALUES ('1994-11-29', 'Hayward', 54, 37); SELECT city, (temp_hi+temp_lo)/2 AS temp_avg, "date" FROM weather; SELECT city, temp_lo, temp_hi, prcp, "date", location FROM weather, cities WHERE city = name; /** * Dollar quotes starting at the end of the line are colored as SQL unless * a special language tag is used. Dollar quote syntax coloring is implemented * for Perl, Python, JavaScript, and Json. */ create or replace function blob_content_chunked( in p_data bytea, in p_chunk integer) returns setof bytea as $$ -- Still SQL comments declare v_size integer = octet_length(p_data); begin for i in 1..v_size by p_chunk loop return next substring(p_data from i for p_chunk); end loop; end; $$ language plpgsql stable; -- pl/perl CREATE FUNCTION perl_max (integer, integer) RETURNS integer AS $perl$ # perl comment... my ($x,$y) = @_; if (! defined $x) { if (! defined $y) { return undef; } return $y; } if (! defined $y) { return $x; } if ($x > $y) { return $x; } return $y; $perl$ LANGUAGE plperl; -- pl/python CREATE FUNCTION usesavedplan() RETURNS trigger AS $python$ # python comment... if SD.has_key("plan"): plan = SD["plan"] else: plan = plpy.prepare("SELECT 1") SD["plan"] = plan $python$ LANGUAGE plpythonu; -- pl/v8 (javascript) CREATE FUNCTION plv8_test(keys text[], vals text[]) RETURNS text AS $javascript$ var o = {}; for(var i=0; i ================================================ FILE: demo/kitchen-sink/docs/pig.pig ================================================ A = load 'mobydick.txt'; B = foreach A generate flatten(TOKENIZE((chararray)$0)) as word; C = filter B by word matches '\\w+'; D = group C by word; E = foreach D generate COUNT(C) as count, group as word; F = order E by count desc; -- one comment /* another comment */ dump F; ================================================ FILE: demo/kitchen-sink/docs/plaintext.txt ================================================ Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur ================================================ FILE: demo/kitchen-sink/docs/powershell.ps1 ================================================ # This is a simple comment function Hello($name) { Write-host "Hello $name" } function add($left, $right=4) { if ($right -ne 4) { return $left } elseif ($left -eq $null -and $right -eq 2) { return 3 } else { return 2 } } $number = 1 + 2; $number += 3 Write-Host Hello -name "World" $an_array = @(1, 2, 3) $a_hash = @{"something" = "something else"} & notepad .\readme.md ================================================ FILE: demo/kitchen-sink/docs/praat.praat ================================================ form Highlighter test sentence My_sentence This should all be a string text My_text This should also all be a string word My_word Only the first word is a string, the rest is invalid boolean Binary 1 boolean Text no boolean Quoted "yes" comment This should be a string real left_Range -123.6 positive right_Range_max 3.3 integer Int 4 natural Nat 4 endform # External scripts include /path/to/file runScript: "/path/to/file" execute /path/to/file stopwatch # old-style procedure call call oldStyle "quoted" 2 unquoted string assert oldStyle.local = 1 # New-style procedure call with parens @newStyle("quoted", 2, "quoted string") if praatVersion >= 5364 # New-style procedure call with colon @newStyle: "quoted", 2, "quoted string" endif # if-block with built-in variables if windows # We are on Windows elsif unix = 1 or !macintosh exitScript: "We are on Linux" else macintosh == 1 exit We are on Mac endif # inline if with inline comment var = if macintosh = 1 then 0 else 1 fi ; This is an inline comment # for-loop with explicit from using local variable # and paren-style function calls and variable interpolation n = numberOfSelected("Sound") for i from newStyle.local to n sound'i' = selected("Sound", i) sound[i] = sound'i' endfor for i from 1 to n # Different styles of object selection select sound'i' sound = selected() sound$ = selected$("Sound") select Sound 'sound$' selectObject(sound[i]) selectObject: sound # Pause commands beginPause("Viewing " + sound$) if i > 1 button = endPause("Stop", "Previous", ...if i = total_sounds then "Finish" else "Next" fi, ...3, 1) else button = endPause("Stop", ...if i = total_sounds then "Finish" else "Next" fi, ...2, 1) endif editor_name$ = if total_textgrids then "TextGrid " else "Sound " fi + name$ nocheck editor 'editor_name$' nocheck Close nocheck endeditor # New-style standalone command call Rename: "SomeName" # Command call with assignment duration = Get total duration # Multi-line command with modifier pitch = noprogress To Pitch (ac): 0, 75, 15, "no", ...0.03, 0.45, 0.01, 0.35, 0.14, 600 # do-style command with assignment minimum = do("Get minimum...", 0, 0, "Hertz", "Parabolic") # New-style multi-line command call with broken strings table = Create Table with column names: "table", 0, ..."file subject speaker ...f0 f1 f2 f3 " + ..."duration response" removeObject: pitch, table # Picture window commands selectObject: sound # do-style command do("Select inner viewport...", 1, 6, 0.5, 1.5) Black Draw... 0 0 0 0 "no" Curve Draw inner box Text bottom: "yes", sound$ Erase all # Demo window commands demo Erase all demo Select inner viewport... 0 100 0 100 demo Axes... 0 100 0 100 demo Paint rectangle... white 0 100 0 100 demo Text... 50 centre 50 half Click to finish demoWaitForInput ( ) demo Erase all demo Text: 50, "centre", 50, "half", "Finished" endfor # An old-style sendpraat block sendpraat Praat ...'newline$' Create Sound as pure tone... "tone" 1 0 0.4 44100 440 0.2 0.01 0.01 ...'newline$' Play ...'newline$' Remove # A new-style sendpraat block beginSendPraat: "Praat" Create Sound as pure tone: "tone", 1, 0, 0.4, 44100, 440, 0.2, 0.01, 0.01 duration = Get total duration Remove endSendPraat: "duration" appendInfoLine: "The generated sound lasted for ", duration, "seconds" time = stopwatch clearinfo echo This script took print 'time' seconds to printline execute. # Old-style procedure declaration procedure oldStyle .str1$ .num .str2$ .local = 1 endproc # New-style procedure declaration procedure newStyle (.str1$, .num, .str2$) .local = 1 endproc ================================================ FILE: demo/kitchen-sink/docs/prolog.plg ================================================ partition([], _, [], []). partition([X|Xs], Pivot, Smalls, Bigs) :- ( X @< Pivot -> Smalls = [X|Rest], partition(Xs, Pivot, Rest, Bigs) ; Bigs = [X|Rest], partition(Xs, Pivot, Smalls, Rest) ). quicksort([]) --> []. quicksort([X|Xs]) --> { partition(Xs, X, Smaller, Bigger) }, quicksort(Smaller), [X], quicksort(Bigger). perfect(N) :- between(1, inf, N), U is N // 2, findall(D, (between(1,U,D), N mod D =:= 0), Ds), sumlist(Ds, N). ================================================ FILE: demo/kitchen-sink/docs/properties.properties ================================================ # You are reading the ".properties" entry. ! The exclamation mark can also mark text as comments. # The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded. website = http\://en.wikipedia.org/ language = English # The backslash below tells the application to continue reading # the value onto the next line. message = Welcome to \ Wikipedia! # Add spaces to the key key\ with\ spaces = This is the value that could be looked up with the key "key with spaces". # Unicode tab : \u0009 empty-key= last.line=value ================================================ FILE: demo/kitchen-sink/docs/protobuf.proto ================================================ message Point { required int32 x = 1; required int32 y = 2; optional string label = 3; } message Line { required Point start = 1; required Point end = 2; optional string label = 3; } message Polyline { repeated Point point = 1; optional string label = 2; } ================================================ FILE: demo/kitchen-sink/docs/python.py ================================================ #!/usr/local/bin/python import string, sys # If no arguments were given, print a helpful message if len(sys.argv)==1: print '''Usage: celsius temp1 temp2 ...''' sys.exit(0) # Loop over the arguments for i in sys.argv[1:]: try: fahrenheit=float(string.atoi(i)) except string.atoi_error: print repr(i), "not a numeric value" else: celsius=(fahrenheit-32)*5.0/9.0 print '%i\260F = %i\260C' % (int(fahrenheit), int(celsius+.5)) ================================================ FILE: demo/kitchen-sink/docs/r.r ================================================ Call: lm(formula = y ~ x) Residuals: 1 2 3 4 5 6 3.3333 -0.6667 -2.6667 -2.6667 -0.6667 3.3333 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) -9.3333 2.8441 -3.282 0.030453 * x 7.0000 0.7303 9.585 0.000662 *** --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 3.055 on 4 degrees of freedom Multiple R-squared: 0.9583, Adjusted R-squared: 0.9478 F-statistic: 91.88 on 1 and 4 DF, p-value: 0.000662 > par(mfrow=c(2, 2)) # Request 2x2 plot layout > plot(lm_1) # Diagnostic plot of regression model ================================================ FILE: demo/kitchen-sink/docs/razor.cshtml ================================================ @* razor mode *@ @{ Layout = "~/layout" @: @Layout @: } ================================================ FILE: demo/kitchen-sink/docs/rdoc.Rd ================================================ \name{picker} \alias{picker} \title{Create a picker control} \description{ Create a picker control to enable manipulation of plot variables based on a set of fixed choices. } \usage{ picker(..., initial = NULL, label = NULL) } \arguments{ \item{\dots}{ Arguments containing objects to be presented as choices for the picker (or a list containing the choices). If an element is named then the name is used to display it within the picker. If an element is not named then it is displayed within the picker using \code{\link{as.character}}. } \item{initial}{ Initial value for picker. Value must be present in the list of choices specified. If not specified defaults to the first choice. } \item{label}{ Display label for picker. Defaults to the variable name if not specified. } } \value{ An object of class "manipulator.picker" which can be passed to the \code{\link{manipulate}} function. } \seealso{ \code{\link{manipulate}}, \code{\link{slider}}, \code{\link{checkbox}}, \code{\link{button}} } \examples{ \dontrun{ ## Filtering data with a picker manipulate( barplot(as.matrix(longley[,factor]), beside = TRUE, main = factor), factor = picker("GNP", "Unemployed", "Employed")) ## Create a picker with labels manipulate( plot(pressure, type = type), type = picker("points" = "p", "line" = "l", "step" = "s")) ## Picker with groups manipulate( barplot(as.matrix(mtcars[group,"mpg"]), beside=TRUE), group = picker("Group 1" = 1:11, "Group 2" = 12:22, "Group 3" = 23:32)) ## Histogram w/ picker to select type require(lattice) require(stats) manipulate( histogram(~ height | voice.part, data = singer, type = type), type = picker("percent", "count", "density")) } } ================================================ FILE: demo/kitchen-sink/docs/red.red ================================================ Red [] info: func ['fn /name /intro /args /refinements /locals /return /spec /arg-num /arg-names /arg-types /ref-names /ref-types /ref-num /type /local intr ars refs locs ret arg ref typ ][ intr: copy "" ars: make map! copy [] refs: make map! copy [] locs: copy [] ret: copy [] typ: ref-arg: ref-arg-type: none if lit-word? fn [fn: to-word fn] unless find [op! native! function! action!] type?/word get fn [ cause-error 'user 'message ["Only function types accepted!"] ] out: make map! copy [] specs: spec-of get fn parse specs [ opt [set intr string!] any [set arg [word! | lit-word!] opt [set typ block!] opt string! (put ars arg either typ [typ][[any-type!]])] any [set ref refinement! [ if (ref <> /local) (put refs to-lit-word ref make map! copy []) opt string! any [set ref-arg word! opt [set ref-arg-type block!] (put refs/(to-word ref) to-lit-word ref-arg either ref-arg-type [ref-arg-type][[any-type!]]) ] | any [set loc word! (append locs loc) opt string!] opt [set-word! set ret block!] ]] ( out: case [ name [to-word fn] intro [intr] args [ars] arg-num [length? ars] arg-names [copy keys-of ars] arg-types [copy values-of ars] refinements [refs] ref-names [copy keys-of refs] ref-types [copy values-of refs] ref-num [length? refs] locals [locs] return [ret] spec [specs] true [ make object! [ name: to-word fn intro: intr args: ars refinements: refs locals: locs return: ret spec: specs type: type? get fn arg-num: length? args arg-names: copy keys-of args arg-types: copy values-of args ref-names: copy keys-of refinements ref-types: copy values-of refinements ref-num: length? refinements ] ] ]) ] out ] ================================================ FILE: demo/kitchen-sink/docs/rhtml.Rhtml ================================================ Title

This is an R HTML document. When you click the Knit HTML button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

You can also embed plots, for example:

================================================ FILE: demo/kitchen-sink/docs/rst.rst ================================================ ========================================== *reStructuredText* Highlighter for **Ace** ========================================== .. seealso:: http://docutils.sourceforge.net/docs/user/rst/quickstart.html ReStructuredText Primer ======================= :Author: Richard Jones :Version: $Revision: 5801 $ :Copyright: This document has been placed in the public domain. .. contents:: The text below contains links that look like "(quickref__)". These are relative links that point to the `Quick reStructuredText`_ user reference. If these links don't work, please refer to the `master quick reference`_ document. __ .. _Quick reStructuredText: quickref.html .. _master quick reference: http://docutils.sourceforge.net/docs/user/rst/quickref.html .. Note:: This document is an informal introduction to reStructuredText. The `What Next?`_ section below has links to further resources, including a formal reference. Structure --------- From the outset, let me say that "Structured Text" is probably a bit of a misnomer. It's more like "Relaxed Text" that uses certain consistent patterns. These patterns are interpreted by a HTML converter to produce "Very Structured Text" that can be used by a web browser. The most basic pattern recognised is a **paragraph** (quickref__). That's a chunk of text that is separated by blank lines (one is enough). Paragraphs must have the same indentation -- that is, line up at their left edge. Paragraphs that start indented will result in indented quote paragraphs. For example:: This is a paragraph. It's quite short. This paragraph will result in an indented block of text, typically used for quoting other text. This is another one. Results in: This is a paragraph. It's quite short. This paragraph will result in an indented block of text, typically used for quoting other text. This is another one. __ quickref.html#paragraphs Text styles ----------- (quickref__) __ quickref.html#inline-markup Inside paragraphs and other bodies of text, you may additionally mark text for *italics* with "``*italics*``" or **bold** with "``**bold**``". This is called "inline markup". If you want something to appear as a fixed-space literal, use "````double back-quotes````". Note that no further fiddling is done inside the double back-quotes -- so asterisks "``*``" etc. are left alone. If you find that you want to use one of the "special" characters in text, it will generally be OK -- reStructuredText is pretty smart. For example, this lone asterisk * is handled just fine, as is the asterisk in this equation: 5*6=30. If you actually want text \*surrounded by asterisks* to **not** be italicised, then you need to indicate that the asterisk is not special. You do this by placing a backslash just before it, like so "``\*``" (quickref__), or by enclosing it in double back-quotes (inline literals), like this:: ``*`` __ quickref.html#escaping .. Tip:: Think of inline markup as a form of (parentheses) and use it the same way: immediately before and after the text being marked up. Inline markup by itself (surrounded by whitespace) or in the middle of a word won't be recognized. See the `markup spec`__ for full details. __ ../../ref/rst/restructuredtext.html#inline-markup Lists ----- Lists of items come in three main flavours: **enumerated**, **bulleted** and **definitions**. In all list cases, you may have as many paragraphs, sublists, etc. as you want, as long as the left-hand side of the paragraph or whatever aligns with the first line of text in the list item. Lists must always start a new paragraph -- that is, they must appear after a blank line. **enumerated** lists (numbers, letters or roman numerals; quickref__) __ quickref.html#enumerated-lists Start a line off with a number or letter followed by a period ".", right bracket ")" or surrounded by brackets "( )" -- whatever you're comfortable with. All of the following forms are recognised:: 1. numbers A. upper-case letters and it goes over many lines with two paragraphs and all! a. lower-case letters 3. with a sub-list starting at a different number 4. make sure the numbers are in the correct sequence though! I. upper-case roman numerals i. lower-case roman numerals (1) numbers again 1) and again Results in (note: the different enumerated list styles are not always supported by every web browser, so you may not get the full effect here): 1. numbers A. upper-case letters and it goes over many lines with two paragraphs and all! a. lower-case letters 3. with a sub-list starting at a different number 4. make sure the numbers are in the correct sequence though! I. upper-case roman numerals i. lower-case roman numerals (1) numbers again 1) and again **bulleted** lists (quickref__) __ quickref.html#bullet-lists Just like enumerated lists, start the line off with a bullet point character - either "-", "+" or "\*":: * a bullet point using "\*" - a sub-list using "-" + yet another sub-list - another item Results in: * a bullet point using "\*" - a sub-list using "-" + yet another sub-list - another item **definition** lists (quickref__) __ quickref.html#definition-lists Unlike the other two, the definition lists consist of a term, and the definition of that term. The format of a definition list is:: what Definition lists associate a term with a definition. *how* The term is a one-line phrase, and the definition is one or more paragraphs or body elements, indented relative to the term. Blank lines are not allowed between term and definition. Results in: what Definition lists associate a term with a definition. *how* The term is a one-line phrase, and the definition is one or more paragraphs or body elements, indented relative to the term. Blank lines are not allowed between term and definition. Preformatting (code samples) ---------------------------- (quickref__) __ quickref.html#literal-blocks To just include a chunk of preformatted, never-to-be-fiddled-with text, finish the prior paragraph with "``::``". The preformatted block is finished when the text falls back to the same indentation level as a paragraph prior to the preformatted block. For example:: An example:: Whitespace, newlines, blank lines, and all kinds of markup (like *this* or \this) is preserved by literal blocks. Lookie here, I've dropped an indentation level (but not far enough) no more example Results in: An example:: Whitespace, newlines, blank lines, and all kinds of markup (like *this* or \this) is preserved by literal blocks. Lookie here, I've dropped an indentation level (but not far enough) no more example Note that if a paragraph consists only of "``::``", then it's removed from the output:: :: This is preformatted text, and the last "::" paragraph is removed Results in: :: This is preformatted text, and the last "::" paragraph is removed Sections -------- (quickref__) __ quickref.html#section-structure To break longer text up into sections, you use **section headers**. These are a single line of text (one or more words) with adornment: an underline alone, or an underline and an overline together, in dashes "``-----``", equals "``======``", tildes "``~~~~~~``" or any of the non-alphanumeric characters ``= - ` : ' " ~ ^ _ * + # < >`` that you feel comfortable with. An underline-only adornment is distinct from an overline-and-underline adornment using the same character. The underline/overline must be at least as long as the title text. Be consistent, since all sections marked with the same adornment style are deemed to be at the same level:: Chapter 1 Title =============== Section 1.1 Title ----------------- Subsection 1.1.1 Title ~~~~~~~~~~~~~~~~~~~~~~ Section 1.2 Title ----------------- Chapter 2 Title =============== This results in the following structure, illustrated by simplified pseudo-XML::
Chapter 1 Title <section> <title> Section 1.1 Title <section> <title> Subsection 1.1.1 Title <section> <title> Section 1.2 Title <section> <title> Chapter 2 Title (Pseudo-XML uses indentation for nesting and has no end-tags. It's not possible to show actual processed output, as in the other examples, because sections cannot exist inside block quotes. For a concrete example, compare the section structure of this document's source text and processed output.) Note that section headers are available as link targets, just using their name. To link to the Lists_ heading, I write "``Lists_``". If the heading has a space in it like `text styles`_, we need to quote the heading "```text styles`_``". Document Title / Subtitle ````````````````````````` The title of the whole document is distinct from section titles and may be formatted somewhat differently (e.g. the HTML writer by default shows it as a centered heading). To indicate the document title in reStructuredText, use a unique adornment style at the beginning of the document. To indicate the document subtitle, use another unique adornment style immediately after the document title. For example:: ================ Document Title ================ ---------- Subtitle ---------- Section Title ============= ... Note that "Document Title" and "Section Title" above both use equals signs, but are distict and unrelated styles. The text of overline-and-underlined titles (but not underlined-only) may be inset for aesthetics. Images ------ (quickref__) __ quickref.html#directives To include an image in your document, you use the the ``image`` directive__. For example:: .. image:: images/biohazard.png results in: .. image:: images/biohazard.png The ``images/biohazard.png`` part indicates the filename of the image you wish to appear in the document. There's no restriction placed on the image (format, size etc). If the image is to appear in HTML and you wish to supply additional information, you may:: .. image:: images/biohazard.png :height: 100 :width: 200 :scale: 50 :alt: alternate text See the full `image directive documentation`__ for more info. __ ../../ref/rst/directives.html __ ../../ref/rst/directives.html#images What Next? ---------- This primer introduces the most common features of reStructuredText, but there are a lot more to explore. The `Quick reStructuredText`_ user reference is a good place to go next. For complete details, the `reStructuredText Markup Specification`_ is the place to go [#]_. Users who have questions or need assistance with Docutils or reStructuredText should post a message to the Docutils-users_ mailing list. .. [#] If that relative link doesn't work, try the master document: http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html. .. _reStructuredText Markup Specification: ../../ref/rst/restructuredtext.html .. _Docutils-users: ../mailing-lists.html#docutils-users .. _Docutils project web site: http://docutils.sourceforge.net/ ================================================ FILE: demo/kitchen-sink/docs/ruby.rb ================================================ #!/usr/bin/ruby # Program to find the factorial of a number def fact(n) if n == 0 1 else n * fact(n-1) end end puts fact(ARGV[0].to_i) class Range def to_json(*a) { 'json_class' => self.class.name, # = 'Range' 'data' => [ first, last, exclude_end? ] }.to_json(*a) end end {:id => ?", :key => "value"} herDocs = [<<'FOO', <<BAR, <<-BAZ, <<-`EXEC`] #comment FOO #{literal} FOO BAR #{fact(10)} BAR BAZ indented BAZ echo hi EXEC puts herDocs ================================================ FILE: demo/kitchen-sink/docs/rust.rs ================================================ use core::rand::RngUtil; fn main() { for ["Alice", "Bob", "Carol"].each |&name| { do spawn { let v = rand::Rng().shuffle([1, 2, 3]); for v.each |&num| { print(fmt!("%s says: '%d'\n", name, num + 1)) } } } } fn map<T, U>(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] { let mut accumulator = ~[]; for vec::each(vector) |element| { accumulator.push(function(element)); } return accumulator; } ================================================ FILE: demo/kitchen-sink/docs/sass.sass ================================================ // sass ace mode; @import url(http://fonts.googleapis.com/css?family=Ace:700) html, body :background-color #ace text-align: center height: 100% /*;*********; ;comment ; ;*********; .toggle $size: 14px :background url(http://subtlepatterns.com/patterns/dark_stripes.png) border-radius: 8px height: $size &:before $radius: $size * 0.845 $glow: $size * 0.125 box-shadow: 0 0 $glow $glow / 2 #fff border-radius: $radius &:active ~ .button box-shadow: 0 15px 25px -4px rgba(0,0,0,0.4) ~ .label font-size: 40px color: rgba(0,0,0,0.45) &:checked ~ .button box-shadow: 0 15px 25px -4px #ace ~ .label font-size: 40px color: #c9c9c9 ================================================ FILE: demo/kitchen-sink/docs/scad.scad ================================================ // ace can highlight scad! module Element(xpos, ypos, zpos){ translate([xpos,ypos,zpos]){ union(){ cube([10,10,4],true); cylinder(10,15,5); translate([0,0,10])sphere(5); } } } union(){ for(i=[0:30]){ # Element(0,0,0); Element(15*i,0,0); } } for (i = [3, 5, 7, 11]){ rotate([i*10,0,0])scale([1,1,i])cube(10); } ================================================ FILE: demo/kitchen-sink/docs/scala.scala ================================================ // http://www.scala-lang.org/node/54 package examples.actors import scala.actors.Actor import scala.actors.Actor._ abstract class PingMessage case object Start extends PingMessage case object SendPing extends PingMessage case object Pong extends PingMessage abstract class PongMessage case object Ping extends PongMessage case object Stop extends PongMessage object pingpong extends Application { val pong = new Pong val ping = new Ping(100000, pong) ping.start pong.start ping ! Start } class Ping(count: Int, pong: Actor) extends Actor { def act() { println("Ping: Initializing with count "+count+": "+pong) var pingsLeft = count loop { react { case Start => println("Ping: starting.") pong ! Ping pingsLeft = pingsLeft - 1 case SendPing => pong ! Ping pingsLeft = pingsLeft - 1 case Pong => if (pingsLeft % 1000 == 0) println("Ping: pong from: "+sender) if (pingsLeft > 0) self ! SendPing else { println("Ping: Stop.") pong ! Stop exit('stop) } } } } } class Pong extends Actor { def act() { var pongCount = 0 loop { react { case Ping => if (pongCount % 1000 == 0) println("Pong: ping "+pongCount+" from "+sender) sender ! Pong pongCount = pongCount + 1 case Stop => println("Pong: Stop.") exit('stop) } } } } ================================================ FILE: demo/kitchen-sink/docs/scheme.scm ================================================ (define (prompt-for-cd) "Prompts for CD" (prompt-read "Title" 1.53 1 2/4 1.7 1.7e0 2.9E-4 +42 -7 #b001 #b001/100 #o777 #O777 #xabc55 #c(0 -5.6)) (prompt-read "Artist") (or (parse-integer (prompt-read "Rating") #:junk-allowed #t) 0) (if x (format #t "yes") (format #f "no") ;and here comment ) ;; second line comment '(+ 1 2) (position-if-not char-set:whitespace line #:start beg)) (quote (privet 1 2 3)) '(hello world) (* 5 7) (1 2 34 5) (#:use "aaaa") (let ((x 10) (y 20)) (display (+ x y)) ) "asdad\0eqweqe" ================================================ FILE: demo/kitchen-sink/docs/scss.scss ================================================ /* style.scss */ #navbar { $navbar-width: 800px; $items: 5; $navbar-color: #ce4dd6; width: $navbar-width; border-bottom: 2px solid $navbar-color; li { float: left; width: $navbar-width/$items - 10px; background-color: lighten($navbar-color, 20%); &:hover { background-color: lighten($navbar-color, 10%); } } } ================================================ FILE: demo/kitchen-sink/docs/sh.sh ================================================ #!/bin/sh # Script to open a browser to current branch # Repo formats: # ssh git@github.com:richo/gh_pr.git # http https://richoH@github.com/richo/gh_pr.git # git git://github.com/richo/gh_pr.git username=`git config --get github.user` get_repo() { git remote -v | grep ${@:-$username} | while read remote; do if repo=`echo $remote | grep -E -o "git@github.com:[^ ]*"`; then echo $repo | sed -e "s/^git@github\.com://" -e "s/\.git$//" exit 1 fi if repo=`echo $remote | grep -E -o "https?://([^@]*@)?github.com/[^ ]*\.git"`; then echo $repo | sed -e "s|^https?://||" -e "s/^.*github\.com\///" -e "s/\.git$//" exit 1 fi if repo=`echo $remote | grep -E -o "git://github.com/[^ ]*\.git"`; then echo $repo | sed -e "s|^git://github.com/||" -e "s/\.git$//" exit 1 fi done if [ $? -eq 0 ]; then echo "Couldn't find a valid remote" >&2 exit 1 fi } echo ${#x[@]} if repo=`get_repo $@`; then branch=`git symbolic-ref HEAD 2>/dev/null` echo "http://github.com/$repo/pull/new/${branch##refs/heads/}" else exit 1 fi ================================================ FILE: demo/kitchen-sink/docs/sjs.sjs ================================================ var { each, map } = require('sjs:sequence'); var { get } = require('sjs:http'); function foo(items, nada) { var component = { name: "Ace", role: "Editor" }; console.log(" Welcome, #{component.name} ".trim()); logging.debug(`Component added: $String(component) (${component})`); console.log(` Welcome, {${function() { return { x: 1, y: "why?}"}; }()} `.trim()); waitfor { items .. each.par { |item| get(item); } } and { var lengths = items .. map(i -> i.length); } or { hold(1500); throw new Error("timed out"); } } // Real Tab. ================================================ FILE: demo/kitchen-sink/docs/smarty.smarty ================================================ {foreach $foo as $bar} <a href="{$bar.zig}">{$bar.zag}</a> <a href="{$bar.zig2}">{$bar.zag2}</a> <a href="{$bar.zig3}">{$bar.zag3}</a> {foreachelse} There were no rows found. {/foreach} ================================================ FILE: demo/kitchen-sink/docs/snippets.snippets ================================================ # Function snippet fun function ${1?:function_name}(${2:argument}) { ${3:// body...} } # Anonymous Function regex /((=)\s*|(:)\s*|(\()|\b)/f/(\))?/ name f function${M1?: ${1:functionName}}($2) { ${0:$TM_SELECTED_TEXT} }${M2?;}${M3?,}${M4?)} # Immediate function trigger \(?f\( endTrigger \)? snippet f( (function(${1}) { ${0:${TM_SELECTED_TEXT:/* code */}} }(${1})); # if snippet if if (${1:true}) { ${0} } ================================================ FILE: demo/kitchen-sink/docs/soy_template.soy ================================================ /** * Greets a person using "Hello" by default. * @param name The name of the person. * @param? greetingWord Optional greeting word to use instead of "Hello". */ {template .helloName #eee} {if not $greetingWord} Hello {$name}! {else} {$greetingWord} {$name}! {/if} {/template} /** * Greets a person and optionally a list of other people. * @param name The name of the person. * @param additionalNames The additional names to greet. May be an empty list. */ {template .helloNames} // Greet the person. {call .helloName data="all" /}<br> // Greet the additional people. {foreach $additionalName in $additionalNames} {call .helloName} {param name: $additionalName /} {/call} {if not isLast($additionalName)} <br> // break after every line except the last {/if} {ifempty} No additional people to greet. {/foreach} {/template} {/foreach} {if length($items) > 5} {msg desc="Says hello to the user."} {namespace ns autoescape="contextual"} /** Example. */ {template .example} foo is {$ij.foo} {/template} ================================================ FILE: demo/kitchen-sink/docs/space.space ================================================ query count 10 created 2011-06-21T08:10:46Z lang en-US results photo 0 farm 6 id 5855620975 isfamily 0 isfriend 0 ispublic 1 owner 32021554@N04 secret f1f5e8515d server 5110 title 7087 bandit cat 1 farm 4 id 5856170534 isfamily 0 isfriend 0 ispublic 1 owner 32021554@N04 secret ff1efb2a6f server 3217 title 6975 rusty cat 2 farm 6 id 5856172972 isfamily 0 isfriend 0 ispublic 1 owner 51249875@N03 secret 6c6887347c server 5192 title watermarked-cats 3 farm 6 id 5856168328 isfamily 0 isfriend 0 ispublic 1 owner 32021554@N04 secret 0c1cfdf64c server 5078 title 7020 mandy cat 4 farm 3 id 5856171774 isfamily 0 isfriend 0 ispublic 1 owner 32021554@N04 secret 7f5a3180ab server 2696 title 7448 bobby cat ================================================ FILE: demo/kitchen-sink/docs/sparql.rq ================================================ PREFIX dbpedia-owl: <http://dbpedia.org/ontology/> PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> # 1. Directors of movies starring Brad Pitt # Datasource: http://fragments.dbpedia.org/*/en SELECT ?movie ?title ?name WHERE { ?movie dbpedia-owl:starring [ rdfs:label "Brad Pitt"@en ]; rdfs:label ?title; dbpedia-owl:director [ rdfs:label ?name ]. FILTER LANGMATCHES(LANG(?title), "EN") FILTER LANGMATCHES(LANG(?name), "EN") } ================================================ FILE: demo/kitchen-sink/docs/sql.sql ================================================ SELECT city, COUNT(id) AS users_count FROM users WHERE group_name = 'salesman' AND created > '2011-05-21' GROUP BY 1 ORDER BY 2 DESC ================================================ FILE: demo/kitchen-sink/docs/sqlserver.sqlserver ================================================ -- ============================================= -- Author: Morgan Yarbrough -- Create date: 4/27/2015 -- Description: Test procedure that shows off language features. -- Includes non-standard folding with region comments using either -- line comments or block comments (both are demonstrated below). -- This mode imitates SSMS and it designed to be used with SQL Server theme. -- ============================================= CREATE PROCEDURE dbo.TestProcedure --#region parameters @vint INT = 1 ,@vdate DATE = NULL ,@vdatetime DATETIME = DATEADD(dd, 1, GETDATE()) ,@vvarchar VARCHAR(MAX) = '' --#endregion AS BEGIN /*#region set statements */ SET NOCOUNT ON; SET XACT_ABORT ON; SET QUOTED_IDENTIFIER ON; /*#endregion*/ /** * These comments will produce a fold widget */ -- folding demonstration SET @vint = CASE WHEN @vdate IS NULL THEN 1 ELSE 2 END -- another folding demonstration IF @vint = 1 BEGIN SET @vvarchar = 'one' SET @vint = DATEDIFF(dd, @vdate, @vdatetime) END -- this mode handles strings properly DECLARE @sql NVARCHAR(4000) = N'SELECT TOP(1) OrderID FROM Orders WHERE @OrderDate > GETDATE()' -- this mode is aware of built in stored procedures EXECUTE sp_executesql @sql -- demonstrating some syntax highlighting SELECT Orders.OrderID ,Customers.CompanyName ,DATEFROMPARTS(YEAR(GETDATE()), 1, 1) AS FirstDayOfYear FROM Orders INNER JOIN Customers ON Orders.CustomerID = Customers.CustomerID WHERE CompanyName NOT LIKE '%something' OR CompanyName IS NULL OR CompanyName IN ('bla', 'nothing') -- this mode includes snippets -- place your cusor at the end of the line below and trigger auto complete (Ctrl+Space) createpr -- SQL Server allows using keywords as object names (not recommended) as long as they are wrapped in brackets DATABASE -- keyword [DATABASE] -- not a keyword END ================================================ FILE: demo/kitchen-sink/docs/stylus.styl ================================================ // I'm a comment! /* * Adds the given numbers together. */ /*! * Adds the given numbers together. */ asdasdasdad(df, ad=23) add(a, b = a) a + b green(#0c0) add(10, 5) // => 15 add(10) add(a, b) &asdasd (arguments) @sdfsdf .signatures background-color #e0e8e0 border 1px solid grayLighter box-shadow 0 0 3px grayLightest border-radius 3px padding 3px 5px "adsads" margin-left 0 list-style none .signature list-style none display: inline margin-left 0 > li display inline is not .signature-values list-style none display inline margin-left 0 &:before content '→' margin 0 5px > li !important unless ================================================ FILE: demo/kitchen-sink/docs/swift.swift ================================================ import UIKit class DetailsViewController: UIViewController { var album: Album? @IBOutlet weak var albumCover: UIImageView! required init(coder aDecoder: NSCoder) { super.init(coder: aDecoder) } override func viewDidLoad() { super.viewDidLoad() mLabel.text = self.album?.title && "Juhu \( "kinners" )! " albumCover.image = UIImage(data: NSData(contentsOfURL: NSURL(string: self.album!.largeImageURL)!)!) } } ================================================ FILE: demo/kitchen-sink/docs/tcl.tcl ================================================ proc dijkstra {graph origin} { # Initialize dict for {vertex distmap} $graph { dict set dist $vertex Inf dict set path $vertex {} } dict set dist $origin 0 dict set path $origin [list $origin] while {[dict size $graph]} { # Find unhandled node with least weight set d Inf dict for {uu -} $graph { if {$d > [set dd [dict get $dist $uu]]} { set u $uu set d $dd } } # No such node; graph must be disconnected if {$d == Inf} break # Update the weights for nodes\ lead to by the node we've picked dict for {v dd} [dict get $graph $u] { if {[dict exists $graph $v]} { set alt [expr {$d + $dd}] if {$alt < [dict get $dist $v]} { dict set dist $v $alt dict set path $v [list {*}[dict get $path $u] $v] } } } # Remove chosen node from graph still to be handled dict unset graph $u } return [list $dist $path] } ================================================ FILE: demo/kitchen-sink/docs/tex.tex ================================================ The quadratic formula is $$-b \pm \sqrt{b^2 - 4ac} \over 2a$$ \bye \makeatletter \newcommand{\be}{% \begingroup % \setlength{\arraycolsep}{2pt} \eqnarray% \@ifstar{\nonumber}{}% } \newcommand{\ee}{\endeqnarray\endgroup} \makeatother \begin{equation} x=\left\{ \begin{array}{cl} 0 & \textrm{if }A=\ldots\\ 1 & \textrm{if }B=\ldots\\ x & \textrm{this runs with as much text as you like, but without an raggeright text .}\end{array}\right. \end{equation} ================================================ FILE: demo/kitchen-sink/docs/textile.textile ================================================ h1. Textile document h2. Heading Two h3. A two-line header h2. Another two-line header Paragraph: one, two, thee lines! p(classone two three). This is a paragraph with classes p(#id). (one with an id) p(one two three#my_id). ..classes + id * Unordered list ** sublist * back again! ** sublist again.. # ordered bg. Blockquote! This is a two-list blockquote..! ================================================ FILE: demo/kitchen-sink/docs/toml.toml ================================================ # This is a TOML document. Boom. title = "TOML Example" [owner] name = "Tom Preston-Werner" organization = "GitHub" bio = "GitHub Cofounder & CEO\nLikes tater tots and beer." dob = 1979-05-27T07:32:00Z # First class dates? Why not? [database] server = "192.168.1.1" ports = [ 8001, 8001, 8002 ] connection_max = 5000 enabled = true [servers] # You can indent as you please. Tabs or spaces. TOML don't care. [servers.alpha] ip = "10.0.0.1" dc = "eqdc10" [servers.beta] ip = "10.0.0.2" dc = "eqdc10" [clients] data = [ ["gamma", "delta"], [1, 2] ] # just an update to make sure parsers support it ================================================ FILE: demo/kitchen-sink/docs/tsx.tsx ================================================ var mode = <div> Typescript + <b> JSX </b> </div>; ================================================ FILE: demo/kitchen-sink/docs/turtle.ttl ================================================ @base <http://example.org/> . @prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . @prefix foaf: <http://xmlns.com/foaf/0.1/> . @prefix rel: <http://www.perceive.net/schemas/relationship/> . <#green-goblin> rel:enemyOf <#spiderman> ; a foaf:Person ; # in the context of the Marvel universe foaf:name "Green Goblin" . <#spiderman> rel:enemyOf <#green-goblin> ; a foaf:Person ; foaf:name "Spiderman", "Человек-паук"@ru . ================================================ FILE: demo/kitchen-sink/docs/twig.twig ================================================ <!DOCTYPE html> <html> <head> <title>My Webpage {% if 1 not in [1, 2, 3] %} {# is equivalent to #} {% if not (1 in [1, 2, 3]) %} {% autoescape true %} {{ var }} {{ var|raw }} {# var won't be escaped #} {{ var|escape }} {# var won't be doubled-escaped #} {% endautoescape %} {{ include('twig.html', sandboxed = true) }} {{"string #{with} \" escapes" 'another#one' }}

My Webpage

{{ a_variable }} ================================================ FILE: demo/kitchen-sink/docs/typescript.ts ================================================ class Greeter { greeting: string; constructor (message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } var greeter = new Greeter("world"); var button = document.createElement('button') button.innerText = "Say Hello"; button.onclick = function() { alert(greeter.greet()) } document.body.appendChild(button) class Snake extends Animal { move() { alert("Slithering..."); super(5); } } class Horse extends Animal { move() { alert("Galloping..."); super.move(45); } } module Sayings { export class Greeter { greeting: string; constructor (message: string) { this.greeting = message; } greet() { return "Hello, " + this.greeting; } } } module Mankala { export class Features { public turnContinues = false; public seedStoredCount = 0; public capturedCount = 0; public spaceCaptured = NoSpace; public clear() { this.turnContinues = false; this.seedStoredCount = 0; this.capturedCount = 0; this.spaceCaptured = NoSpace; } public toString() { var stringBuilder = ""; if (this.turnContinues) { stringBuilder += " turn continues,"; } stringBuilder += " stores " + this.seedStoredCount; if (this.capturedCount > 0) { stringBuilder += " captures " + this.capturedCount + " from space " + this.spaceCaptured; } return stringBuilder; } } } ================================================ FILE: demo/kitchen-sink/docs/vala.vala ================================================ using Gtk; int main (string[] args) { Gtk.init (ref args); var foo = new MyFoo>(); var window = new Window(); window.title = "Hello, World!"; window.border_width = 10; window.window_position = WindowPosition.CENTER; window.set_default_size(350, 70); window.destroy.connect(Gtk.main_quit); var label = new Label("Hello, World!"); window.add(label); window.show_all(); Gtk.main(); return 0; } ================================================ FILE: demo/kitchen-sink/docs/vbscript.vbs ================================================ myfilename = "C:\Wikipedia - VBScript - Example - Hello World.txt" MakeHelloWorldFile myfilename Sub MakeHelloWorldFile (FileName) 'Create a new file in C: drive or overwrite existing file Set FSO = CreateObject("Scripting.FileSystemObject") If FSO.FileExists(FileName) Then Answer = MsgBox ("File " & FileName & " exists ... OK to overwrite?", vbOKCancel) 'If button selected is not OK, then quit now 'vbOK is a language constant If Answer <> vbOK Then Exit Sub Else 'Confirm OK to create Answer = MsgBox ("File " & FileName & " ... OK to create?", vbOKCancel) If Answer <> vbOK Then Exit Sub End If 'Create new file (or replace an existing file) Set FileObject = FSO.CreateTextFile (FileName) FileObject.WriteLine "Time ... " & Now() FileObject.WriteLine "Hello World" FileObject.Close() MsgBox "File " & FileName & " ... updated." End Sub ================================================ FILE: demo/kitchen-sink/docs/velocity.vm ================================================ #* This is a sample comment block that spans multiple lines. *# #macro ( outputItem $item )
  • ${item}
  • #end ## Define the items to iterate #set ( $items = [1, 2, 3, 4] )
      ## Iterate over the items and output the evens. #foreach ( $item in $items ) #if ( $_MathTool.mod($item, 2) == 0 ) #outputItem ($item) #end #end
    ================================================ FILE: demo/kitchen-sink/docs/verilog.v ================================================ always @(negedge reset or posedge clk) begin if (reset == 0) begin d_out <= 16'h0000; d_out_mem[resetcount] <= d_out; laststoredvalue <= d_out; end else begin d_out <= d_out + 1'b1; end end always @(bufreadaddr) bufreadval = d_out_mem[bufreadaddr]; ================================================ FILE: demo/kitchen-sink/docs/vhdl.vhd ================================================ library IEEE user IEEE.std_logic_1164.all; use IEEE.numeric_std.all; entity COUNT16 is port ( cOut :out std_logic_vector(15 downto 0); -- counter output clkEn :in std_logic; -- count enable clk :in std_logic; -- clock input rst :in std_logic -- reset input ); end entity; architecture count_rtl of COUNT16 is signal count :std_logic_vector (15 downto 0); begin process (clk, rst) begin if(rst = '1') then count <= (others=>'0'); elsif(rising_edge(clk)) then if(clkEn = '1') then count <= count + 1; end if; end if; end process; cOut <= count; end architecture; ================================================ FILE: demo/kitchen-sink/docs/wollok.wlk ================================================ class Actividad { method calcularMejora() } class EstudiarMateria inherits Actividad { var materia var puntos = 0 new(m, p) { materia = m puntos = p } override method calcularMejora() = puntos } class EjercitarEnSimulador inherits Actividad { var horas = 0 new(h) { horas = h } override method calcularMejora() = 10 * horas } object pepita { var energia = 100 method volar(m) { energia -= m } } ================================================ FILE: demo/kitchen-sink/docs/xml.xml ================================================ true 26 25 21978 24865670 Continent Africa 24865675 Continent Europe 24865673 Continent South America 28289421 Continent Antarctic 24865671 Continent Asia 24865672 Continent North America 55949070 Continent Australia ================================================ FILE: demo/kitchen-sink/docs/xquery.xq ================================================ xquery version "1.0"; let $message := "Hello World!" return {$message} ================================================ FILE: demo/kitchen-sink/docs/yaml.yaml ================================================ # This sample document was taken from wikipedia: # http://en.wikipedia.org/wiki/YAML#Sample_document --- receipt: Oz-Ware Purchase Invoice date: 2007-08-06 customer: given: Dorothy family: Gale items: - part_no: 'A4786' descrip: Water Bucket (Filled) price: 1.47 quantity: 4 - part_no: 'E1628' descrip: High Heeled "Ruby" Slippers size: 8 price: 100.27 quantity: 1 bill-to: &id001 street: | 123 Tornado Alley Suite 16 city: East Centerville state: KS ship-to: *id001 specialDelivery: > Follow the Yellow Brick Road to the Emerald City. Pay no attention to the man behind the curtain. ================================================ FILE: demo/kitchen-sink/file_drop.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { var config = require("ace/config"); var event = require("ace/lib/event"); var modelist = require("ace/ext/modelist"); module.exports = function(editor) { event.addListener(editor.container, "dragover", function(e) { var types = e.dataTransfer.types; if (types && Array.prototype.indexOf.call(types, 'Files') !== -1) return event.preventDefault(e); }); event.addListener(editor.container, "drop", function(e) { var file; try { file = e.dataTransfer.files[0]; if (window.FileReader) { var reader = new FileReader(); reader.onload = function() { var mode = modelist.getModeForPath(file.name); editor.session.doc.setValue(reader.result); editor.session.setMode(mode.mode); editor.session.modeName = mode.name; }; reader.readAsText(file); } return event.preventDefault(e); } catch(err) { return event.stopEvent(e); } }); }; var Editor = require("ace/editor").Editor; config.defineOptions(Editor.prototype, "editor", { loadDroppedFile: { set: function() { module.exports(this); }, value: true } }); }); ================================================ FILE: demo/kitchen-sink/inline_editor.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var LineWidgets = require("ace/line_widgets").LineWidgets; var Editor = require("ace/editor").Editor; var Renderer = require("ace/virtual_renderer").VirtualRenderer; var dom = require("ace/lib/dom"); require("ace/commands/default_commands").commands.push({ name: "openInlineEditor", bindKey: "F3", exec: function(editor) { var split = window.env.split; var s = editor.session; var inlineEditor = new Editor(new Renderer()); var splitSession = split.$cloneSession(s); var row = editor.getCursorPosition().row; if (editor.session.lineWidgets && editor.session.lineWidgets[row]) { editor.session.lineWidgets[row].destroy(); return; } var rowCount = 10; var w = { row: row, // rowCount: rowCount, fixedWidth: true, el: dom.createElement("div"), editor: inlineEditor }; var el = w.el; el.appendChild(inlineEditor.container); if (!editor.session.widgetManager) { editor.session.widgetManager = new LineWidgets(editor.session); editor.session.widgetManager.attach(editor); } var h = rowCount*editor.renderer.layerConfig.lineHeight; inlineEditor.container.style.height = h + "px"; el.style.position = "absolute"; el.style.zIndex = "4"; el.style.borderTop = "solid blue 2px"; el.style.borderBottom = "solid blue 2px"; inlineEditor.setSession(splitSession); editor.session.widgetManager.addLineWidget(w); var kb = { handleKeyboard:function(_,hashId, keyString) { if (hashId === 0 && keyString === "esc") { w.destroy(); return true; } } }; w.destroy = function() { editor.keyBinding.removeKeyboardHandler(kb); s.widgetManager.removeLineWidget(w); }; editor.keyBinding.addKeyboardHandler(kb); inlineEditor.keyBinding.addKeyboardHandler(kb); inlineEditor.setTheme("ace/theme/solarized_light"); } }); }); ================================================ FILE: demo/kitchen-sink/layout.js ================================================ define(function(require, exports, module) { "use strict"; var dom = require("ace/lib/dom"); var event = require("ace/lib/event"); var EditSession = require("ace/edit_session").EditSession; var UndoManager = require("ace/undomanager").UndoManager; var Renderer = require("ace/virtual_renderer").VirtualRenderer; var Editor = require("ace/editor").Editor; var MultiSelect = require("ace/multi_select").MultiSelect; dom.importCssString("\ splitter {\ border: 1px solid #C6C6D2;\ width: 0px;\ cursor: ew-resize;\ z-index:10}\ splitter:hover {\ margin-left: -2px;\ width:3px;\ border-color: #B5B4E0;\ }\ ", "splitEditor"); exports.edit = function(el) { if (typeof(el) == "string") el = document.getElementById(el); var editor = new Editor(new Renderer(el, require("ace/theme/textmate"))); editor.resize(); event.addListener(window, "resize", function() { editor.resize(); }); return editor; }; var SplitRoot = function(el, theme, position, getSize) { el.style.position = position || "relative"; this.container = el; this.getSize = getSize || this.getSize; this.resize = this.$resize.bind(this); event.addListener(el.ownerDocument.defaultView, "resize", this.resize); this.editor = this.createEditor(); }; (function(){ this.createEditor = function() { var el = document.createElement("div"); el.className = this.$editorCSS; el.style.cssText = "position: absolute; top:0px; bottom:0px"; this.$container.appendChild(el); var session = new EditSession(""); var editor = new Editor(new Renderer(el, this.$theme)); /*editor.on("focus", function() { this._emit("focus", editor); }.bind(this));*/ this.$editors.push(editor); editor.setFontSize(this.$fontSize); return editor; }; this.$resize = function() { var size = this.getSize(this.container); this.rect = { x: size.left, y: size.top, w: size.width, h: size.height }; this.item.resize(this.rect); }; this.getSize = function(el) { return el.getBoundingClientRect(); }; this.destroy = function() { var win = this.container.ownerDocument.defaultView; event.removeListener(win, "resize", this.resize); }; }).call(SplitRoot.prototype); var Split = function(){ }; (function(){ this.execute = function(options) { this.$u.execute(options); }; }).call(Split.prototype); exports.singleLineEditor = function(el) { var renderer = new Renderer(el); el.style.overflow = "hidden"; renderer.screenToTextCoordinates = function(x, y) { var pos = this.pixelToScreenCoordinates(x, y); return this.session.screenToDocumentPosition( Math.min(this.session.getScreenLength() - 1, Math.max(pos.row, 0)), Math.max(pos.column, 0) ); }; renderer.$maxLines = 4; renderer.setStyle("ace_one-line"); var editor = new Editor(renderer); editor.session.setUndoManager(new UndoManager()); editor.setShowPrintMargin(false); editor.renderer.setShowGutter(false); editor.renderer.setHighlightGutterLine(false); editor.$mouseHandler.$focusWaitTimout = 0; return editor; }; }); ================================================ FILE: demo/kitchen-sink/require.js ================================================ /** vim: et:ts=4:sw=4:sts=4 * @license RequireJS 2.1.11+ Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved. * Available via the MIT or new BSD license. * see: http://github.com/jrburke/requirejs for details */ //Not using strict: uneven strict support in browsers, #392, and causes //problems with requirejs.exec()/transpiler plugins that may not be strict. /*jslint regexp: true, nomen: true, sloppy: true */ /*global window, navigator, document, importScripts, setTimeout, opera */ var requirejs, require, define; (function (global) { var req, s, head, baseElement, dataMain, src, interactiveScript, currentlyAddingScript, mainScript, subPath, version = '2.1.11+', commentRegExp = /(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg, cjsRequireRegExp = /[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g, jsSuffixRegExp = /\.js$/, currDirRegExp = /^\.\//, op = Object.prototype, ostring = op.toString, hasOwn = op.hasOwnProperty, ap = Array.prototype, apsp = ap.splice, isBrowser = !!(typeof window !== 'undefined' && typeof navigator !== 'undefined' && window.document), isWebWorker = !isBrowser && typeof importScripts !== 'undefined', //PS3 indicates loaded and complete, but need to wait for complete //specifically. Sequence is 'loading', 'loaded', execution, // then 'complete'. The UA check is unfortunate, but not sure how //to feature test w/o causing perf issues. readyRegExp = isBrowser && navigator.platform === 'PLAYSTATION 3' ? /^complete$/ : /^(complete|loaded)$/, defContextName = '_', //Oh the tragedy, detecting opera. See the usage of isOpera for reason. isOpera = typeof opera !== 'undefined' && opera.toString() === '[object Opera]', contexts = {}, cfg = {}, globalDefQueue = [], useInteractive = false; function isFunction(it) { return ostring.call(it) === '[object Function]'; } function isArray(it) { return ostring.call(it) === '[object Array]'; } /** * Helper function for iterating over an array. If the func returns * a true value, it will break out of the loop. */ function each(ary, func) { if (ary) { var i; for (i = 0; i < ary.length; i += 1) { if (ary[i] && func(ary[i], i, ary)) { break; } } } } /** * Helper function for iterating over an array backwards. If the func * returns a true value, it will break out of the loop. */ function eachReverse(ary, func) { if (ary) { var i; for (i = ary.length - 1; i > -1; i -= 1) { if (ary[i] && func(ary[i], i, ary)) { break; } } } } function hasProp(obj, prop) { return hasOwn.call(obj, prop); } function getOwn(obj, prop) { return hasProp(obj, prop) && obj[prop]; } /** * Cycles over properties in an object and calls a function for each * property value. If the function returns a truthy value, then the * iteration is stopped. */ function eachProp(obj, func) { var prop; for (prop in obj) { if (hasProp(obj, prop)) { if (func(obj[prop], prop)) { break; } } } } /** * Simple function to mix in properties from source into target, * but only if target does not already have a property of the same name. */ function mixin(target, source, force, deepStringMixin) { if (source) { eachProp(source, function (value, prop) { if (force || !hasProp(target, prop)) { if (deepStringMixin && typeof value === 'object' && value && !isArray(value) && !isFunction(value) && !(value instanceof RegExp)) { if (!target[prop]) { target[prop] = {}; } mixin(target[prop], value, force, deepStringMixin); } else { target[prop] = value; } } }); } return target; } //Similar to Function.prototype.bind, but the 'this' object is specified //first, since it is easier to read/figure out what 'this' will be. function bind(obj, fn) { return function () { return fn.apply(obj, arguments); }; } function scripts() { return document.getElementsByTagName('script'); } function defaultOnError(err) { throw err; } //Allow getting a global that is expressed in //dot notation, like 'a.b.c'. function getGlobal(value) { if (!value) { return value; } var g = global; each(value.split('.'), function (part) { g = g[part]; }); return g; } /** * Constructs an error with a pointer to an URL with more information. * @param {String} id the error ID that maps to an ID on a web page. * @param {String} message human readable error. * @param {Error} [err] the original error, if there is one. * * @returns {Error} */ function makeError(id, msg, err, requireModules) { var e = new Error(msg + '\nhttp://requirejs.org/docs/errors.html#' + id); e.requireType = id; e.requireModules = requireModules; if (err) { e.originalError = err; } return e; } if (typeof define !== 'undefined') { //If a define is already in play via another AMD loader, //do not overwrite. return; } if (typeof requirejs !== 'undefined') { if (isFunction(requirejs)) { //Do not overwrite an existing requirejs instance. return; } cfg = requirejs; requirejs = undefined; } //Allow for a require config object if (typeof require !== 'undefined' && !isFunction(require)) { //assume it is a config object. cfg = require; require = undefined; } function newContext(contextName) { var inCheckLoaded, Module, context, handlers, checkLoadedTimeoutId, config = { //Defaults. Do not set a default for map //config to speed up normalize(), which //will run faster if there is no default. waitSeconds: 7, baseUrl: './', paths: {}, bundles: {}, pkgs: {}, shim: {}, config: {} }, registry = {}, //registry of just enabled modules, to speed //cycle breaking code when lots of modules //are registered, but not activated. enabledRegistry = {}, undefEvents = {}, defQueue = [], defined = {}, urlFetched = {}, bundlesMap = {}, requireCounter = 1, unnormalizedCounter = 1; /** * Trims the . and .. from an array of path segments. * It will keep a leading path segment if a .. will become * the first path segment, to help with module name lookups, * which act like paths, but can be remapped. But the end result, * all paths that use this function should look normalized. * NOTE: this method MODIFIES the input array. * @param {Array} ary the array of path segments. */ function trimDots(ary) { var i, part, length = ary.length; for (i = 0; i < length; i++) { part = ary[i]; if (part === '.') { ary.splice(i, 1); i -= 1; } else if (part === '..') { if (i === 1 && (ary[2] === '..' || ary[0] === '..')) { //End of the line. Keep at least one non-dot //path segment at the front so it can be mapped //correctly to disk. Otherwise, there is likely //no path mapping for a path starting with '..'. //This can still fail, but catches the most reasonable //uses of .. break; } else if (i > 0) { ary.splice(i - 1, 2); i -= 2; } } } } /** * Given a relative module name, like ./something, normalize it to * a real name that can be mapped to a path. * @param {String} name the relative name * @param {String} baseName a real name that the name arg is relative * to. * @param {Boolean} applyMap apply the map config to the value. Should * only be done if this normalization is for a dependency ID. * @returns {String} normalized name */ function normalize(name, baseName, applyMap) { var pkgMain, mapValue, nameParts, i, j, nameSegment, lastIndex, foundMap, foundI, foundStarMap, starI, baseParts = baseName && baseName.split('/'), normalizedBaseParts = baseParts, map = config.map, starMap = map && map['*']; //Adjust any relative paths. if (name && name.charAt(0) === '.') { //If have a base name, try to normalize against it, //otherwise, assume it is a top-level require that will //be relative to baseUrl in the end. if (baseName) { //Convert baseName to array, and lop off the last part, //so that . matches that 'directory' and not name of the baseName's //module. For instance, baseName of 'one/two/three', maps to //'one/two/three.js', but we want the directory, 'one/two' for //this normalization. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); name = name.split('/'); lastIndex = name.length - 1; // If wanting node ID compatibility, strip .js from end // of IDs. Have to do this here, and not in nameToUrl // because node allows either .js or non .js to map // to same file. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); } name = normalizedBaseParts.concat(name); trimDots(name); name = name.join('/'); } else if (name.indexOf('./') === 0) { // No baseName, so this is ID is resolved relative // to baseUrl, pull off the leading dot. name = name.substring(2); } } //Apply map config if available. if (applyMap && map && (baseParts || starMap)) { nameParts = name.split('/'); outerLoop: for (i = nameParts.length; i > 0; i -= 1) { nameSegment = nameParts.slice(0, i).join('/'); if (baseParts) { //Find the longest baseName segment match in the config. //So, do joins on the biggest to smallest lengths of baseParts. for (j = baseParts.length; j > 0; j -= 1) { mapValue = getOwn(map, baseParts.slice(0, j).join('/')); //baseName segment has config, find if it has one for //this name. if (mapValue) { mapValue = getOwn(mapValue, nameSegment); if (mapValue) { //Match, update name to the new value. foundMap = mapValue; foundI = i; break outerLoop; } } } } //Check for a star map match, but just hold on to it, //if there is a shorter segment match later in a matching //config, then favor over this star map. if (!foundStarMap && starMap && getOwn(starMap, nameSegment)) { foundStarMap = getOwn(starMap, nameSegment); starI = i; } } if (!foundMap && foundStarMap) { foundMap = foundStarMap; foundI = starI; } if (foundMap) { nameParts.splice(0, foundI, foundMap); name = nameParts.join('/'); } } // If the name points to a package's name, use // the package main instead. pkgMain = getOwn(config.pkgs, name); return pkgMain ? pkgMain : name; } function removeScript(name) { if (isBrowser) { each(scripts(), function (scriptNode) { if (scriptNode.getAttribute('data-requiremodule') === name && scriptNode.getAttribute('data-requirecontext') === context.contextName) { scriptNode.parentNode.removeChild(scriptNode); return true; } }); } } function hasPathFallback(id) { var pathConfig = getOwn(config.paths, id); if (pathConfig && isArray(pathConfig) && pathConfig.length > 1) { //Pop off the first array value, since it failed, and //retry pathConfig.shift(); context.require.undef(id); //Custom require that does not do map translation, since //ID is "absolute", already mapped/resolved. context.makeRequire(null, { skipMap: true })([id]); return true; } } //Turns a plugin!resource to [plugin, resource] //with the plugin being undefined if the name //did not have a plugin prefix. function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; } /** * Creates a module mapping that includes plugin prefix, module * name, and path. If parentModuleMap is provided it will * also normalize the name via require.normalize() * * @param {String} name the module name * @param {String} [parentModuleMap] parent module map * for the module name, used to resolve relative names. * @param {Boolean} isNormalized: is the ID already normalized. * This is true if this call is done for a define() module ID. * @param {Boolean} applyMap: apply the map config to the ID. * Should only be true if this map is for a dependency. * * @returns {Object} */ function makeModuleMap(name, parentModuleMap, isNormalized, applyMap) { var url, pluginModule, suffix, nameParts, prefix = null, parentName = parentModuleMap ? parentModuleMap.name : null, originalName = name, isDefine = true, normalizedName = ''; //If no name, then it means it is a require call, generate an //internal name. if (!name) { isDefine = false; name = '_@r' + (requireCounter += 1); } nameParts = splitPrefix(name); prefix = nameParts[0]; name = nameParts[1]; if (prefix) { prefix = normalize(prefix, parentName, applyMap); pluginModule = getOwn(defined, prefix); } //Account for relative paths if there is a base name. if (name) { if (prefix) { if (pluginModule && pluginModule.normalize) { //Plugin is loaded, use its normalize method. normalizedName = pluginModule.normalize(name, function (name) { return normalize(name, parentName, applyMap); }); } else { normalizedName = normalize(name, parentName, applyMap); } } else { //A regular module. normalizedName = normalize(name, parentName, applyMap); //Normalized name may be a plugin ID due to map config //application in normalize. The map config values must //already be normalized, so do not need to redo that part. nameParts = splitPrefix(normalizedName); prefix = nameParts[0]; normalizedName = nameParts[1]; isNormalized = true; url = context.nameToUrl(normalizedName); } } //If the id is a plugin id that cannot be determined if it needs //normalization, stamp it with a unique ID so two matching relative //ids that may conflict can be separate. suffix = prefix && !pluginModule && !isNormalized ? '_unnormalized' + (unnormalizedCounter += 1) : ''; return { prefix: prefix, name: normalizedName, parentMap: parentModuleMap, unnormalized: !!suffix, url: url, originalName: originalName, isDefine: isDefine, id: (prefix ? prefix + '!' + normalizedName : normalizedName) + suffix }; } function getModule(depMap) { var id = depMap.id, mod = getOwn(registry, id); if (!mod) { mod = registry[id] = new context.Module(depMap); } return mod; } function on(depMap, name, fn) { var id = depMap.id, mod = getOwn(registry, id); if (hasProp(defined, id) && (!mod || mod.defineEmitComplete)) { if (name === 'defined') { fn(defined[id]); } } else { mod = getModule(depMap); if (mod.error && name === 'error') { fn(mod.error); } else { mod.on(name, fn); } } } function onError(err, errback) { var ids = err.requireModules, notified = false; if (errback) { errback(err); } else { each(ids, function (id) { var mod = getOwn(registry, id); if (mod) { //Set error on module, so it skips timeout checks. mod.error = err; if (mod.events.error) { notified = true; mod.emit('error', err); } } }); if (!notified) { req.onError(err); } } } /** * Internal method to transfer globalQueue items to this context's * defQueue. */ function takeGlobalQueue() { //Push all the globalDefQueue items into the context's defQueue if (globalDefQueue.length) { //Array splice in the values since the context code has a //local var ref to defQueue, so cannot just reassign the one //on context. apsp.apply(defQueue, [defQueue.length, 0].concat(globalDefQueue)); globalDefQueue = []; } } handlers = { 'require': function (mod) { if (mod.require) { return mod.require; } else { return (mod.require = context.makeRequire(mod.map)); } }, 'exports': function (mod) { mod.usingExports = true; if (mod.map.isDefine) { if (mod.exports) { return (defined[mod.map.id] = mod.exports); } else { return (mod.exports = defined[mod.map.id] = {}); } } }, 'module': function (mod) { if (mod.module) { return mod.module; } else { return (mod.module = { id: mod.map.id, uri: mod.map.url, config: function () { return getOwn(config.config, mod.map.id) || {}; }, exports: mod.exports || (mod.exports = {}) }); } } }; function cleanRegistry(id) { //Clean up machinery used for waiting modules. delete registry[id]; delete enabledRegistry[id]; } function breakCycle(mod, traced, processed) { var id = mod.map.id; if (mod.error) { mod.emit('error', mod.error); } else { traced[id] = true; each(mod.depMaps, function (depMap, i) { var depId = depMap.id, dep = getOwn(registry, depId); //Only force things that have not completed //being defined, so still in the registry, //and only if it has not been matched up //in the module already. if (dep && !mod.depMatched[i] && !processed[depId]) { if (getOwn(traced, depId)) { mod.defineDep(i, defined[depId]); mod.check(); //pass false? } else { breakCycle(dep, traced, processed); } } }); processed[id] = true; } } function checkLoaded() { var err, usingPathFallback, waitInterval = config.waitSeconds * 1000, //It is possible to disable the wait interval by using waitSeconds of 0. expired = waitInterval && (context.startTime + waitInterval) < new Date().getTime(), noLoads = [], reqCalls = [], stillLoading = false, needCycleCheck = true; //Do not bother if this call was a result of a cycle break. if (inCheckLoaded) { return; } inCheckLoaded = true; //Figure out the state of all the modules. eachProp(enabledRegistry, function (mod) { var map = mod.map, modId = map.id; //Skip things that are not enabled or in error state. if (!mod.enabled) { return; } if (!map.isDefine) { reqCalls.push(mod); } if (!mod.error) { //If the module should be executed, and it has not //been inited and time is up, remember it. if (!mod.inited && expired) { if (hasPathFallback(modId)) { usingPathFallback = true; stillLoading = true; } else { noLoads.push(modId); removeScript(modId); } } else if (!mod.inited && mod.fetched && map.isDefine) { stillLoading = true; if (!map.prefix) { //No reason to keep looking for unfinished //loading. If the only stillLoading is a //plugin resource though, keep going, //because it may be that a plugin resource //is waiting on a non-plugin cycle. return (needCycleCheck = false); } } } }); if (expired && noLoads.length) { //If wait time expired, throw error of unloaded modules. err = makeError('timeout', 'Load timeout for modules: ' + noLoads, null, noLoads); err.contextName = context.contextName; return onError(err); } //Not expired, check for a cycle. if (needCycleCheck) { each(reqCalls, function (mod) { breakCycle(mod, {}, {}); }); } //If still waiting on loads, and the waiting load is something //other than a plugin resource, or there are still outstanding //scripts, then just try back later. if ((!expired || usingPathFallback) && stillLoading) { //Something is still waiting to load. Wait for it, but only //if a timeout is not already in effect. if ((isBrowser || isWebWorker) && !checkLoadedTimeoutId) { checkLoadedTimeoutId = setTimeout(function () { checkLoadedTimeoutId = 0; checkLoaded(); }, 50); } } inCheckLoaded = false; } Module = function (map) { this.events = getOwn(undefEvents, map.id) || {}; this.map = map; this.shim = getOwn(config.shim, map.id); this.depExports = []; this.depMaps = []; this.depMatched = []; this.pluginMaps = {}; this.depCount = 0; /* this.exports this.factory this.depMaps = [], this.enabled, this.fetched */ }; Module.prototype = { init: function (depMaps, factory, errback, options) { options = options || {}; //Do not do more inits if already done. Can happen if there //are multiple define calls for the same module. That is not //a normal, common case, but it is also not unexpected. if (this.inited) { return; } this.factory = factory; if (errback) { //Register for errors on this module. this.on('error', errback); } else if (this.events.error) { //If no errback already, but there are error listeners //on this module, set up an errback to pass to the deps. errback = bind(this, function (err) { this.emit('error', err); }); } //Do a copy of the dependency array, so that //source inputs are not modified. For example //"shim" deps are passed in here directly, and //doing a direct modification of the depMaps array //would affect that config. this.depMaps = depMaps && depMaps.slice(0); this.errback = errback; //Indicate this module has be initialized this.inited = true; this.ignore = options.ignore; //Could have option to init this module in enabled mode, //or could have been previously marked as enabled. However, //the dependencies are not known until init is called. So //if enabled previously, now trigger dependencies as enabled. if (options.enabled || this.enabled) { //Enable this module and dependencies. //Will call this.check() this.enable(); } else { this.check(); } }, defineDep: function (i, depExports) { //Because of cycles, defined callback for a given //export can be called more than once. if (!this.depMatched[i]) { this.depMatched[i] = true; this.depCount -= 1; this.depExports[i] = depExports; } }, fetch: function () { if (this.fetched) { return; } this.fetched = true; context.startTime = (new Date()).getTime(); var map = this.map; //If the manager is for a plugin managed resource, //ask the plugin to load it now. if (this.shim) { context.makeRequire(this.map, { enableBuildCallback: true })(this.shim.deps || [], bind(this, function () { return map.prefix ? this.callPlugin() : this.load(); })); } else { //Regular dependency. return map.prefix ? this.callPlugin() : this.load(); } }, load: function () { var url = this.map.url; //Regular dependency. if (!urlFetched[url]) { urlFetched[url] = true; context.load(this.map.id, url); } }, /** * Checks if the module is ready to define itself, and if so, * define it. */ check: function () { if (!this.enabled || this.enabling) { return; } var err, cjsModule, id = this.map.id, depExports = this.depExports, exports = this.exports, factory = this.factory; if (!this.inited) { this.fetch(); } else if (this.error) { this.emit('error', this.error); } else if (!this.defining) { //The factory could trigger another require call //that would result in checking this module to //define itself again. If already in the process //of doing that, skip this work. this.defining = true; if (this.depCount < 1 && !this.defined) { if (isFunction(factory)) { //If there is an error listener, favor passing //to that instead of throwing an error. However, //only do it for define()'d modules. require //errbacks should not be called for failures in //their callbacks (#699). However if a global //onError is set, use that. if ((this.events.error && this.map.isDefine) || req.onError !== defaultOnError) { try { exports = context.execCb(id, factory, depExports, exports); } catch (e) { err = e; } } else { exports = context.execCb(id, factory, depExports, exports); } // Favor return value over exports. If node/cjs in play, // then will not have a return value anyway. Favor // module.exports assignment over exports object. if (this.map.isDefine && exports === undefined) { cjsModule = this.module; if (cjsModule) { exports = cjsModule.exports; } else if (this.usingExports) { //exports already set the defined value. exports = this.exports; } } if (err) { err.requireMap = this.map; err.requireModules = this.map.isDefine ? [this.map.id] : null; err.requireType = this.map.isDefine ? 'define' : 'require'; return onError((this.error = err)); } } else { //Just a literal value exports = factory; } this.exports = exports; if (this.map.isDefine && !this.ignore) { defined[id] = exports; if (req.onResourceLoad) { req.onResourceLoad(context, this.map, this.depMaps); } } //Clean up cleanRegistry(id); this.defined = true; } //Finished the define stage. Allow calling check again //to allow define notifications below in the case of a //cycle. this.defining = false; if (this.defined && !this.defineEmitted) { this.defineEmitted = true; this.emit('defined', this.exports); this.defineEmitComplete = true; } } }, callPlugin: function () { var map = this.map, id = map.id, //Map already normalized the prefix. pluginMap = makeModuleMap(map.prefix); //Mark this as a dependency for this plugin, so it //can be traced for cycles. this.depMaps.push(pluginMap); on(pluginMap, 'defined', bind(this, function (plugin) { var load, normalizedMap, normalizedMod, bundleId = getOwn(bundlesMap, this.map.id), name = this.map.name, parentName = this.map.parentMap ? this.map.parentMap.name : null, localRequire = context.makeRequire(map.parentMap, { enableBuildCallback: true }); //If current map is not normalized, wait for that //normalized name to load instead of continuing. if (this.map.unnormalized) { //Normalize the ID if the plugin allows it. if (plugin.normalize) { name = plugin.normalize(name, function (name) { return normalize(name, parentName, true); }) || ''; } //prefix and name should already be normalized, no need //for applying map config again either. normalizedMap = makeModuleMap(map.prefix + '!' + name, this.map.parentMap); on(normalizedMap, 'defined', bind(this, function (value) { this.init([], function () { return value; }, null, { enabled: true, ignore: true }); })); normalizedMod = getOwn(registry, normalizedMap.id); if (normalizedMod) { //Mark this as a dependency for this plugin, so it //can be traced for cycles. this.depMaps.push(normalizedMap); if (this.events.error) { normalizedMod.on('error', bind(this, function (err) { this.emit('error', err); })); } normalizedMod.enable(); } return; } //If a paths config, then just load that file instead to //resolve the plugin, as it is built into that paths layer. if (bundleId) { this.map.url = context.nameToUrl(bundleId); this.load(); return; } load = bind(this, function (value) { this.init([], function () { return value; }, null, { enabled: true }); }); load.error = bind(this, function (err) { this.inited = true; this.error = err; err.requireModules = [id]; //Remove temp unnormalized modules for this module, //since they will never be resolved otherwise now. eachProp(registry, function (mod) { if (mod.map.id.indexOf(id + '_unnormalized') === 0) { cleanRegistry(mod.map.id); } }); onError(err); }); //Allow plugins to load other code without having to know the //context or how to 'complete' the load. load.fromText = bind(this, function (text, textAlt) { /*jslint evil: true */ var moduleName = map.name, moduleMap = makeModuleMap(moduleName), hasInteractive = useInteractive; //As of 2.1.0, support just passing the text, to reinforce //fromText only being called once per resource. Still //support old style of passing moduleName but discard //that moduleName in favor of the internal ref. if (textAlt) { text = textAlt; } //Turn off interactive script matching for IE for any define //calls in the text, then turn it back on at the end. if (hasInteractive) { useInteractive = false; } //Prime the system by creating a module instance for //it. getModule(moduleMap); //Transfer any config to this other module. if (hasProp(config.config, id)) { config.config[moduleName] = config.config[id]; } try { req.exec(text); } catch (e) { return onError(makeError('fromtexteval', 'fromText eval for ' + id + ' failed: ' + e, e, [id])); } if (hasInteractive) { useInteractive = true; } //Mark this as a dependency for the plugin //resource this.depMaps.push(moduleMap); //Support anonymous modules. context.completeLoad(moduleName); //Bind the value of that module to the value for this //resource ID. localRequire([moduleName], load); }); //Use parentName here since the plugin's name is not reliable, //could be some weird string with no path that actually wants to //reference the parentName's path. plugin.load(map.name, localRequire, load, config); })); context.enable(pluginMap, this); this.pluginMaps[pluginMap.id] = pluginMap; }, enable: function () { enabledRegistry[this.map.id] = this; this.enabled = true; //Set flag mentioning that the module is enabling, //so that immediate calls to the defined callbacks //for dependencies do not trigger inadvertent load //with the depCount still being zero. this.enabling = true; //Enable each dependency each(this.depMaps, bind(this, function (depMap, i) { var id, mod, handler; if (typeof depMap === 'string') { //Dependency needs to be converted to a depMap //and wired up to this module. depMap = makeModuleMap(depMap, (this.map.isDefine ? this.map : this.map.parentMap), false, !this.skipMap); this.depMaps[i] = depMap; handler = getOwn(handlers, depMap.id); if (handler) { this.depExports[i] = handler(this); return; } this.depCount += 1; on(depMap, 'defined', bind(this, function (depExports) { this.defineDep(i, depExports); this.check(); })); if (this.errback) { on(depMap, 'error', bind(this, this.errback)); } } id = depMap.id; mod = registry[id]; //Skip special modules like 'require', 'exports', 'module' //Also, don't call enable if it is already enabled, //important in circular dependency cases. if (!hasProp(handlers, id) && mod && !mod.enabled) { context.enable(depMap, this); } })); //Enable each plugin that is used in //a dependency eachProp(this.pluginMaps, bind(this, function (pluginMap) { var mod = getOwn(registry, pluginMap.id); if (mod && !mod.enabled) { context.enable(pluginMap, this); } })); this.enabling = false; this.check(); }, on: function (name, cb) { var cbs = this.events[name]; if (!cbs) { cbs = this.events[name] = []; } cbs.push(cb); }, emit: function (name, evt) { each(this.events[name], function (cb) { cb(evt); }); if (name === 'error') { //Now that the error handler was triggered, remove //the listeners, since this broken Module instance //can stay around for a while in the registry. delete this.events[name]; } } }; function callGetModule(args) { //Skip modules already defined. if (!hasProp(defined, args[0])) { getModule(makeModuleMap(args[0], null, true)).init(args[1], args[2]); } } function removeListener(node, func, name, ieName) { //Favor detachEvent because of IE9 //issue, see attachEvent/addEventListener comment elsewhere //in this file. if (node.detachEvent && !isOpera) { //Probably IE. If not it will throw an error, which will be //useful to know. if (ieName) { node.detachEvent(ieName, func); } } else { node.removeEventListener(name, func, false); } } /** * Given an event from a script node, get the requirejs info from it, * and then removes the event listeners on the node. * @param {Event} evt * @returns {Object} */ function getScriptData(evt) { //Using currentTarget instead of target for Firefox 2.0's sake. Not //all old browsers will be supported, but this one was easy enough //to support and still makes sense. var node = evt.currentTarget || evt.srcElement; //Remove the listeners once here. removeListener(node, context.onScriptLoad, 'load', 'onreadystatechange'); removeListener(node, context.onScriptError, 'error'); return { node: node, id: node && node.getAttribute('data-requiremodule') }; } function intakeDefines() { var args; //Any defined modules in the global queue, intake them now. takeGlobalQueue(); //Make sure any remaining defQueue items get properly processed. while (defQueue.length) { args = defQueue.shift(); if (args[0] === null) { return onError(makeError('mismatch', 'Mismatched anonymous define() module: ' + args[args.length - 1])); } else { //args are id, deps, factory. Should be normalized by the //define() function. callGetModule(args); } } } context = { config: config, contextName: contextName, registry: registry, defined: defined, urlFetched: urlFetched, defQueue: defQueue, Module: Module, makeModuleMap: makeModuleMap, nextTick: req.nextTick, onError: onError, /** * Set a configuration for the context. * @param {Object} cfg config object to integrate. */ configure: function (cfg) { //Make sure the baseUrl ends in a slash. if (cfg.baseUrl) { if (cfg.baseUrl.charAt(cfg.baseUrl.length - 1) !== '/') { cfg.baseUrl += '/'; } } //Save off the paths since they require special processing, //they are additive. var shim = config.shim, objs = { paths: true, bundles: true, config: true, map: true }; eachProp(cfg, function (value, prop) { if (objs[prop]) { if (!config[prop]) { config[prop] = {}; } mixin(config[prop], value, true, true); } else { config[prop] = value; } }); //Reverse map the bundles if (cfg.bundles) { eachProp(cfg.bundles, function (value, prop) { each(value, function (v) { if (v !== prop) { bundlesMap[v] = prop; } }); }); } //Merge shim if (cfg.shim) { eachProp(cfg.shim, function (value, id) { //Normalize the structure if (isArray(value)) { value = { deps: value }; } if ((value.exports || value.init) && !value.exportsFn) { value.exportsFn = context.makeShimExports(value); } shim[id] = value; }); config.shim = shim; } //Adjust packages if necessary. if (cfg.packages) { each(cfg.packages, function (pkgObj) { var location, name; pkgObj = typeof pkgObj === 'string' ? { name: pkgObj } : pkgObj; name = pkgObj.name; location = pkgObj.location; if (location) { config.paths[name] = pkgObj.location; } //Save pointer to main module ID for pkg name. //Remove leading dot in main, so main paths are normalized, //and remove any trailing .js, since different package //envs have different conventions: some use a module name, //some use a file name. config.pkgs[name] = pkgObj.name + '/' + (pkgObj.main || 'main') .replace(currDirRegExp, '') .replace(jsSuffixRegExp, ''); }); } //If there are any "waiting to execute" modules in the registry, //update the maps for them, since their info, like URLs to load, //may have changed. eachProp(registry, function (mod, id) { //If module already has init called, since it is too //late to modify them, and ignore unnormalized ones //since they are transient. if (!mod.inited && !mod.map.unnormalized) { mod.map = makeModuleMap(id); } }); //If a deps array or a config callback is specified, then call //require with those args. This is useful when require is defined as a //config object before require.js is loaded. if (cfg.deps || cfg.callback) { context.require(cfg.deps || [], cfg.callback); } }, makeShimExports: function (value) { function fn() { var ret; if (value.init) { ret = value.init.apply(global, arguments); } return ret || (value.exports && getGlobal(value.exports)); } return fn; }, makeRequire: function (relMap, options) { options = options || {}; function localRequire(deps, callback, errback) { var id, map, requireMod; if (options.enableBuildCallback && callback && isFunction(callback)) { callback.__requireJsBuild = true; } if (typeof deps === 'string') { if (isFunction(callback)) { //Invalid call return onError(makeError('requireargs', 'Invalid require call'), errback); } //If require|exports|module are requested, get the //value for them from the special handlers. Caveat: //this only works while module is being defined. if (relMap && hasProp(handlers, deps)) { return handlers[deps](registry[relMap.id]); } //Synchronous access to one module. If require.get is //available (as in the Node adapter), prefer that. if (req.get) { return req.get(context, deps, relMap, localRequire); } //Normalize module name, if it contains . or .. map = makeModuleMap(deps, relMap, false, true); id = map.id; if (!hasProp(defined, id)) { return onError(makeError('notloaded', 'Module name "' + id + '" has not been loaded yet for context: ' + contextName + (relMap ? '' : '. Use require([])'))); } return defined[id]; } //Grab defines waiting in the global queue. intakeDefines(); //Mark all the dependencies as needing to be loaded. context.nextTick(function () { //Some defines could have been added since the //require call, collect them. intakeDefines(); requireMod = getModule(makeModuleMap(null, relMap)); //Store if map config should be applied to this require //call for dependencies. requireMod.skipMap = options.skipMap; requireMod.init(deps, callback, errback, { enabled: true }); checkLoaded(); }); return localRequire; } mixin(localRequire, { isBrowser: isBrowser, /** * Converts a module name + .extension into an URL path. * *Requires* the use of a module name. It does not support using * plain URLs like nameToUrl. */ toUrl: function (moduleNamePlusExt) { var ext, index = moduleNamePlusExt.lastIndexOf('.'), segment = moduleNamePlusExt.split('/')[0], isRelative = segment === '.' || segment === '..'; //Have a file extension alias, and it is not the //dots from a relative path. if (index !== -1 && (!isRelative || index > 1)) { ext = moduleNamePlusExt.substring(index, moduleNamePlusExt.length); moduleNamePlusExt = moduleNamePlusExt.substring(0, index); } return context.nameToUrl(normalize(moduleNamePlusExt, relMap && relMap.id, true), ext, true); }, defined: function (id) { return hasProp(defined, makeModuleMap(id, relMap, false, true).id); }, specified: function (id) { id = makeModuleMap(id, relMap, false, true).id; return hasProp(defined, id) || hasProp(registry, id); } }); //Only allow undef on top level require calls if (!relMap) { localRequire.undef = function (id) { //Bind any waiting define() calls to this context, //fix for #408 takeGlobalQueue(); var map = makeModuleMap(id, relMap, true), mod = getOwn(registry, id); removeScript(id); delete defined[id]; delete urlFetched[map.url]; delete undefEvents[id]; //Clean queued defines too. Go backwards //in array so that the splices do not //mess up the iteration. eachReverse(defQueue, function(args, i) { if(args[0] === id) { defQueue.splice(i, 1); } }); if (mod) { //Hold on to listeners in case the //module will be attempted to be reloaded //using a different config. if (mod.events.defined) { undefEvents[id] = mod.events; } cleanRegistry(id); } }; } return localRequire; }, /** * Called to enable a module if it is still in the registry * awaiting enablement. A second arg, parent, the parent module, * is passed in for context, when this method is overridden by * the optimizer. Not shown here to keep code compact. */ enable: function (depMap) { var mod = getOwn(registry, depMap.id); if (mod) { getModule(depMap).enable(); } }, /** * Internal method used by environment adapters to complete a load event. * A load event could be a script load or just a load pass from a synchronous * load call. * @param {String} moduleName the name of the module to potentially complete. */ completeLoad: function (moduleName) { var found, args, mod, shim = getOwn(config.shim, moduleName) || {}, shExports = shim.exports; takeGlobalQueue(); while (defQueue.length) { args = defQueue.shift(); if (args[0] === null) { args[0] = moduleName; //If already found an anonymous module and bound it //to this name, then this is some other anon module //waiting for its completeLoad to fire. if (found) { break; } found = true; } else if (args[0] === moduleName) { //Found matching define call for this script! found = true; } callGetModule(args); } //Do this after the cycle of callGetModule in case the result //of those calls/init calls changes the registry. mod = getOwn(registry, moduleName); if (!found && !hasProp(defined, moduleName) && mod && !mod.inited) { if (config.enforceDefine && (!shExports || !getGlobal(shExports))) { if (hasPathFallback(moduleName)) { return; } else { return onError(makeError('nodefine', 'No define call for ' + moduleName, null, [moduleName])); } } else { //A script that does not call define(), so just simulate //the call for it. callGetModule([moduleName, (shim.deps || []), shim.exportsFn]); } } checkLoaded(); }, /** * Converts a module name to a file path. Supports cases where * moduleName may actually be just an URL. * Note that it **does not** call normalize on the moduleName, * it is assumed to have already been normalized. This is an * internal API, not a public one. Use toUrl for the public API. */ nameToUrl: function (moduleName, ext, skipExt) { var paths, syms, i, parentModule, url, parentPath, bundleId, pkgMain = getOwn(config.pkgs, moduleName); if (pkgMain) { moduleName = pkgMain; } bundleId = getOwn(bundlesMap, moduleName); if (bundleId) { return context.nameToUrl(bundleId, ext, skipExt); } //If a colon is in the URL, it indicates a protocol is used and it is just //an URL to a file, or if it starts with a slash, contains a query arg (i.e. ?) //or ends with .js, then assume the user meant to use an url and not a module id. //The slash is important for protocol-less URLs as well as full paths. if (req.jsExtRegExp.test(moduleName)) { //Just a plain path, not module name lookup, so just return it. //Add extension if it is included. This is a bit wonky, only non-.js things pass //an extension, this method probably needs to be reworked. url = moduleName + (ext || ''); } else { //A module that needs to be converted to a path. paths = config.paths; syms = moduleName.split('/'); //For each module name segment, see if there is a path //registered for it. Start with most specific name //and work up from it. for (i = syms.length; i > 0; i -= 1) { parentModule = syms.slice(0, i).join('/'); parentPath = getOwn(paths, parentModule); if (parentPath) { //If an array, it means there are a few choices, //Choose the one that is desired if (isArray(parentPath)) { parentPath = parentPath[0]; } syms.splice(0, i, parentPath); break; } } //Join the path parts together, then figure out if baseUrl is needed. url = syms.join('/'); url += (ext || (/^data\:|\?/.test(url) || skipExt ? '' : '.js')); url = (url.charAt(0) === '/' || url.match(/^[\w\+\.\-]+:/) ? '' : config.baseUrl) + url; } return config.urlArgs ? url + ((url.indexOf('?') === -1 ? '?' : '&') + config.urlArgs) : url; }, //Delegates to req.load. Broken out as a separate function to //allow overriding in the optimizer. load: function (id, url) { req.load(context, id, url); }, /** * Executes a module callback function. Broken out as a separate function * solely to allow the build system to sequence the files in the built * layer in the right sequence. * * @private */ execCb: function (name, callback, args, exports) { return callback.apply(exports, args); }, /** * callback for script loads, used to check status of loading. * * @param {Event} evt the event from the browser for the script * that was loaded. */ onScriptLoad: function (evt) { //Using currentTarget instead of target for Firefox 2.0's sake. Not //all old browsers will be supported, but this one was easy enough //to support and still makes sense. if (evt.type === 'load' || (readyRegExp.test((evt.currentTarget || evt.srcElement).readyState))) { //Reset interactive script so a script node is not held onto for //to long. interactiveScript = null; //Pull out the name of the module and the context. var data = getScriptData(evt); context.completeLoad(data.id); } }, /** * Callback for script errors. */ onScriptError: function (evt) { var data = getScriptData(evt); if (!hasPathFallback(data.id)) { return onError(makeError('scripterror', 'Script error for: ' + data.id, evt, [data.id])); } } }; context.require = context.makeRequire(); return context; } /** * Main entry point. * * If the only argument to require is a string, then the module that * is represented by that string is fetched for the appropriate context. * * If the first argument is an array, then it will be treated as an array * of dependency string names to fetch. An optional function callback can * be specified to execute when all of those dependencies are available. * * Make a local req variable to help Caja compliance (it assumes things * on a require that are not standardized), and to give a short * name for minification/local scope use. */ req = requirejs = function (deps, callback, errback, optional) { //Find the right context, use default var context, config, contextName = defContextName; // Determine if have config object in the call. if (!isArray(deps) && typeof deps !== 'string') { // deps is a config object config = deps; if (isArray(callback)) { // Adjust args if there are dependencies deps = callback; callback = errback; errback = optional; } else { deps = []; } } if (config && config.context) { contextName = config.context; } context = getOwn(contexts, contextName); if (!context) { context = contexts[contextName] = req.s.newContext(contextName); } if (config) { context.configure(config); } return context.require(deps, callback, errback); }; /** * Support require.config() to make it easier to cooperate with other * AMD loaders on globally agreed names. */ req.config = function (config) { return req(config); }; /** * Execute something after the current tick * of the event loop. Override for other envs * that have a better solution than setTimeout. * @param {Function} fn function to execute later. */ req.nextTick = typeof setTimeout !== 'undefined' ? function (fn) { setTimeout(fn, 4); } : function (fn) { fn(); }; /** * Export require as a global, but only if it does not already exist. */ if (!require) { require = req; } req.version = version; //Used to filter out dependencies that are already paths. req.jsExtRegExp = /^\/|:|\?|\.js$/; req.isBrowser = isBrowser; s = req.s = { contexts: contexts, newContext: newContext }; //Create default context. req({}); //Exports some context-sensitive methods on global require. each([ 'toUrl', 'undef', 'defined', 'specified' ], function (prop) { //Reference from contexts instead of early binding to default context, //so that during builds, the latest instance of the default context //with its config gets used. req[prop] = function () { var ctx = contexts[defContextName]; return ctx.require[prop].apply(ctx, arguments); }; }); if (isBrowser) { head = s.head = document.getElementsByTagName('head')[0]; //If BASE tag is in play, using appendChild is a problem for IE6. //When that browser dies, this can be removed. Details in this jQuery bug: //http://dev.jquery.com/ticket/2709 baseElement = document.getElementsByTagName('base')[0]; if (baseElement) { head = s.head = baseElement.parentNode; } } /** * Any errors that require explicitly generates will be passed to this * function. Intercept/override it if you want custom error handling. * @param {Error} err the error object. */ req.onError = defaultOnError; /** * Creates the node for the load command. Only used in browser envs. */ req.createNode = function (config, moduleName, url) { var node = config.xhtml ? document.createElementNS('http://www.w3.org/1999/xhtml', 'html:script') : document.createElement('script'); node.type = config.scriptType || 'text/javascript'; node.charset = 'utf-8'; node.async = true; return node; }; /** * Does the request to load a module for the browser case. * Make this a separate function to allow other environments * to override it. * * @param {Object} context the require context to find state. * @param {String} moduleName the name of the module. * @param {Object} url the URL to the module. */ req.load = function (context, moduleName, url) { var config = (context && context.config) || {}, node; if (isBrowser) { //In the browser so use a script tag node = req.createNode(config, moduleName, url); node.setAttribute('data-requirecontext', context.contextName); node.setAttribute('data-requiremodule', moduleName); //Set up load listener. Test attachEvent first because IE9 has //a subtle issue in its addEventListener and script onload firings //that do not match the behavior of all other browsers with //addEventListener support, which fire the onload event for a //script right after the script execution. See: //https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution //UNFORTUNATELY Opera implements attachEvent but does not follow the script //script execution mode. if (node.attachEvent && //Check if node.attachEvent is artificially added by custom script or //natively supported by browser //read https://github.com/jrburke/requirejs/issues/187 //if we can NOT find [native code] then it must NOT natively supported. //in IE8, node.attachEvent does not have toString() //Note the test for "[native code" with no closing brace, see: //https://github.com/jrburke/requirejs/issues/273 !(node.attachEvent.toString && node.attachEvent.toString().indexOf('[native code') < 0) && !isOpera) { //Probably IE. IE (at least 6-8) do not fire //script onload right after executing the script, so //we cannot tie the anonymous define call to a name. //However, IE reports the script as being in 'interactive' //readyState at the time of the define call. useInteractive = true; node.attachEvent('onreadystatechange', context.onScriptLoad); //It would be great to add an error handler here to catch //404s in IE9+. However, onreadystatechange will fire before //the error handler, so that does not help. If addEventListener //is used, then IE will fire error before load, but we cannot //use that pathway given the connect.microsoft.com issue //mentioned above about not doing the 'script execute, //then fire the script load event listener before execute //next script' that other browsers do. //Best hope: IE10 fixes the issues, //and then destroys all installs of IE 6-9. //node.attachEvent('onerror', context.onScriptError); } else { node.addEventListener('load', context.onScriptLoad, false); node.addEventListener('error', context.onScriptError, false); } node.src = url; //For some cache cases in IE 6-8, the script executes before the end //of the appendChild execution, so to tie an anonymous define //call to the module name (which is stored on the node), hold on //to a reference to this node, but clear after the DOM insertion. currentlyAddingScript = node; if (baseElement) { head.insertBefore(node, baseElement); } else { head.appendChild(node); } currentlyAddingScript = null; return node; } else if (isWebWorker) { try { //In a web worker, use importScripts. This is not a very //efficient use of importScripts, importScripts will block until //its script is downloaded and evaluated. However, if web workers //are in play, the expectation that a build has been done so that //only one script needs to be loaded anyway. This may need to be //reevaluated if other use cases become common. importScripts(url); //Account for anonymous modules context.completeLoad(moduleName); } catch (e) { context.onError(makeError('importscripts', 'importScripts failed for ' + moduleName + ' at ' + url, e, [moduleName])); } } }; function getInteractiveScript() { if (interactiveScript && interactiveScript.readyState === 'interactive') { return interactiveScript; } eachReverse(scripts(), function (script) { if (script.readyState === 'interactive') { return (interactiveScript = script); } }); return interactiveScript; } //Look for a data-main script attribute, which could also adjust the baseUrl. if (isBrowser && !cfg.skipDataMain) { //Figure out baseUrl. Get it from the script tag with require.js in it. eachReverse(scripts(), function (script) { //Set the 'head' where we can append children by //using the script's parent. if (!head) { head = script.parentNode; } //Look for a data-main attribute to set main script for the page //to load. If it is there, the path to data main becomes the //baseUrl, if it is not already set. dataMain = script.getAttribute('data-main'); if (dataMain) { //Preserve dataMain in case it is a path (i.e. contains '?') mainScript = dataMain; //Set final baseUrl if there is not already an explicit one. if (!cfg.baseUrl) { //Pull off the directory of data-main for use as the //baseUrl. src = mainScript.split('/'); mainScript = src.pop(); subPath = src.length ? src.join('/') + '/' : './'; cfg.baseUrl = subPath; } //Strip off any trailing .js since mainScript is now //like a module name. mainScript = mainScript.replace(jsSuffixRegExp, ''); //If mainScript is still a path, fall back to dataMain if (req.jsExtRegExp.test(mainScript)) { mainScript = dataMain; } //Put the data-main script in the files to load. cfg.deps = cfg.deps ? cfg.deps.concat(mainScript) : [mainScript]; return true; } }); } /** * The function that handles definitions of modules. Differs from * require() in that a string for the module should be the first argument, * and the function to execute after dependencies are loaded should * return a value to define the module corresponding to the first argument's * name. */ define = function (name, deps, callback) { var node, context; //Allow for anonymous modules if (typeof name !== 'string') { //Adjust args appropriately callback = deps; deps = name; name = null; } //This module may not have dependencies if (!isArray(deps)) { callback = deps; deps = null; } //If no name, and callback is a function, then figure out if it a //CommonJS thing with dependencies. if (!deps && isFunction(callback)) { deps = []; //Remove comments from the callback string, //look for require calls, and pull them into the dependencies, //but only if there are function args. if (callback.length) { callback .toString() .replace(commentRegExp, '') .replace(cjsRequireRegExp, function (match, dep) { deps.push(dep); }); //May be a CommonJS thing even without require calls, but still //could use exports, and module. Avoid doing exports and module //work though if it just needs require. //REQUIRES the function to expect the CommonJS variables in the //order listed below. deps = (callback.length === 1 ? ['require'] : ['require', 'exports', 'module']).concat(deps); } } //If in IE 6-8 and hit an anonymous define() call, do the interactive //work. if (useInteractive) { node = currentlyAddingScript || getInteractiveScript(); if (node) { if (!name) { name = node.getAttribute('data-requiremodule'); } context = contexts[node.getAttribute('data-requirecontext')]; } } //Always save off evaluating the def call until the script onload handler. //This allows multiple modules to be in a file without prematurely //tracing dependencies, and allows for anonymous module support, //where the module name is not known until the script onload event //occurs. If no context, use the global queue, and get it processed //in the onscript load callback. (context ? context.defQueue : globalDefQueue).push([name, deps, callback]); }; define.amd = { jQuery: true }; /** * Executes the text. Normally just uses eval, but can be modified * to use a better, environment-specific call. Only used for transpiling * loader plugins, not for plain JS modules. * @param {String} text the text to execute/evaluate. */ req.exec = function (text) { /*jslint evil: true */ return eval(text); }; //Set up with config info. req(cfg); }(this)); ================================================ FILE: demo/kitchen-sink/styles.css ================================================ html { height: 100%; width: 100%; overflow: hidden; } body { overflow: hidden; margin: 0; padding: 0; height: 100%; width: 100%; font-family: Arial, Helvetica, sans-serif, Tahoma, Verdana, sans-serif; font-size: 12px; background: rgb(14, 98, 165); color: white; } #c9-logo, #ace-logo { padding: 0; border: none; } #editor-container { position: absolute; top: 0px; left: 280px; bottom: 0px; right: 0px; background: white; } #controls { padding: 5px; } #controls td { text-align: right; } #controls td + td { text-align: left; } .ace_status-indicator { color: gray; position: absolute; right: 0; border-left: 1px solid; } /* .ace_text-input { z-index: 10!important; opacity: 1!important; background: rgb(84, 0, 255)!important; color: rgb(255, 255, 255)!important; width: 10em!important; }*/ ================================================ FILE: demo/kitchen-sink/token_tooltip.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("ace/lib/dom"); var oop = require("ace/lib/oop"); var event = require("ace/lib/event"); var Range = require("ace/range").Range; var Tooltip = require("ace/tooltip").Tooltip; function TokenTooltip (editor) { if (editor.tokenTooltip) return; Tooltip.call(this, editor.container); editor.tokenTooltip = this; this.editor = editor; this.update = this.update.bind(this); this.onMouseMove = this.onMouseMove.bind(this); this.onMouseOut = this.onMouseOut.bind(this); event.addListener(editor.renderer.scroller, "mousemove", this.onMouseMove); event.addListener(editor.renderer.content, "mouseout", this.onMouseOut); } oop.inherits(TokenTooltip, Tooltip); (function(){ this.token = {}; this.range = new Range(); this.update = function() { this.$timer = null; var r = this.editor.renderer; if (this.lastT - (r.timeStamp || 0) > 1000) { r.rect = null; r.timeStamp = this.lastT; this.maxHeight = window.innerHeight; this.maxWidth = window.innerWidth; } var canvasPos = r.rect || (r.rect = r.scroller.getBoundingClientRect()); var offset = (this.x + r.scrollLeft - canvasPos.left - r.$padding) / r.characterWidth; var row = Math.floor((this.y + r.scrollTop - canvasPos.top) / r.lineHeight); var col = Math.round(offset); var screenPos = {row: row, column: col, side: offset - col > 0 ? 1 : -1}; var session = this.editor.session; var docPos = session.screenToDocumentPosition(screenPos.row, screenPos.column); var token = session.getTokenAt(docPos.row, docPos.column); if (!token && !session.getLine(docPos.row)) { token = { type: "", value: "", state: session.bgTokenizer.getState(0) }; } if (!token) { session.removeMarker(this.marker); this.hide(); return; } var tokenText = token.type; if (token.state) tokenText += "|" + token.state; if (token.merge) tokenText += "\n merge"; if (token.stateTransitions) tokenText += "\n " + token.stateTransitions.join("\n "); if (this.tokenText != tokenText) { this.setText(tokenText); this.width = this.getWidth(); this.height = this.getHeight(); this.tokenText = tokenText; } this.show(null, this.x, this.y); this.token = token; session.removeMarker(this.marker); this.range = new Range(docPos.row, token.start, docPos.row, token.start + token.value.length); this.marker = session.addMarker(this.range, "ace_bracket", "text"); }; this.onMouseMove = function(e) { this.x = e.clientX; this.y = e.clientY; if (this.isOpen) { this.lastT = e.timeStamp; this.setPosition(this.x, this.y); } if (!this.$timer) this.$timer = setTimeout(this.update, 100); }; this.onMouseOut = function(e) { if (e && e.currentTarget.contains(e.relatedTarget)) return; this.hide(); this.editor.session.removeMarker(this.marker); this.$timer = clearTimeout(this.$timer); }; this.setPosition = function(x, y) { if (x + 10 + this.width > this.maxWidth) x = window.innerWidth - this.width - 10; if (y > window.innerHeight * 0.75 || y + 20 + this.height > this.maxHeight) y = y - this.height - 30; Tooltip.prototype.setPosition.call(this, x + 10, y + 20); }; this.destroy = function() { this.onMouseOut(); event.removeListener(this.editor.renderer.scroller, "mousemove", this.onMouseMove); event.removeListener(this.editor.renderer.content, "mouseout", this.onMouseOut); delete this.editor.tokenTooltip; }; }).call(TokenTooltip.prototype); exports.TokenTooltip = TokenTooltip; }); ================================================ FILE: demo/kitchen-sink/util.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("ace/lib/dom"); var event = require("ace/lib/event"); var EditSession = require("ace/edit_session").EditSession; var UndoManager = require("ace/undomanager").UndoManager; var Renderer = require("ace/virtual_renderer").VirtualRenderer; var Editor = require("ace/editor").Editor; var MultiSelect = require("ace/multi_select").MultiSelect; var urlOptions = {} try { window.location.search.slice(1).split(/[&]/).forEach(function(e) { var parts = e.split("="); urlOptions[decodeURIComponent(parts[0])] = decodeURIComponent(parts[1]); }); } catch(e) { console.error(e); } exports.createEditor = function(el) { return new Editor(new Renderer(el)); }; exports.createSplitEditor = function(el) { if (typeof(el) == "string") el = document.getElementById(el); var e0 = document.createElement("div"); var s = document.createElement("splitter"); var e1 = document.createElement("div"); el.appendChild(e0); el.appendChild(e1); el.appendChild(s); e0.style.position = e1.style.position = s.style.position = "absolute"; el.style.position = "relative"; var split = {$container: el}; split.editor0 = split[0] = new Editor(new Renderer(e0)); split.editor1 = split[1] = new Editor(new Renderer(e1)); split.splitter = s; s.ratio = 0.5; split.resize = function resize(){ var height = el.parentNode.clientHeight - el.offsetTop; var total = el.clientWidth; var w1 = total * s.ratio; var w2 = total * (1- s.ratio); s.style.left = w1 - 1 + "px"; s.style.height = el.style.height = height + "px"; var st0 = split[0].container.style; var st1 = split[1].container.style; st0.width = w1 + "px"; st1.width = w2 + "px"; st0.left = 0 + "px"; st1.left = w1 + "px"; st0.top = st1.top = "0px"; st0.height = st1.height = height + "px"; split[0].resize(); split[1].resize(); }; split.onMouseDown = function(e) { var rect = el.getBoundingClientRect(); var x = e.clientX; var y = e.clientY; var button = e.button; if (button !== 0) { return; } var onMouseMove = function(e) { x = e.clientX; y = e.clientY; }; var onResizeEnd = function(e) { clearInterval(timerId); }; var onResizeInterval = function() { s.ratio = (x - rect.left) / rect.width; split.resize(); }; event.capture(s, onMouseMove, onResizeEnd); var timerId = setInterval(onResizeInterval, 40); return e.preventDefault(); }; event.addListener(s, "mousedown", split.onMouseDown); event.addListener(window, "resize", split.resize); split.resize(); return split; }; /***************************/ exports.stripLeadingComments = function(str) { if(str.slice(0,2)=='/*') { var j = str.indexOf('*/')+2; str = str.substr(j); } return str.trim() + "\n"; }; /***************************/ exports.saveOption = function(el, val) { if (!el.onchange && !el.onclick) return; if ("checked" in el) { if (val !== undefined) el.checked = val; localStorage && localStorage.setItem(el.id, el.checked ? 1 : 0); } else { if (val !== undefined) el.value = val; localStorage && localStorage.setItem(el.id, el.value); } }; exports.bindCheckbox = function(id, callback, noInit) { if (typeof id == "string") var el = document.getElementById(id); else { var el = id; id = el.id; } var el = document.getElementById(id); if (urlOptions[id]) el.checked = urlOptions[id] == "1"; else if (localStorage && localStorage.getItem(id)) el.checked = localStorage.getItem(id) == "1"; var onCheck = function() { callback(!!el.checked); exports.saveOption(el); }; el.onclick = onCheck; noInit || onCheck(); return el; }; exports.bindDropdown = function(id, callback, noInit) { if (typeof id == "string") var el = document.getElementById(id); else { var el = id; id = el.id; } if (urlOptions[id]) el.value = urlOptions[id]; else if (localStorage && localStorage.getItem(id)) el.value = localStorage.getItem(id); var onChange = function() { callback(el.value); exports.saveOption(el); }; el.onchange = onChange; noInit || onChange(); }; exports.fillDropdown = function(el, values) { if (typeof el == "string") el = document.getElementById(el); dropdown(values).forEach(function(e) { el.appendChild(e); }); }; function elt(tag, attributes, content) { var el = dom.createElement(tag); if (typeof content == "string") { el.appendChild(document.createTextNode(content)); } else if (content) { content.forEach(function(ch) { el.appendChild(ch); }); } for (var i in attributes) el.setAttribute(i, attributes[i]); return el; } function optgroup(values) { return values.map(function(item) { if (typeof item == "string") item = {name: item, caption: item}; return elt("option", {value: item.value || item.name}, item.caption || item.desc); }); } function dropdown(values) { if (Array.isArray(values)) return optgroup(values); return Object.keys(values).map(function(i) { return elt("optgroup", {"label": i}, optgroup(values[i])); }); } }); ================================================ FILE: demo/modelist.html ================================================ ACE Editor Modelist Demo
    
        
    
    
    
    
    
    
    
    
    ================================================
    FILE: demo/r.js/build.js
    ================================================
    ({
        optimize: "none",
        preserveLicenseComments: false,
        name: "node_modules/almond/almond",
        baseUrl: "../../",
        paths: {
            ace : "lib/ace",
            demo: "demo/kitchen-sink"        
        },
        packages: [
        ],
        include: [
            "ace/ace"
        ],
        exclude: [
        ],
        out: "./packed.js",
        useStrict: true,
        wrap: false
    })
    
    ================================================
    FILE: demo/r.js/editor.html
    ================================================
    
    
    
    
        Editor
            
    
    
        
        
            
    demo showing Ace usage with r.js: install r.js and almond and run `r.js -o demo/r.js/build.js` note that you also need ace/build/src to lazy load modes and themes require("ace/config").set("basePath", "../../build/src"); require("ace/config").set("packaged", true);
    ================================================ FILE: demo/requirejs+build.html ================================================ Editor
    function foo(items) {
        var i;
        for (i = 0; i < items.length; i++) {
            alert("Ace Rocks " + items[i]);
        }
    }
    ================================================ FILE: demo/scrollable-page.html ================================================ Editor
    scroll down ⇓
    function foo(items) {
        var i;
        for (i = 0; i < items.length; i++) {
            alert("Ace Rocks " + items[i]);
        }
    
    }
    press F11 to switch to fullscreen mode
    +
    ================================================ FILE: demo/settings_menu.html ================================================ Editor
    
        
    
    
    
    
    
    
    
    
    ================================================
    FILE: demo/show_own_source.js
    ================================================
    if (typeof ace == "undefined" && typeof require == "undefined") {
        document.body.innerHTML = "

    couldn't find ace.js file,
    " + "to build it run node Makefile.dryice.js full" } else if (typeof ace == "undefined" && typeof require != "undefined") { require(["ace/ace"], setValue) } else { require = ace.require; setValue() } function setValue() { require("ace/lib/net").get(document.baseURI, function(t){ var el = document.getElementById("editor"); el.env.editor.setValue(t, 1); }) } ================================================ FILE: demo/static-highlighter/client.html ================================================ Static Code highlighter using Ace

    Client Side Syntax Highlighting

    Syntax highlighting using Ace language modes and themes.

    ================================================ FILE: demo/static-highlighter/server.js ================================================ /** * Simple node.js server, which generates the synax highlighted version of itself * using the Ace modes and themes on the server and serving a static web page. */ // include ace search path and modules require("amd-loader"); var http = require("http"); var fs = require("fs"); var resolve = require("path").resolve; // load the highlighter and the desired mode and theme var highlighter = require("../../lib/ace/ext/static_highlight"); var JavaScriptMode = require("../../lib/ace/mode/javascript").Mode; var theme = require("../../lib/ace/theme/twilight"); var port = process.env.PORT || 2222; http.createServer(function(req, res) { var url = req.url; var path = /[^#?\x00]*/.exec(url)[0]; var root = resolve(__dirname + "/../../").replace(/\\/g, "/"); path = resolve(root + "/" + path).replace(/\\/g, "/"); if (path.indexOf(root + "/") != 0) path = __filename; res.writeHead(200, {"Content-Type": "text/html; charset=utf-8"}); fs.readFile(path, "utf8", function(err, data) { if (err) data = err.message; var highlighted = highlighter.render(data, new JavaScriptMode(), theme); res.end( '\n' + '\n' + highlighted.html + '' ); }); }).listen(port); console.log("Listening on port " + port); ================================================ FILE: demo/static-highlighter.html ================================================ Static Code highlighter using Ace

    Client Side Syntax Highlighting

    Syntax highlighting using Ace language modes and themes.

    .code { width: 50%; white-space: pre-wrap; border: solid lightgrey 1px }
    function wobble (flam) {
        return flam.wobbled = true;
    }
    
    
    --[[-- num_args takes in 5.1 byte code and extracts the number of arguments from its function header. --]]-- function int(t) return t:byte(1) + t:byte(2) * 0x100 + t:byte(3) * 0x10000 + t:byte(4) * 0x1000000 end function num_args(func) local dump = string.dump(func) local offset, cursor = int(dump:sub(13)), offset + 26 --Get the params and var flag (whether there's a ... in the param) return dump:sub(cursor):byte(), dump:sub(cursor+1):byte() end
    ================================================ FILE: demo/statusbar.html ================================================ ACE Editor StatusBar Demo
    
    
    ace rocks!
    ================================================ FILE: demo/xml.xml ================================================ ACE Autocompletion demo
    
    
        
        
    
        
    
    
    
    
    ================================================
    FILE: doc/README.md
    ================================================
    # Introduction
    
    The API doc build takes a look a source Javascript files in the _lib_ directory, and turns it into HTML output in the _api_ directory. It uses [Panino](https://github.com/gjtorikian/panino-docs) to perform the conversion.
    
    For any questions on the build system, please see that repo.
    
    # Building
    
    In the root directory, just run:
    
        make doc
    
    In this directory, just run:
    
        npm install
        node build.js
    
    
    
    ================================================
    FILE: doc/additionalObjs.json
    ================================================
    {
    	"Array" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Array",
    	"Boolean" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Boolean",
    	"Date" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date",
    	"Error" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Error",
    	"EvalError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/EvalError",
    	"RangeError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RangeError",
    	"ReferenceError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/ReferenceError",
    	"SyntaxError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/SyntaxError",
    	"TypeError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/TypeError",
    	"URIError" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/URIError",
    	"Function" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Function",
    	"Infinity" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Infinity",
    	"JSON" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/JSON",
    	"Math" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Math",
    	"NaN" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/NaN",
    	"Number" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Number",
    	"Object" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object",
    	"RegExp" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/RegExp",
    	"String" : "https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String",
        
        "DOMElement": "https://developer.mozilla.org/en/DOM/element",
        "Event": "https://github.com/ajaxorg/ace/blob/master/lib/ace/lib/event.js",
        "TextMode": "https://github.com/ajaxorg/ace/blob/master/lib/ace/mode/text.js",
        "KeyBinding": "https://github.com/ajaxorg/ace/blob/master/lib/ace/keyboard/keybinding.js",
        "Cursor": "https://github.com/ajaxorg/ace/blob/master/lib/ace/layer/cursor.js"
    }
    
    ================================================
    FILE: doc/build.js
    ================================================
    var fs = require("fs");
    var path = require("path");
    var panino = require("panino");
    var srcPath = __dirname + "/../lib/ace";
    var buildType = process.argv.splice(2)[0];
    
    var options = {
      title       : "Ace API",
      parseType   : "jsd",
      linkFormat  : function(linkHtml) {
          var href = linkHtml.href;
          var o = href.match(/(.+)\.html(#.+)/);
          var c = href.match(/#(.+)/);
          
          if ( o !== null ) {
              href = href.replace(href, '#nav=api&api=' + o[1]);// + '§ion=' + o[2]);
          }
          
          linkHtml.href = href;
          
          return linkHtml;
      },
      output      : "../api/",
      outputAssets : "../api/resources",
      skin        : "./template/jade/layout.jade",
      assets      : "./template/resources",
      additionalObjs : "./additionalObjs.json",
      exclude     : ["**/*_test.js", "**/mode/**", "default_commands.js", "multi_select_commands.js", "**/test/**", "**/theme/**", "**/worker/**"],
      index       : "./index.md"
    };
    
    files = [srcPath];
    
    panino.parse(files, options, function (err, ast) {
      if (err) {
        console.error(err);
        process.exit(1);
      }
      
      panino.render(buildType || 'html', ast, options, function (err) {
        if (err) {
          console.error(err);
          process.exit(1);
        }
        
        /*fs.readdir(options.output, function (err, files) {
            files.forEach(function(file) {
                if (file.match(/\.html$/)) {
                    var outFile = options.output + "/" + file;
                    fs.readFile(outFile, "utf8", function(err, data) {
                        var otherPageRegExp = new RegExp('=2.2.0",
            "asset-smasher": "0.2.0"
        }
    }
    
    ================================================
    FILE: doc/site/iphone.css
    ================================================
    #wrapper {
        position:relative;
        overflow:hidden;
    }
    
    #wrapper .content .column1 {
        margin:0 16px 0 15px;
    }
    
    #header .content .signature {
        font-size:18px;
        bottom:0;
    }
    
    UL.menu-list LI {
        font-size:22px;
    }
    
    UL.menu-footer LI {
        font-size:22px;
    }
    
    PRE{
        font-size:22px;
    }
    
    ================================================
    FILE: doc/site/js/ga.js
    ================================================
     var _gaq = _gaq || [];
     _gaq.push(['_setAccount', 'UA-31998201-1']);
     _gaq.push(['_trackPageview']);
     
     (function() {
       var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
       ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
       var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
     })();
    
    ================================================
    FILE: doc/site/js/main.js
    ================================================
    var editor;
    var embedded_editor;
    $(function() {
        if (typeof ace !== "undefined") {
            ace.config.set("workerPath", "build/src-min");
            editor = ace.edit("ace_editor_demo");
            editor.container.style.opacity = "";
            embedded_editor = ace.edit("embedded_ace_code");
            embedded_editor.container.style.opacity = "";
            embedded_editor.session.setMode("ace/mode/html");
            embedded_editor.setAutoScrollEditorIntoView(true);
            embedded_editor.setOption("maxLines", 40);
            
            editor.setOptions({
                maxLines: 30,
                mode: "ace/mode/javascript",
                autoScrollEditorIntoView: true
            });
            
            ace.config.loadModule("ace/ext/emmet", function() {
                ace.require("ace/lib/net").loadScript("http://cloud9ide.github.io/emmet-core/emmet.js", function() {
                    embedded_editor.setOption("enableEmmet", true);
                    editor.setOption("enableEmmet", true);
                });
            });
            
            ace.config.loadModule("ace/ext/language_tools", function() {
                embedded_editor.setOptions({
                    enableSnippets: true,
                    enableBasicAutocompletion: true
                });
                editor.setOptions({
                    enableSnippets: true,
                    enableBasicAutocompletion: true
                });
            });
        } else {
            document.body.insertAdjacentHTML("afterbegin", '
    \
    \ \ Oh No! Couldn\'t load build/src/ace.js.
    \ You can build it by running npm install ; node Makefile.dryice.js
    \ Or download older version by running git submodule update --init --recursive
    \
    \
    '); } $("ul.menu-list").mousedown(function(e) { if (e.button === 1) { e.preventDefault(); } }); $("ul.menu-list li").click("click auxclick", function(e) { if (e.target.tagName !== "A") { var href = $(this).find("a").attr("href"); if (e.originalEvent.button == 1) window.open(href, "_blank"); else if (e.originalEvent.button == 0) window.location = href; } }); // used when page is access directly function magicClickInterceptor(e) { e.preventDefault(); var state = {}; state.api = $(this).attr("href").substring(6, $(this).attr("href").length - 5); $.bbq.pushState(state); var _self = $(this); $("#apiHolder").load($(this).attr("href") + " #documentation", function(){ $("#apiHolder").removeClass("apiIntro").removeClass("span9"); $("#documentation").removeClass("span9").addClass("span7"); ux(); setupClicker(); // handles dropping in from new link var section = $.bbq.getState("section"); if (section) { $("li#dropdown_" + section.replace(/\./g, '\\.') + " a").triggerHandler('click'); } //setupDisqus(_self.attr("href")); }); } $('.menu-item a').click(magicClickInterceptor); $('a.argument').click(magicClickInterceptor); $('a.external').click(function(e) { e.preventDefault(); }); var tabs = $("#tabnav"), tab_a_selector = "a"; var firstLoad = true; tabs.find(tab_a_selector).click(function(e) { e.preventDefault(); if ($(this).attr("href") === "/") { window.location = "http://ace.ajax.org"; return; } if ($(this).attr("href").indexOf("#api") === 0) { $("#top_container").addClass("collapse"); scrollIntoPosition(null, 0); } else if ($(this).is(":visible")) { if (firstLoad) { firstLoad = false; setTimeout(function() { $("#top_container").removeClass("collapse"); scrollIntoPosition(e.target); }, 700); } else { $("#top_container").removeClass("collapse"); scrollIntoPosition(e.target); } } function scrollIntoPosition(el, overridePosition) { if (typeof overridePosition !== "undefined") { $("body").stop().animate({ scrollTop: overridePosition }, 400); } else if ($("body").scrollTop() > 345) { $("body").stop().animate({ scrollTop: ($(el).offset().top - 10) }, 400); } } $(this).tab("show"); var state = {}; state.nav = $(this).attr("href").substr(1); var oldState = $.bbq.getState("nav") || "about"; if (state.nav != oldState) $.bbq.pushState(state); }); $('#tabnav a[data-toggle="tab"]').on('shown', function (e) { $(".tab-content .tab-pane.active .ace_editor").each(function(i, el){ el.env.onResize(); }); }); $(window).on("hashchange", function(e) { _gaq.push(['_trackPageview',location.pathname + location.search + location.hash]); tabs.each(function() { var idx = $.bbq.getState("nav") || "about"; var section = e.fragment.split("&")[1] || ""; $(this).find(tab_a_selector + "[href='#" + idx + "']").triggerHandler('click'); // handles dropping in from new link var api = $.bbq.getState("api"); if (api) { $(tab_a_selector + "[href='./api/" + api + ".html']").triggerHandler('click'); } }); }).trigger("hashchange"); highlight(); }); function highlight() { var highlighter = ace.require("ace/ext/static_highlight") var dom = ace.require("ace/lib/dom") function qsa(sel) { var els = document.querySelectorAll(sel); var result = []; for (var i = 0, l = els.length; i < l; i++) result[i] = els[i]; return result; } qsa("code[class]").forEach(function(el) { var m = el.className.match(/language-(\w+)|(javascript)/); if (!m) return var mode = "ace/mode/" + (m[1] || m[2]); highlighter.highlight(el, {mode: mode, theme: "ace/theme/xcode"}) }); } ================================================ FILE: doc/site/style.css ================================================ body { margin:0; padding:0; background-color:#e6f5fc; font-family: Helvetica, Arial; } #ace_editor_demo, #embedded_ace_code { height: 275px; border: 1px solid #DDD; border-radius: 4px; border-bottom-right-radius: 0px; margin-top: 5px; } #embedded_ace_code { height: 525px; } h1, h2, h3, h4, h5, h6 { font-family: Helvetica; font-weight: 100; margin:0; padding:0; } h2, h3, h4, h5, h6 { padding-top: 30px; border-bottom: 1px solid #bedaea; } H2 { font-size:28px; color:#263842; padding-bottom:6px; } H3 { font-size:22px; color:#253741; margin-bottom:8px; } H4 { font-size:21px; color:#222222; margin-bottom:8px; } P { padding:13px 0; margin:0; line-height:21px; font-size: 15px; } UL{ font-size: 15px; } #header { height: 93px; position: relative; background: url(images/background.png) repeat-x 0 0; border-bottom: 1px solid #C9E8FA; margin-top: 40px; } #header .content .signature { font-family:Trebuchet MS; font-size:11px; color:#ebe4d6; position:absolute; bottom:5px; right:42px; letter-spacing : 1px; } .content { width:970px; position:relative; margin:0 auto; } #header .content { height: 100%; z-index: 90000; } #header .content .logo { width: 141px; height: 92px; background: url(images/logo_half.png) no-repeat 0 0; position: absolute; top: -14px; left: 0; } #header .content .title { width: 605px; height: 58px; background: url(images/ace.png) no-repeat 0 0; position: absolute; top: 22px; left: 329px; } #wrapper { background:url(images/body_background.png) repeat-x 0 -15px; min-height:250px; } #wrapper .content { font-family:Arial; font-size:14px; color:#222222; width: 960px; } #wrapper .content .column1 { position:relative; overflow:hidden; float:left; width:315px; margin-right:31px; } #wrapper .content .column2 { position:relative; overflow:hidden; float:left; /*width:600px;*/ } #top_container h1 { font-size: 68px; line-height: 60px; width: 515px; float: left; font-weight: 100; font-family: Helvetica; padding: 65px 0 0 14px; color: #333; } #top_container { background: url(images/header-bg.png) 0 0; overflow: hidden; padding: 11px 36px 19px 40px; height: 267px; -webkit-transition: height 0.4s ease-out, opacity 0.4s ease-out, padding 0.4s ease-out, margin 0.4s ease-out; -moz-transition: height 0.4s ease-out, opacity 0.4s ease-out, padding 0.4s ease-out, margin 0.4s ease-out; opacity: 1; margin-top: 25px; } #top_container.collapse { padding: 0px; height: 0px; opacity: 0; margin: 0; } #page_logo { padding: 35px 0 15px 0; width: 350px; float: right; text-align: center; height: 220px; } .fork_on_github { width:310px; height:80px; background:url(images/fork_on_github.png) no-repeat 0 0; position:relative; overflow:hidden; margin-top:49px; cursor:pointer; } .fork_on_github:hover { background-position:0 -80px; } .divider { height: 1px; background-color:#bedaea; margin-bottom:3px; } .menu, .site-menu { padding: 25px 0 0 35px; } UL.content-list { padding: 15px 0 15px 20px; margin:0; } UL.content-list li { padding-left: 10px; padding-bottom: 3px; } ul.menu-list { padding: 15px 0; margin: 0 0 20px 0; list-style-type: none; line-height: 16px; overflow: auto; } ul.menu-list li { color: #2557B4; font-family: Helvetica, Trebuchet MS; font-size: 12px; padding: 5px; cursor: pointer; display: block; float: left; margin-right: 15px; margin-bottom: 20px; width: 100px; height: 90px; border-radius: 5px; position: relative; background: rgba(255, 255, 255, 0.7); margin-left: 22px; margin-top: 20px; box-shadow: 0 0 4px rgba(0, 0, 0, 0.1); -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.1); -webkit-transition: box-shadow 0.4s; -moz-transition: box-shadow 0.4s; border: 1px solid #999; background-image: -webkit-repeating-linear-gradient(left, hsla(0,0%,100%,0) 0%, hsla(0,0%,100%,0) 6%, hsla(0,0%,100%, .1) 7.5%), -webkit-repeating-linear-gradient(left, hsla(0,0%, 0%,0) 0%, hsla(0,0%, 0%,0) 4%, hsla(0,0%, 0%,.03) 4.5%), -webkit-repeating-linear-gradient(left, hsla(0,0%,100%,0) 0%, hsla(0,0%,100%,0) 1.2%, hsla(0,0%,100%,.15) 2.2%), -webkit-linear-gradient(-90deg, hsl(0,0%,78%) 0%, hsl(0,0%,90%) 47%, hsl(0,0%,78%) 53%, hsl(0,0%,70%)100%); background-image: -moz-repeating-linear-gradient(left, hsla(0,0%,100%,0) 0%, hsla(0,0%,100%,0) 6%, hsla(0,0%,100%, .1) 7.5%), -moz-repeating-linear-gradient(left, hsla(0,0%, 0%,0) 0%, hsla(0,0%, 0%,0) 4%, hsla(0,0%, 0%,.03) 4.5%), -moz-repeating-linear-gradient(left, hsla(0,0%,100%,0) 0%, hsla(0,0%,100%,0) 1.2%, hsla(0,0%,100%,.15) 2.2%), -moz-linear-gradient(-90deg, hsl(0,0%,78%) 0%, hsl(0,0%,90%) 47%, hsl(0,0%,78%) 53%, hsl(0,0%,70%)100%); } ul.menu-list li:hover { box-shadow: 0 0 4px rgba(0, 0, 0, 0.5); -moz-box-shadow: 0 0 4px rgba(0, 0, 0, 0.5); } ul.menu-list li a { position: absolute; bottom: 0px; left: 0px; color: white; text-align: center; font-weight: bold; text-shadow: 0px 0px 4px rgba(0, 0, 0, 0.8); width: 100%; display: block; background: rgba(0, 0, 0, 0.6); line-height: 12px; padding: 4px 0; } UL.menu-list LI a:hover { text-decoration: none; } li#add_your_site p { font-size: 32px; border: 3px solid #34A034; color: #34A034; border-radius: 34px; padding: 3px 4px 4px 5px; width: 20px; height: 22px; line-height: 18px; position: relative; left: 33px; top: 22px; background: #fff; } ul.menu-list li#add_your_site a { color: #A3EEA3; } /* This is the animation code. */ @-webkit-keyframes example { 0% { -webkit-transform: rotate(0deg); } 25% { -webkit-transform: rotate(3deg); } 50% { -webkit-transform: rotate(0deg); } 75% { -webkit-transform: rotate(-3deg); } } /* This is the element that we apply the animation to. */ li#add_your_site { -webkit-animation-name: example; -webkit-animation-duration: 0.4s; -webkit-animation-timing-function: ease; /* ease is the default */ -webkit-animation-delay: 0s; /* 0 is the default */ -webkit-animation-iteration-count: infinite; /* 1 is the default */ -webkit-animation-direction: alternate; /* normal is the default */ } A { color:#2557b4; text-decoration:none; } A:hover { text-decoration:underline; } #footer { height:40px; position:relative; overflow:hidden; background:url(images/bottombar.png) repeat-x 0 0; position:relative; margin-top:40px; } UL.menu-footer { padding:0; margin:8px 11px 0 0; list-style-type:none; float:right; } UL.menu-footer LI { color:white; font-family:Arial; font-size:12px; display:inline-block; margin:0 1px; } UL.menu-footer LI A { color:#8dd0ff; text-decoration:none; } UL.menu-footer LI A:hover { text-decoration:underline; } .nav-pills.nav { margin: 10px 0 25px 0; padding: 0; border-radius: 5px; border: 1px solid #d7d7d7; background: #eeeeee; background: -moz-linear-gradient(top, #eeeeee 0%, #cccccc 100%); background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#eeeeee), color-stop(100%,#cccccc)); background: -webkit-linear-gradient(top, #eeeeee 0%,#cccccc 100%); background: -o-linear-gradient(top, #eeeeee 0%,#cccccc 100%); background: -ms-linear-gradient(top, #eeeeee 0%,#cccccc 100%); background: linear-gradient(to bottom, #eeeeee 0%,#cccccc 100%); filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#eeeeee', endColorstr='#cccccc',GradientType=0 ); overflow: hidden; } .nav-pills > .active > a, .nav-pills > .active > a:hover { color: white; background-color: #555; box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.8)!important; text-shadow: 0px 0px 3px #000; } .nav-tabs > li > a, .nav-pills > li > a { padding-right: 17px; padding-left: 17px; border-right: 1px solid #bbb; border-radius: 0; margin: 0; line-height: 25px; font-size: 14px; color: #333; text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3); box-shadow: 0 0 1px rgba(255, 255, 255, 1); -moz-box-shadow: 0 0 1px rgba(255, 255, 255, 1); -webkit-transition: background 0.2s; -moz-transition: background 0.2s; } .nav.nav-pills li:first-child > a { padding-left: 28px; padding-right: 28px; } .nav.nav-pills li:first-child > a > img { width: 34px; } .nav.nav-pills li:last-child > a { border-right: none; box-shadow: none; -moz-box-shadow: none; } .tab-content { margin-bottom: 50px; } .tab-content > .active, .pill-content > .active { padding: 25px 30px; } #top_container, .tab-content > .active, .pill-content > .active { border: 1px solid #DDD; border-radius: 5px; -moz-border-radius: 5px; } .tab-content > .active, .pill-content > .active { background: rgba(255, 255, 255, 0.7); } pre .xml .javascript, pre .xml .css { opacity: 1; } #embed_link { text-align: right; padding-top: 0; } #embed_link a { color: #059C05; font-weight: 100; font-family: helvetica; font-size: 13px; display: inline-block; padding: 2px 10px; background: #f4f4f4; border: 1px solid #ddd; border-top: none; border-bottom-left-radius: 4px; border-bottom-right-radius: 4px; text-shadow: 0px 1px 0px rgba(255, 255, 255, 1); text-decoration: none; } p.highlight_note { padding: 8px 35px 8px 14px; margin-top: 10px; color: #A0762E; text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5); background-color: #FCF8E3; border: 1px solid #CA9C44; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } p.highlight_note a { color: #537CC7; } .prod_no_image { position: relative; left: -10px; top: -12px; } #api { padding: 0; } /*https://github.com/twitter/bootstrap/issues/5262*/ img { max-width: none; } .text-logo{ color: black; font-size: 24px; font-weight: lighter; margin-top: 23px; text-align: center; text-shadow: 1px 17px 2px gray, 1px 1px 2px gray; } .menu-list>li>img { position: relative; } .rotating-logo { -webkit-transform: rotate(0deg); transform: rotate(0deg); -webkit-transition: all 0.5s ease-out; transition: all 0.5s ease-out; } .rotating-logo:hover { -webkit-transform: rotate(360deg); transform: rotate(360deg); -webkit-transition: all 0.5s ease-in-out; transition: all 0.5s ease-in-out; } ================================================ FILE: doc/template/jade/common_layout.jade ================================================ -var dirPrefix = "./"; -var sitePrefix = "../doc/site/"; -var landingPage = 'false' -var versions = [] mixin doctype !!! 5 mixin head meta(http-equiv='Content-Type', content='text/html; charset=UTF-8') -if (isIndex) title #{title} -else title #{classId} - #{title} meta(name="generator", content="panino-doc-build") meta(name="description", content="Ace API documentation for the online code editor") meta(name="author", content="Garen J. Torikian") script(src='#{sitePrefix}/js/main.js') link(rel='stylesheet', media='all and (max-device-width: 480px)', href='doc/site/iphone.css') link(rel='stylesheet', media='all and (min-device-width: 481px) and (max-device-width: 1024px)', href='doc/site/iphone.css') link(href='#{dirPrefix}resources/ace/skeleton/images/favicon.ico', rel='icon', type='image/x-icon') link(href='#{sitePrefix}/style.css', rel='stylesheet', type='text/css') link(rel="stylesheet", href="#{dirPrefix}resources/csses/ace_api.css") link(rel="stylesheet", href="#{dirPrefix}resources/csses/font-awesome.css") link(href="#{dirPrefix}resources/images/favicon.ico", rel="icon", type="image/x-icon") script(src='#{dirPrefix}resources/javascripts/bbq.js') script(src="#{dirPrefix}resources/javascripts/jquery.collapse.js") script(src="#{dirPrefix}resources/javascripts/jquery.cookie.js") script(src="#{dirPrefix}resources/javascripts/bootstrap.js") mixin endingScripts script(defer, src="#{dirPrefix}resources/javascripts/ux.js") script(src="#{dirPrefix}resources/javascripts/clicker.js") script(src="#{dirPrefix}resources/javascripts/jquery-scrollspy.js") script(defer, src="#{dirPrefix}resources/javascripts/disqus-ext.js") script(defer, src="#{dirPrefix}resources/javascripts/ga.js") mixin identifyBuild(tree, type) landingPage = 'true' -dirPrefix = './' mixin markdown(text, inline) != markdown(text, inline) ================================================ FILE: doc/template/jade/layout.jade ================================================ include common_layout include lib #documentation.span9 -if (isIndex) != indexContent -else mixin api() mixin endingScripts div(id="disqus_thread") ================================================ FILE: doc/template/jade/lib.jade ================================================ - var methodSection, constructorSection, propertySection, eventSection; -function renameMemberTitle(title, count) if title.indexOf("ethods") >= 0 span Functions (#{count}) else if title.indexOf("ropert") >= 0 span Properties (#{count}) else span #{title} (#{count}) mixin article(obj, parents) if typeof obj === 'string' obj = list[obj] if (obj.private !== true && obj.name.charAt(0) !== "$") title = obj.path + (obj.type ? ' (' + obj.type + ')' : '') article.article(id=obj.path, data-title=title) if obj.type === 'section' || obj.type === 'namespace' || obj.type === 'class' || obj.type === 'mixin' if obj.stability mixin markdown(">" + obj.stability) if obj.description .section.description .memberContent mixin markdown(obj.description) else .section.method .memberContent if obj.signatures div.title i(id='#{obj.path}', class='methodToggle methodClicker inactive icon-caret-right') ul.signatures -var loops = 0; for sig in obj.signatures li.signature ul li.signature-call!= signature(obj, sig, ["methodClicker"]) if sig.returns li.signature-returns ul.argument-types for ret in sig.returns li.argument-type!= returnLink(obj, ret, []) -if (loops == 0) -loops = 1 // ensure that we only print ONE meta info UL per signature (some methods have multiple signatures) ul.metaInfo if obj.undocumented li span.label.undocumented Undocumented if obj.experimental li span.label.experimental Experimental if obj.readonly li span.label.read-only Read-Only if obj.chainable li span.label.chainable Chainable if obj.internal li span.label.internal Internal if obj.deprecated li span.label.deprecated | Deprecated if obj.deprecated.from |   (since #{obj.deprecated.from}) if obj.deprecated.off |  and will be removed on #{obj.deprecated.off} if obj.alias_of li span.label.alias.single | Aliased as: != link(obj.alias_of) else if obj.aliases.length li span.label.alias.multiple | Aliased as: ul.alias for alias in obj.aliases li mixin link(alias) if obj.related_to li span.label.related-to | Related to mixin link(obj.related_to, ["relatedToLink"]) div.sideToggler div(id='ellipsis_#{obj.path}', class='ellipsis_description') mixin markdown(obj.short_description) div.description mixin markdown(obj.description) if obj.bound && ~obj.bound.indexOf('#') p.note.methodized | This method can be called either as an != link(obj.bound, ['link-short'], 'instance method') | or as a generic method. If calling as generic, pass the instance in as the first argument. else if obj.bound && !~obj.bound.indexOf('#') p.note.functionalized | This method can be called either as an instance method or as a != link(obj.bound, ['link-short'], 'generic method') |. If calling as generic, pass the instance in as the first argument. if obj.arguments && obj.arguments.length h4 Arguments != argumentTable(obj.arguments, ["argument-list", "table", "table-striped", "table-bordered"]) if obj.returns && obj.returns.length h4 Returns != returnTable(obj.returns, ["return-list", "table", "table-striped", "table-bordered"]) //- children for child in obj.children.filter(function(x){return x.type === 'section'}) mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'utility'}) mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'constructor'}) - if (!constructorSection) - constructorSection = true h3.sectionHeader Constructors mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'event'}) - if (!eventSection) - eventSection = true h3.sectionHeader Events mixin article(child, parents.concat(obj), 'event') for child in obj.children.filter(function(x){return x.type === 'class method'}) - if (!methodSection) - methodSection = true h3.sectionHeader Methods mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'class property'}) - if (!propertySection) - propertySection = true h3.sectionHeader Properties mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'instance method'}) mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'instance property'}) mixin article(child, parents.concat(obj)) for child in obj.children.filter(function(x){return x.type === 'constant'}) mixin article(child, parents.concat(obj)) mixin api() -pos = 0 for obj in tree.children -if (obj.subclasses.length == 0) mixin render_starting_tabs(obj, pos) -else mixin render_starting_tabs(obj, pos) for child in obj.children.filter(function(x){return x.type === 'namespace' || x.type === 'class' || x.type === 'mixin'}) -pos++ mixin render_starting_tabs(child, pos) mixin render_starting_tabs(obj, pos) .classContent .membersBackground div(class=' members pos#{pos}') div(class=' membersContent pos#{pos}') h1.memberHeader -var heading = obj.path span.name #{heading} -if (true || obj.filename.indexOf("index") < 0) ul(class='nav tabs pos#{pos}', data-tabs='tabs') for selector, title in {'Events': ['event', 'events'], 'Constructors': ['constructor', 'constructors'], 'Class methods': ['class method', 'class_methods'], 'Class properties': ['class property', 'class_properties'], 'Instance methods': ['instance method', 'instance_methods'], 'Instance properties': ['instance property', 'instance_properties'], 'Constants': ['constant', 'constants']} members = obj.children.filter(function(x){return x.type === selector[0]}) li(class="dropdown", data-dropdown="dropdown") if members.length a(href="\#", class="dropdown-toggle", data-toggle="dropdown") != renameMemberTitle(title, members.length) b.caret ul.dropdown-menu for m in members if (m.private !== true && m.name.charAt(0) !== "$") li(id='dropdown_#{m.path}', data-id='#{m.path}', class='memberLink') mixin link(m, [], true) -methodSection = constructorSection = propertySection = eventSection = false; mixin article(obj, []) mixin short_description_list(collection) ul.method-details-list for obj in collection if typeof obj === 'string' obj = list[obj] li.method-description h4 mixin link(obj) if obj.short_description mixin markdown(obj.short_description) mixin link(obj, classes, short) l = link(obj, classes, short) != l mixin links(collection) ul.method-list for obj in collection li mixin link(obj) ================================================ FILE: doc/template/resources/csses/ace_api.css ================================================ /* Generic "affects everything" stuff */ #wrapper .content .column2 { float: none; } #documentation ul { font-size: 13px; } #documentation li { color: black; } pre { background-color: #FFFFFF; } code { font-size: 12px; line-height: 16px; font-family: 'Ubuntu Mono',Monaco,Consolas,monospace !important; background-color: #F9F9F9; border-radius: 3px 3px 3px 3px; display: inline-block; padding: 0 4px; margin: 2px 1px; color: inherit; } #documentation pre { margin-top: 10px; border-radius: none; box-shadow: none; background : white; /*background : #f5f5f5; border: 0;*/ -webkit-border-radius: 6px 6px 0 0; -moz-border-radius: 6px 6px 0 0; border-radius: 6px 6px 0 0; padding: 5px; } .method pre, .event pre, .property pre { background : white; } #documentation pre code { background-color: transparent; border-radius: none; box-shadow: none; } #documentation a code { color: #00438a; } #documentation h2 { font-size: 26px; } #documentation p { font-size: 13px; } #documentation li p:last-child { margin-bottom : 5px; } #documentation blockquote p{ font-size: 14px; font-weight: 500; line-height: 23px; font-style: italic; } .alert-message{ margin-bottom : 13px; } /* Header and shoulders */ .navbar .nav > li { float:none; display:inline-block; *display:inline; /* ie7 fix */ zoom:1; /* hasLayout ie7 trigger */ } .navbar .nav > li > a { padding: 10px 15px 11px; } .navbar { text-align:center; } #topSection { width: 1000px; } .small_win #topSection { width: 100%; } .small_win #topSection .dropdown { margin-right: 40%; } .navbar .brand { margin-left: 0px; } .brand { background: transparent url(../images/ace_logo_menu.png) no-repeat 33px 5px; width: 80px; outline: none; height: 40px; padding: 0 10px !important; border: none; } .brand.dropdown-toggle:after { content: none; display: block; height: 40px; border: none; } .ace_logo { position: absolute; top: 45px; z-index: 20000; left: 210px; } .headerTitle { position: relative; top: 100px; left: 250px; } /* Menu venue */ h3.api_title { padding-top: 10px; } ul.menu { margin-left: 2px; } .menu li { list-style-image: url(../images/menu_disc.png); margin-bottom: 4px; font-weight: 700; padding-left: 10px; margin-left: 0; } .menu li .menu-item a.menuLink, .menu li .menu-item span.menuLink { color: #3E7096; font-weight: 100; } .menuTwo { margin-bottom: 5px; margin-top: 2px; } .menuTwo li .menu-item a.menuLink { color: #3E7096; font-weight: 100; } /* need specificity to "beat" the above colors */ .menu li .menu-item a.currentItem, .menuTwo li .menu-item { color: #0072bc; } /* Members and the tabs that represent them */ .srolled .members { width: 100%; /* -webkit-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.35); -moz-box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.35); box-shadow: 0 1px 4px 0 rgba(0, 0, 0, 0.35); */ padding-bottom: 15px; /* height: 31px;*/ position: fixed; } .shadow.members{ background: #edf8fd; box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); -moz-box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); -o-box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); -webkit-box-shadow: 0 0.1em 1em rgba(0,0,0, 0.3); } .membersContent { /* border-bottom: 0.1em solid #FFF;*/ height: 3em; padding-top: 4px; /* line-height: 4;*/ /* margin-top: -0.1em;*/ position: relative; /* transition-property: border-color, line-height; transition-duration: 125ms, 250ms; transition-timing-function: ease-out, ease-out; -moz-transition-property: border-color, line-height; -moz-transition-duration: 125ms, 250ms; -moz-transition-timing-function: ease-out, ease-out; -o-transition-property: border-color, line-height; -o-transition-duration: 125ms, 250ms; -o-transition-timing-function: ease-out, ease-out; -webkit-transition-property: border-color, line-height; -webkit-transition-duration: 125ms, 250ms; -webkit-transition-timing-function: ease-out, ease-out;*/ /*transition-duration: 125ms; transition-property: top; transition-timing-function: ease-out; top : 11px;*/ z-index: 103; padding-right: 10px; margin-right: -5px; /*width: 700px;*/ } .srolledHeader .membersContent { line-height: 3; } .srolled .membersContent { /*top : 0;*/ width: 625px; padding-left: 327px; margin : 0 auto 0 auto; } .srolled ul.nav { padding-right: 10px; } .membersBackground { /* background-color: white; position: fixed; z-index: 2; top: 40px; left: 0px; right: 0px; width: 100%; height: 55px; opacity: 0; display: none; box-shadow: rgba(0, 0, 0, 0.398438) 1px 4px 6px;*/ background-color: transparent; height: 47px; /*width: 700px;*/ position: absolute; } .srolled .membersBackground { position: relative; } .srolledHeader .membersBackground { /* display: block;*/ } .memberHeader { float: left; padding-right: 10px; margin-bottom: 5px; position: absolute; padding-top: 4px; } ul.tabs li:first-child ul{ left: -63px; } .tabs a.menu:after, .tabs .dropdown-toggle:after { margin-top: 22px; } .nav .dropdown-toggle .caret { margin-top: 12px; border-top-color: #6D8CA0; border-bottom-color: #6D8CA0; } li.dropdown { color: #2D2D2D; font-weight: bold; } .editInC9 { font-size: 11px; color: #657383; } .editInC9 a { color: #657383; font-weight: normal; position : relative; top : -2px; } .tabs { padding-top: 14px; /*border-bottom: 1px solid #848484;*/ min-height : 27px; padding-bottom : 5px; } .tabsSansBorder { border: 0; } .tabs, .pills { margin-bottom: 0; } .srolledHeader .members .tabs { background-color: white; } li.dropdown { color: #2D2D2D; font-weight: bold; } .members .tabs .dropdown a, .members .tabs a.menu:after, .members .tabs .dropdown-toggle:after { margin-right: 0; margin-left: 6px; } .memberLink a { margin-left: 0 !important; } .menu-dropdown { min-width : 105px; max-height: 350px; overflow: auto; border-color : rgba(0, 0, 0, 0.1); } .topbar div > ul .menu-dropdown li a:hover, .nav .menu-dropdown li a:hover, .topbar div > ul .dropdown-menu li a:hover, .nav .dropdown-menu li a:hover { background-color: #ffffff; color: #000000; } .tabs a.menu:after, .tabs .dropdown-toggle:after { margin-top: 13px; line-height: 28px; } .open .menu, .dropdown.open .menu, .open .dropdown-toggle, .dropdown.open .dropdown-toggle { background: transparent; color: black; /* font-weight: bold;*/ } #topSection .open .menu, #topSection .dropdown.open .menu, #topSection .open .dropdown-toggle, #topSection .dropdown.open .dropdown-toggle { color: #bfbfbf; } .tabs > li { font-weight: bold; } .tabs > li > a { border: none; outline: none; line-height: 28px; font-size: 11px; padding: 0 5px; } .tabs > li > a:hover { color: #000000; text-decoration: none; background-color: transparent; border: none; } .tabs > li, .pills > li { float: right; } .topbar .dropdown-menu a, .dropdown-menu a { font-size: 11px; /* padding: 2px 12px;*/ line-height: 14px; } .tabs .active > a, .tabs .active > a:hover { color: #000000; border: none; cursor: default; } .tabs .menu-dropdown, .tabs .dropdown-menu { border-radius: 0 0 6px 6px; left: 10px; width: 160px; } .srolled .tabs .menu-dropdown, .srolled .tabs .dropdown-menu { top: 32px; } .dropdown-toggle { color: #6D8CA0; } ul.tabs .double ul, ul.tabs .triple ul, ul.tabs .quad ul{ width:760px; margin-bottom:20px; overflow:hidden; border-top:1px solid #ccc; } /*ul.tabs .double li, ul.tabs .triple li, ul.tabs .quad li{ line-height:1.5em; border-bottom:1px solid #ccc; float:left; display:inline; }*/ /* Center content (the "real stuff") */ #nonFooter { padding-top: 40px; } #wrapper { height: 100%; } .content { height: 100%; } header.filler { position: relative; height: 40px; width: 100%; } /* .container-fluid .row-fluid { width: 1000px; margin-left: auto; margin-right: auto; }*/ .divider { height: 3px; background-color: #BEDAEA; margin-bottom: 3px; } #sidebar h3 a, #sidebar h3 a:hover { color: #404040; } #sidebarContainer { padding-top: 20px; } #mainContent { margin-left: 30px; } #documentation { padding-top: 35px; padding-bottom: 10px; } #documentation article.article { border-top: 1px solid #e9e9e9; padding: 16px 10px 2px; -webkit-transition: padding 0.2s; -moz-transition: padding 0.2s; -o-transition: padding 0.2s; } #documentation h3.sectionHeader + article.article { border-top: none; } div#documentation article:last-child { border-bottom: 1px solid #e9e9e9; padding-bottom: 40px; } #documentation article.article.methodToggleOpen { background: rgba(255, 255, 255, 0.5); font-size: 13px; line-height: 24px; margin: 0 0 10px 0; } #documentation article:first-child { border:none; } .site_logo { display: block; margin-left: auto; margin-right: auto; } /* Edit in Cloud9, sucka */ .snippet pre { margin-bottom: 0; } .snippet .toolbar { -webkit-border-radius: 0 0 6px 6px; -moz-border-radius: 0 0 6px 6px; border-radius: 0 0 6px 6px; text-align: right; padding: 3px 10px; margin-top : -1px; } .snippet .filename, .snippet .toolbar { font-family: Ubuntu, sans-serif; font-size: 12px; color: #EEE; } .snippet .filename { padding: 0 5px 2px 5px; font-size: 10px; background: rgba(230,230,230,0.5); padding: 0 5px 2px 5px; border-radius: 0 6px 0 6px; margin : 1px; position : absolute; right : 0; top : 0; } .snippet .filename span{ color : #666; } .snippet .toolbar { background-color: rgba(30,30,30,0.5); } div.snippet { margin-bottom: 18px; position : relative; } div.snippet a, div.toolbar a { color: #FFF; } /* All about signatures */ .signatures { /* width: 800px;*/ margin-left: 20px; margin-bottom: 5px; } .sideToggler { padding-left: 20px; } ul.signatures ul { list-style: none; display: inline; } li.signature { list-style: none; } .signature ul { padding: 0; margin: 0; } .signature li { display: inline; } .signature ul.argument-types::before { content: '→'; margin: 0 5px; } .signature li.argument-type::after { content: '|'; padding: 0 5px 0 5px; } .signature li.argument-type:last-child:after { content: ''; padding: 0 5px 0 5px; } .member-name { color: #4397cd; font-weight: bold; text-decoration: none; cursor: pointer; padding-right: 3px; } .signature-call { cursor: pointer; } #documentation .signature-call a { color: #8e487e; } .sigClassName { display: none; } .eventObjName { font-style: italic; } .eventListenerStart, .eventListenerClose, .eventFunctionOpen, .eventFunctionClose { color: #999999; } .eventMember { padding-right: 0px; } .metaInfo { float: right; z-index: 1; position: relative; } .chainable { background-color: #0072bc; color: #ffffff; } .deprecated { background-color: #f7941d; color: #ffffff; } .alias { background-color: #6c951e; color: #ffffff; } .related-to { background-color: #89289a; color: #ffffff; font-size: 10px; padding: 2px 5px 3px; text-transform: capitalize; } .undocumented { background-color: #B94A48; color: #ffffff; } #documentation .alias a, #documentation .related-to a { color: #ffffff; /* text-decoration: underline; */ } #documentation .alias a:hover, #documentation .related-to a:hover { text-decoration: none; } .#documentation alias:hover, #documentation .related-to:hover { opacity: 0.8; cursor: pointer; } .memberContent .title { } .memberContent .description { position:relative; /*top: -13px;*/ display: none; } .snip-container .actions .toggle-plaintext label { margin-top: 1px; padding-top: 0; text-align: left; } .snip-container .actions .toggle-plaintext input { margin-top: 4px !important; } .snip-container label { color: #ffffff; } .description h4 { padding-top: 10px; font-size: 18px; line-height : 18px; } .table-striped tbody tr:nth-child(odd) td, .table-striped tbody tr:nth-child(odd) th { background-color: #F9F9F9; } .table-striped tbody tr:nth-child(even) td, .table-striped tbody tr:nth-child(even) th { background-color: #fbfbfb; } .argument-list { margin-bottom : 13px; } .argName { font-style: italic; } /* Everyday I'm togglin' */ #documentation i.methodToggle { cursor: pointer; color: #9f9f9f; padding-top: 2px; float: left; } #documentation i.methodToggle.methodToggleHover { text-shadow: 0 0 10px #4699d5; color: #4699d5; } #documentation i.methodToggle.active { text-shadow: 0 0 10px #4699d5; color: #4699d5; /* Safari */ -webkit-transform: rotate(45deg); /* Firefox */ -moz-transform: rotate(45deg); /* IE */ -ms-transform: rotate(45deg); /* Opera */ -o-transform: rotate(45deg); padding-top: 9px; } #documentation h3.sectionHeader { line-height : 24px; } div.method { position: relative; } .methodToggle a { color: #fff; border-bottom: 0px; text-decoration: none; } h3.methodToggle { height : 13px; width : 8px; background-position : 0px 0px; position: absolute; top: -20px; background-image : url(../images/member-sprites.png); background-color : transparent; background-repeat : no-repeat; overflow: hidden; left: 0px; } h3.methodToggleHover { /* background-position : 0px -28px; */ } h3.methodToggle.inactive { top: 4px; } h3.methodToggle.active { top: 6px; height : 13px; width : 8px; background-position : 0px -59px; } .hidden { display: none; visibility: hidden; } .hiddenSpan { display: none; } .ellipsis_description, .short_description { /* width: 800px;*/ } .methodToggleOpen .ellipsis_description { display: none; } .sideToggler .short_description, .sideToggler .description{ display: none; } .methodToggleOpen .short_description, .methodToggleOpen .description { display: block; } .description td p { margin: 0; } /* Footer? I hardly know her */ #footer { width:100%; background: #101010 url(../images/dashed_back.png) repeat 0 0; font-size: 12px; color: white; height: 40px; } #footer .footerInner { padding-left: 300px; margin-left: auto; margin-right: auto; min-height: 40px; } #footer .footer-text { display: block; font-size: 12px; float: right; } #footer div.footerInner div.footer-text p { font-size: 12px; font-family: Arial; line-height: 18px; margin: 10px 15px 0px 1px; } #footer a, #footer a:hover { color: #8DD0FF; } .logoText, .logoImg { /*position: absolute;*/ margin-bottom: 5px; } .logoImg { top: 40px; } .topbar div > ul .menu-dropdown li a:hover, .nav .menu-dropdown li a:hover, .topbar div > ul .dropdown-menu li a:hover, .nav .dropdown-menu li a:hover { background-color: #191919; background-repeat: repeat-x; background-image: -khtml-gradient(linear, left top, left bottom, from(#292929), to(#191919)); background-image: -moz-linear-gradient(top, #292929, #191919); background-image: -ms-linear-gradient(top, #292929, #191919); background-image: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #292929), color-stop(100%, #191919)); background-image: -webkit-linear-gradient(top, #292929, #191919); background-image: -o-linear-gradient(top, #292929, #191919); background-image: linear-gradient(top, #292929, #191919); filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#292929', endColorstr='#191919', GradientType=0); color: #ffffff; } .alert-message.block-message { background: #fefaca; border-color : #fefaca; padding : 8px 14px 8px 14px; } body .dsq-reply{ margin-top : 10px; } #disqus_thread{ border-top : 1px solid #ddd; margin-top : 30px; } #disqus_thread h3, body #dsq-content h3 { font-size : 12px; margin : 0 0 20px 0; line-height : 12px; } body #dsq-reply h3{ font-size : 18px; line-height : 18px; margin : 15px 0 20px 0; } #disqus_thread select{ font-size : 11px; height : 20px; color : #444; } #dsq-global-toolbar, #dsq-pagination, .dsq-trackback-url{ display : none; } ================================================ FILE: doc/template/resources/javascripts/bbq.js ================================================ /* * jQuery BBQ: Back Button & Query Library - v1.2.1 - 2/17/2010 * http://benalman.com/projects/jquery-bbq-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($,p){var i,m=Array.prototype.slice,r=decodeURIComponent,a=$.param,c,l,v,b=$.bbq=$.bbq||{},q,u,j,e=$.event.special,d="hashchange",A="querystring",D="fragment",y="elemUrlAttr",g="location",k="href",t="src",x=/^.*\?|#.*$/g,w=/^.*\#/,h,C={};function E(F){return typeof F==="string"}function B(G){var F=m.call(arguments,1);return function(){return G.apply(this,F.concat(m.call(arguments)))}}function n(F){return F.replace(/^[^#]*#?(.*)$/,"$1")}function o(F){return F.replace(/(?:^[^?#]*\?([^#]*).*$)?.*/,"$1")}function f(H,M,F,I,G){var O,L,K,N,J;if(I!==i){K=F.match(H?/^([^#]*)\#?(.*)$/:/^([^#?]*)\??([^#]*)(#?.*)/);J=K[3]||"";if(G===2&&E(I)){L=I.replace(H?w:x,"")}else{N=l(K[2]);I=E(I)?l[H?D:A](I):I;L=G===2?I:G===1?$.extend({},I,N):$.extend({},N,I);L=a(L);if(H){L=L.replace(h,r)}}O=K[1]+(H?"#":L||!K[1]?"?":"")+L+J}else{O=M(F!==i?F:p[g][k])}return O}a[A]=B(f,0,o);a[D]=c=B(f,1,n);c.noEscape=function(G){G=G||"";var F=$.map(G.split(""),encodeURIComponent);h=new RegExp(F.join("|"),"g")};c.noEscape(",/");$.deparam=l=function(I,F){var H={},G={"true":!0,"false":!1,"null":null};$.each(I.replace(/\+/g," ").split("&"),function(L,Q){var K=Q.split("="),P=r(K[0]),J,O=H,M=0,R=P.split("]["),N=R.length-1;if(/\[/.test(R[0])&&/\]$/.test(R[N])){R[N]=R[N].replace(/\]$/,"");R=R.shift().split("[").concat(R);N=R.length-1}else{N=0}if(K.length===2){J=r(K[1]);if(F){J=J&&!isNaN(J)?+J:J==="undefined"?i:G[J]!==i?G[J]:J}if(N){for(;M<=N;M++){P=R[M]===""?O.length:R[M];O=O[P]=M').hide().insertAfter("body")[0].contentWindow;q=function(){return a(n.document[c][l])};o=function(u,s){if(u!==s){var t=n.document;t.open().close();t[c].hash="#"+u}};o(a())}}m.start=function(){if(r){return}var t=a();o||p();(function s(){var v=a(),u=q(t);if(v!==t){o(t=v,u);$(i).trigger(d)}else{if(u!==t){i[c][l]=i[c][l].replace(/#.*/,"")+"#"+u}}r=setTimeout(s,$[d+"Delay"])})()};m.stop=function(){if(!n){r&&clearTimeout(r);r=0}};return m})()})(jQuery,this); ================================================ FILE: doc/template/resources/javascripts/bootstrap.js ================================================ /* ============================================================ * bootstrap-dropdown.js v2.1.1 * http://twitter.github.com/bootstrap/javascript.html#dropdowns * ============================================================ * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ============================================================ */ !function ($) { "use strict"; // jshint ;_; /* DROPDOWN CLASS DEFINITION * ========================= */ var toggle = '[data-toggle=dropdown]' , Dropdown = function (element) { var $el = $(element).on('click.dropdown.data-api', this.toggle) $('html').on('click.dropdown.data-api', function () { $el.parent().removeClass('open') }) } Dropdown.prototype = { constructor: Dropdown , toggle: function (e) { var $this = $(this) , $parent , isActive if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') clearMenus() if (!isActive) { $parent.toggleClass('open') $this.focus() } return false } , keydown: function (e) { var $this , $items , $active , $parent , isActive , index if (!/(38|40|27)/.test(e.keyCode)) return $this = $(this) e.preventDefault() e.stopPropagation() if ($this.is('.disabled, :disabled')) return $parent = getParent($this) isActive = $parent.hasClass('open') if (!isActive || (isActive && e.keyCode == 27)) return $this.click() $items = $('[role=menu] li:not(.divider) a', $parent) if (!$items.length) return index = $items.index($items.filter(':focus')) if (e.keyCode == 38 && index > 0) index-- // up if (e.keyCode == 40 && index < $items.length - 1) index++ // down if (!~index) index = 0 $items .eq(index) .focus() } } function clearMenus() { getParent($(toggle)) .removeClass('open') } function getParent($this) { var selector = $this.attr('data-target') , $parent if (!selector) { selector = $this.attr('href') selector = selector && /#/.test(selector) && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } $parent = $(selector) $parent.length || ($parent = $this.parent()) return $parent } /* DROPDOWN PLUGIN DEFINITION * ========================== */ $.fn.dropdown = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('dropdown') if (!data) $this.data('dropdown', (data = new Dropdown(this))) if (typeof option == 'string') data[option].call($this) }) } $.fn.dropdown.Constructor = Dropdown /* APPLY TO STANDARD DROPDOWN ELEMENTS * =================================== */ $(function () { $('html') .on('click.dropdown.data-api touchstart.dropdown.data-api', clearMenus) $('body') .on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', function (e) { e.stopPropagation() }) .on('click.dropdown.data-api touchstart.dropdown.data-api' , toggle, Dropdown.prototype.toggle) .on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]' , Dropdown.prototype.keydown) }) }(window.jQuery); /* ======================================================== * bootstrap-tab.js v2.1.1 * http://twitter.github.com/bootstrap/javascript.html#tabs * ======================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ======================================================== */ !function ($) { "use strict"; // jshint ;_; /* TAB CLASS DEFINITION * ==================== */ var Tab = function (element) { this.element = $(element) } Tab.prototype = { constructor: Tab , show: function () { var $this = this.element , $ul = $this.closest('ul:not(.dropdown-menu)') , selector = $this.attr('data-target') , previous , $target , e if (!selector) { selector = $this.attr('href') selector = selector && selector.replace(/.*(?=#[^\s]*$)/, '') //strip for ie7 } if ( $this.parent('li').hasClass('active') ) return previous = $ul.find('.active a').last()[0] e = $.Event('show', { relatedTarget: previous }) $this.trigger(e) if (e.isDefaultPrevented()) return $target = $(selector) this.activate($this.parent('li'), $ul) this.activate($target, $target.parent(), function () { $this.trigger({ type: 'shown' , relatedTarget: previous }) }) } , activate: function ( element, container, callback) { var $active = container.find('> .active') , transition = callback && $.support.transition && $active.hasClass('fade') function next() { $active .removeClass('active') .find('> .dropdown-menu > .active') .removeClass('active') element.addClass('active') if (transition) { element[0].offsetWidth // reflow for transition element.addClass('in') } else { element.removeClass('fade') } if ( element.parent('.dropdown-menu') ) { element.closest('li.dropdown').addClass('active') } callback && callback() } transition ? $active.one($.support.transition.end, next) : next() $active.removeClass('in') } } /* TAB PLUGIN DEFINITION * ===================== */ $.fn.tab = function ( option ) { return this.each(function () { var $this = $(this) , data = $this.data('tab') if (!data) $this.data('tab', (data = new Tab(this))) if (typeof option == 'string') data[option]() }) } $.fn.tab.Constructor = Tab /* TAB DATA-API * ============ */ $(function () { $('body').on('click.tab.data-api', '[data-toggle="tab"], [data-toggle="pill"]', function (e) { e.preventDefault() $(this).tab('show') }) }) }(window.jQuery); /* ========================================================== * bootstrap-affix.js v2.1.1 * http://twitter.github.com/bootstrap/javascript.html#affix * ========================================================== * Copyright 2012 Twitter, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ========================================================== */ !function ($) { "use strict"; // jshint ;_; /* AFFIX CLASS DEFINITION * ====================== */ var Affix = function (element, options) { this.options = $.extend({}, $.fn.affix.defaults, options) this.$window = $(window).on('scroll.affix.data-api', $.proxy(this.checkPosition, this)) this.$element = $(element) this.checkPosition() } Affix.prototype.checkPosition = function () { if (!this.$element.is(':visible')) return var scrollHeight = $(document).height() , scrollTop = this.$window.scrollTop() , position = this.$element.offset() , offset = this.options.offset , offsetBottom = offset.bottom , offsetTop = offset.top , reset = 'affix affix-top affix-bottom' , affix if (typeof offset != 'object') offsetBottom = offsetTop = offset if (typeof offsetTop == 'function') offsetTop = offset.top() if (typeof offsetBottom == 'function') offsetBottom = offset.bottom() affix = this.unpin != null && (scrollTop + this.unpin <= position.top) ? false : offsetBottom != null && (position.top + this.$element.height() >= scrollHeight - offsetBottom) ? 'bottom' : offsetTop != null && scrollTop <= offsetTop ? 'top' : false if (this.affixed === affix) return this.affixed = affix this.unpin = affix == 'bottom' ? position.top - scrollTop : null this.$element.removeClass(reset).addClass('affix' + (affix ? '-' + affix : '')) } /* AFFIX PLUGIN DEFINITION * ======================= */ $.fn.affix = function (option) { return this.each(function () { var $this = $(this) , data = $this.data('affix') , options = typeof option == 'object' && option if (!data) $this.data('affix', (data = new Affix(this, options))) if (typeof option == 'string') data[option]() }) } $.fn.affix.Constructor = Affix $.fn.affix.defaults = { offset: 0 } /* AFFIX DATA-API * ============== */ $(window).on('load', function () { $('[data-spy="affix"]').each(function () { var $spy = $(this) , data = $spy.data() data.offset = data.offset || {} data.offsetBottom && (data.offset.bottom = data.offsetBottom) data.offsetTop && (data.offset.top = data.offsetTop) $spy.affix(data) }) }) }(window.jQuery); ================================================ FILE: doc/template/resources/javascripts/clicker.js ================================================ function setupClicker() { // when hovering over arrow, add highlight (only if inactive) $("i.methodToggle").hover(function () { if (!$("i.methodToggle").hasClass('active')) $(this).addClass("methodToggleHover"); }, function () { $(this).removeClass("methodToggleHover"); } ); function handleClick(e, linkHref) { //if (linkHref.indexOf("nav=api&api=") >= 0) // return; if (linkHref == "api") return; e.preventDefault(); var dstElem; if (linkHref) { dstElem = $("article[id='" + linkHref + "']"); } var $article = (dstElem || $(this)).closest('.article'), $arrow = $('i.methodClicker', $article); if (!$article.hasClass('methodToggleOpen') || this.force) { $article.addClass('methodToggleOpen'); $arrow.removeClass('inactive').addClass('active'); if (!$arrow[0]) return; var data = $arrow[0].id.replace(/^js_/, ""); //var state = {}; //state.section = data; //$.bbq.pushState(state); scrollTo(null, data); } else { $article.removeClass('methodToggleOpen'); $arrow.removeClass('active').addClass('inactive'); } } function transformHash(e) { // some bs to figure out link hash var hashId = (e.srcElement ? e.srcElement.href : (e.hash || e.target.href)) || e.currentTarget.hash; handleClick(e, hashId.substring(hashId.indexOf("#") + 1)); } // for the arrow $("i.methodToggle").click(handleClick); // for the signature $('.member-name').click(handleClick); // for the top dropdown $('li.memberLink a').click(transformHash); //$('a[href^="#"]').click(transformHash); $('.related-to', '.metaInfo').click(function(){ location.hash = $(this).find('a').attr('href').split('#')[1]; }); } ================================================ FILE: doc/template/resources/javascripts/disqus-ext.js ================================================ function setupDisqus(href) { var disqus_shortname = 'aceapi'; //var paths = window.location.pathname.split("/"); //var fileName = paths[paths.length - 2] + "/" + paths[paths.length - 1]; //var disqus_identifier = fileName; var disqus_identifier = href.substring(2); (function() { if (document.getElementById("disqusScript") === null) { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); } })(); } ================================================ FILE: doc/template/resources/javascripts/jquery-scrollspy.js ================================================ /*! * jQuery Scrollspy Plugin * Author: @sxalexander * Licensed under the MIT license */ ;(function ( $, window, document, undefined ) { $.fn.extend({ scrollspy: function ( options ) { var defaults = { min: 0, max: 0, mode: 'vertical', buffer: 0, container: window, onEnter: options.onEnter ? options.onEnter : [], onLeave: options.onLeave ? options.onLeave : [], onTick: options.onTick ? options.onTick : [] } var options = $.extend( {}, defaults, options ); return this.each(function (i) { var element = this; var o = options; var $container = $(o.container); var mode = o.mode; var buffer = o.buffer; var enters = leaves = 0; var inside = false; /* add listener to container */ $container.bind('scroll', function(e){ var position = {top: $(this).scrollTop(), left: $(this).scrollLeft()}; var xy = (mode == 'vertical') ? position.top + buffer : position.left + buffer; var max = o.max; var min = o.min; /* fix max */ if($.isFunction(o.max)){ max = o.max(); } /* fix max */ if($.isFunction(o.min)){ min = o.min(); } if(max == 0){ max = (mode == 'vertical') ? $container.height() : $container.outerWidth() + $(element).outerWidth(); } /* if we have reached the minimum bound but are below the max ... */ if(xy >= o.min && xy <= max){ /* trigger enter event */ if(!inside){ inside = true; enters++; /* fire enter event */ $(element).trigger('scrollEnter', {position: position}) if($.isFunction(o.onEnter)){ o.onEnter(element, position); } } /* triger tick event */ $(element).trigger('scrollTick', {position: position, inside: inside, enters: enters, leaves: leaves}) if($.isFunction(o.onTick)){ o.onTick(element, position, inside, enters, leaves); } }else{ if(inside){ inside = false; leaves++; /* trigger leave event */ $(element).trigger('scrollLeave', {position: position, leaves:leaves}) if($.isFunction(o.onLeave)){ o.onLeave(element, position); } } } }); }); } }) })( jQuery, window ); ================================================ FILE: doc/template/resources/javascripts/jquery.collapse.js ================================================ /*! * Collapse plugin for jQuery * http://github.com/danielstocks/jQuery-Collapse/ * * @author Daniel Stocks (http://webcloud.se) * @version 0.9.1 * @updated 17-AUG-2010 * * Copyright 2010, Daniel Stocks * Released under the MIT, BSD, and GPL Licenses. */ (function($) { // Use a cookie counter to allow multiple instances of the plugin var cookieCounter = 0; $.fn.extend({ collapse: function(options) { var defaults = { head : "h3", group : "div, ul", cookieName : "collapse", // Default function for showing content show: function() { this.show(); }, // Default function for hiding content hide: function() { this.hide(); } }; var op = $.extend(defaults, options); // Default CSS classes var active = "active", inactive = "inactive"; return this.each(function() { // Increment coookie counter to ensure cookie name integrity cookieCounter++; var obj = $(this), // Find all headers and wrap them in
    for accessibility. sections = obj.find(op.head).wrapInner(''), l = sections.length, cookie = op.cookieName + "_" + cookieCounter; // Locate all panels directly following a header var panel = obj.find(op.head).map(function() { var head = $(this) if(!head.hasClass(active)) { return head.next(op.group).hide()[0]; } return head.next(op.group)[0]; }); // Bind event for showing content obj.bind("show", function(e, bypass) { var obj = $(e.target); // ARIA attribute obj.attr('aria-hidden', false) .prev() .removeClass(inactive) .addClass(active); // Bypass method for instant display if(bypass) { obj.show(); } else { op.show.call(obj); } }); // Bind event for hiding content obj.bind("hide", function(e, bypass) { var obj = $(e.target); obj.attr('aria-hidden', true) .prev() .removeClass(active) .addClass(inactive); if(bypass) { obj.hide(); } else { op.hide.call(obj); } }); // Look for existing cookies if(cookieSupport) { for (var c=0;c<=l;c++) { var val = $.cookie(cookie + c); // Show content if associating cookie is found if ( val == c + "open" ) { panel.eq(c).trigger('show', [true]); // Hide content } else if ( val == c + "closed") { panel.eq(c).trigger('hide', [true]); } } } // Delegate click event to show/hide content. obj.bind("click", function(e) { var t = $(e.target); // Check if header was clicked if(!t.is(op.head)) { // What about link inside header. if ( t.parent().is(op.head) ) { t = t.parent(); } else { return; } e.preventDefault(); } // Figure out what position the clicked header has. var num = sections.index(t), cookieName = cookie + num, cookieVal = num, content = t.next(op.group); // If content is already active, hide it. if(t.hasClass(active)) { content.trigger('hide'); cookieVal += 'closed'; if(cookieSupport) { $.cookie(cookieName, cookieVal, { path: '/', expires: 10 }); } return; } // Otherwise show it. content.trigger('show'); cookieVal += 'open'; if(cookieSupport) { $.cookie(cookieName, cookieVal, { path: '/', expires: 10 }); } }); }); } }); // Make sure can we eat cookies without getting into trouble. var cookieSupport = (function() { try { $.cookie('x', 'x', { path: '/', expires: 10 }); $.cookie('x', null); } catch(e) { return false; } return true; })(); })(jQuery); ================================================ FILE: doc/template/resources/javascripts/jquery.cookie.js ================================================ /** * Cookie plugin * * Copyright (c) 2006 Klaus Hartl (stilbuero.de) * Dual licensed under the MIT and GPL licenses: * http://www.opensource.org/licenses/mit-license.php * http://www.gnu.org/licenses/gpl.html * */ /** * Create a cookie with the given name and value and other optional parameters. * * @example $.cookie('the_cookie', 'the_value'); * @desc Set the value of a cookie. * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); * @desc Create a cookie with all available options. * @example $.cookie('the_cookie', 'the_value'); * @desc Create a session cookie. * @example $.cookie('the_cookie', null); * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain * used when the cookie was set. * * @param String name The name of the cookie. * @param String value The value of the cookie. * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. * If set to null or omitted, the cookie will be a session cookie and will not be retained * when the the browser exits. * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will * require a secure protocol (like HTTPS). * @type undefined * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ /** * Get the value of a cookie with the given name. * * @example $.cookie('the_cookie'); * @desc Get the value of a cookie. * * @param String name The name of the cookie. * @return The value of the cookie. * @type String * * @name $.cookie * @cat Plugins/Cookie * @author Klaus Hartl/klaus.hartl@stilbuero.de */ jQuery.cookie = function(name, value, options) { if (typeof value != 'undefined') { // name and value given, set cookie options = options || {}; if (value === null) { value = ''; options.expires = -1; } var expires = ''; if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { var date; if (typeof options.expires == 'number') { date = new Date(); date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); } else { date = options.expires; } expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE } // CAUTION: Needed to parenthesize options.path and options.domain // in the following expressions, otherwise they evaluate to undefined // in the packed version for some reason... var path = options.path ? '; path=' + (options.path) : ''; var domain = options.domain ? '; domain=' + (options.domain) : ''; var secure = options.secure ? '; secure' : ''; document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); } else { // only name given, get cookie var cookieValue = null; if (document.cookie && document.cookie != '') { var cookies = document.cookie.split(';'); for (var i = 0; i < cookies.length; i++) { var cookie = jQuery.trim(cookies[i]); // Does this cookie string begin with the name we want? if (cookie.substring(0, name.length + 1) == (name + '=')) { cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); break; } } } return cookieValue; } }; ================================================ FILE: doc/template/resources/javascripts/plugins.js ================================================ window.log=function(){log.history=log.history||[];log.history.push(arguments);if(this.console){arguments.callee=arguments.callee.caller;var a=[].slice.call(arguments);(typeof console.log==="object"?log.apply.call(console.log,console,a):console.log.apply(console,a))}}; (function(b){function c(){}for(var d="assert,count,debug,dir,dirxml,error,exception,group,groupCollapsed,groupEnd,info,log,timeStamp,profile,profileEnd,time,timeEnd,trace,warn".split(","),a;a=d.pop();){b[a]=b[a]||c}})((function(){try {console.log();return window.console;}catch(err){return window.console={};}})()); /* * jQuery throttle / debounce - v1.1 - 3/7/2010 * http://benalman.com/projects/jquery-throttle-debounce-plugin/ * * Copyright (c) 2010 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function(b,c){var $=b.jQuery||b.Cowboy||(b.Cowboy={}),a;$.throttle=a=function(e,f,j,i){var h,d=0;if(typeof f!=="boolean"){i=j;j=f;f=c}function g(){var o=this,m=+new Date()-d,n=arguments;function l(){d=+new Date();j.apply(o,n)}function k(){h=c}if(i&&!h){l()}h&&clearTimeout(h);if(i===c&&m>e){l()}else{if(f!==true){h=setTimeout(i?k:l,i===c?e-m:e)}}}if($.guid){g.guid=j.guid=j.guid||$.guid++}return g};$.debounce=function(d,e,f){return f===c?a(d,e,false):a(d,f,e!==false)}})(this); ================================================ FILE: doc/template/resources/javascripts/prettify-extension.js ================================================ // Stolen from StackOverflow. Find all
     
    // elements on the page and add the "prettyprint" style. If at least one 
    // prettyprint element was found, call the Google Prettify prettyPrint() API.
    //http://sstatic.net/so/js/master.js?v=6523
    function styleCode() 
    {
        if (typeof disableStyleCode != "undefined") 
        {
            return;
        }
    
        var a = false;
    
        $("pre code").parent().each(function() 
        {
            if (!$(this).hasClass("prettyprint")) 
            {
                $(this).addClass("prettyprint");
                a = true
            }
        });
        
        if (a) { prettyPrint() } 
    }
    
    ================================================
    FILE: doc/template/resources/javascripts/prettify.js
    ================================================
    var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
    (function(){function L(a){function m(a){var f=a.charCodeAt(0);if(f!==92)return f;var b=a.charAt(1);return(f=r[b])?f:"0"<=b&&b<="7"?parseInt(a.substring(1),8):b==="u"||b==="x"?parseInt(a.substring(2),16):a.charCodeAt(1)}function e(a){if(a<32)return(a<16?"\\x0":"\\x")+a.toString(16);a=String.fromCharCode(a);if(a==="\\"||a==="-"||a==="["||a==="]")a="\\"+a;return a}function h(a){for(var f=a.substring(1,a.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),a=
    [],b=[],o=f[0]==="^",c=o?1:0,i=f.length;c122||(d<65||j>90||b.push([Math.max(65,j)|32,Math.min(d,90)|32]),d<97||j>122||b.push([Math.max(97,j)&-33,Math.min(d,122)&-33]))}}b.sort(function(a,f){return a[0]-f[0]||f[1]-a[1]});f=[];j=[NaN,NaN];for(c=0;ci[0]&&(i[1]+1>i[0]&&b.push("-"),b.push(e(i[1])));b.push("]");return b.join("")}function y(a){for(var f=a.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),b=f.length,d=[],c=0,i=0;c=2&&a==="["?f[c]=h(j):a!=="\\"&&(f[c]=j.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return f.join("")}for(var t=0,s=!1,l=!1,p=0,d=a.length;p=5&&"lang-"===b.substring(0,5))&&!(o&&typeof o[1]==="string"))c=!1,b="src";c||(r[f]=b)}i=d;d+=f.length;if(c){c=o[1];var j=f.indexOf(c),k=j+c.length;o[2]&&(k=f.length-o[2].length,j=k-c.length);b=b.substring(5);B(l+i,f.substring(0,j),e,p);B(l+i+j,c,C(b,c),p);B(l+i+k,f.substring(k),e,p)}else p.push(l+i,b)}a.e=p}var h={},y;(function(){for(var e=a.concat(m),
    l=[],p={},d=0,g=e.length;d=0;)h[n.charAt(k)]=r;r=r[1];n=""+r;p.hasOwnProperty(n)||(l.push(r),p[n]=q)}l.push(/[\S\s]/);y=L(l)})();var t=m.length;return e}function u(a){var m=[],e=[];a.tripleQuotedStrings?m.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?m.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
    q,"'\"`"]):m.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&e.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var h=a.hashComments;h&&(a.cStyleComments?(h>1?m.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):m.push(["com",/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),e.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,q])):m.push(["com",/^#[^\n\r]*/,
    q,"#"]));a.cStyleComments&&(e.push(["com",/^\/\/[^\n\r]*/,q]),e.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));a.regexLiterals&&e.push(["lang-regex",/^(?:^^\.?|[!+-]|!=|!==|#|%|%=|&|&&|&&=|&=|\(|\*|\*=|\+=|,|-=|->|\/|\/=|:|::|;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|[?@[^]|\^=|\^\^|\^\^=|{|\||\|=|\|\||\|\|=|~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\s*(\/(?=[^*/])(?:[^/[\\]|\\[\S\s]|\[(?:[^\\\]]|\\[\S\s])*(?:]|$))+\/)/]);(h=a.types)&&e.push(["typ",h]);a=(""+a.keywords).replace(/^ | $/g,
    "");a.length&&e.push(["kwd",RegExp("^(?:"+a.replace(/[\s,]+/g,"|")+")\\b"),q]);m.push(["pln",/^\s+/,q," \r\n\t\xa0"]);e.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,q],["pun",/^.[^\s\w"-$'./@\\`]*/,q]);return x(m,e)}function D(a,m){function e(a){switch(a.nodeType){case 1:if(k.test(a.className))break;if("BR"===a.nodeName)h(a),
    a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)e(a);break;case 3:case 4:if(p){var b=a.nodeValue,d=b.match(t);if(d){var c=b.substring(0,d.index);a.nodeValue=c;(b=b.substring(d.index+d[0].length))&&a.parentNode.insertBefore(s.createTextNode(b),a.nextSibling);h(a);c||a.parentNode.removeChild(a)}}}}function h(a){function b(a,d){var e=d?a.cloneNode(!1):a,f=a.parentNode;if(f){var f=b(f,1),g=a.nextSibling;f.appendChild(e);for(var h=g;h;h=g)g=h.nextSibling,f.appendChild(h)}return e}
    for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),e;(e=a.parentNode)&&e.nodeType===1;)a=e;d.push(a)}var k=/(?:^|\s)nocode(?:\s|$)/,t=/\r\n?|\n/,s=a.ownerDocument,l;a.currentStyle?l=a.currentStyle.whiteSpace:window.getComputedStyle&&(l=s.defaultView.getComputedStyle(a,q).getPropertyValue("white-space"));var p=l&&"pre"===l.substring(0,3);for(l=s.createElement("LI");a.firstChild;)l.appendChild(a.firstChild);for(var d=[l],g=0;g=0;){var h=m[e];A.hasOwnProperty(h)?window.console&&console.warn("cannot override language handler %s",h):A[h]=a}}function C(a,m){if(!a||!A.hasOwnProperty(a))a=/^\s*=o&&(h+=2);e>=c&&(a+=2)}}catch(w){"console"in window&&console.log(w&&w.stack?w.stack:w)}}var v=["break,continue,do,else,for,if,return,while"],w=[[v,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
    "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],F=[w,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],G=[w,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"],
    H=[G,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"],w=[w,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],I=[v,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
    J=[v,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],v=[v,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],K=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/,N=/\S/,O=u({keywords:[F,H,w,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END"+
    I,J,v],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),A={};k(O,["default-code"]);k(x([],[["pln",/^[^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",/^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^]*>([\S\s]*?)(<\/script\b[^>]*>)/i],["lang-css",/^]*>([\S\s]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),
    ["default-markup","htm","html","mxml","xhtml","xml","xsl"]);k(x([["pln",/^\s+/,q," \t\r\n"],["atv",/^(?:"[^"]*"?|'[^']*'?)/,q,"\"'"]],[["tag",/^^<\/?[a-z](?:[\w-.:]*\w)?|\/?>$/i],["atn",/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^\s"'>]*(?:[^\s"'/>]|\/(?=\s)))/],["pun",/^[/<->]+/],["lang-js",/^on\w+\s*=\s*"([^"]+)"/i],["lang-js",/^on\w+\s*=\s*'([^']+)'/i],["lang-js",/^on\w+\s*=\s*([^\s"'>]+)/i],["lang-css",/^style\s*=\s*"([^"]+)"/i],["lang-css",/^style\s*=\s*'([^']+)'/i],["lang-css",
    /^style\s*=\s*([^\s"'>]+)/i]]),["in.tag"]);k(x([],[["atv",/^[\S\s]+/]]),["uq.val"]);k(u({keywords:F,hashComments:!0,cStyleComments:!0,types:K}),["c","cc","cpp","cxx","cyc","m"]);k(u({keywords:"null,true,false"}),["json"]);k(u({keywords:H,hashComments:!0,cStyleComments:!0,verbatimStrings:!0,types:K}),["cs"]);k(u({keywords:G,cStyleComments:!0}),["java"]);k(u({keywords:v,hashComments:!0,multiLineStrings:!0}),["bsh","csh","sh"]);k(u({keywords:I,hashComments:!0,multiLineStrings:!0,tripleQuotedStrings:!0}),
    ["cv","py"]);k(u({keywords:"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["perl","pl","pm"]);k(u({keywords:J,hashComments:!0,multiLineStrings:!0,regexLiterals:!0}),["rb"]);k(u({keywords:w,cStyleComments:!0,regexLiterals:!0}),["js"]);k(u({keywords:"all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes",
    hashComments:3,cStyleComments:!0,multilineStrings:!0,tripleQuotedStrings:!0,regexLiterals:!0}),["coffee"]);k(x([],[["str",/^[\S\s]+/]]),["regex"]);window.prettyPrintOne=function(a,m,e){var h=document.createElement("PRE");h.innerHTML=a;e&&D(h,e);E({g:m,i:e,h:h});return h.innerHTML};window.prettyPrint=function(a){function m(){for(var e=window.PR_SHOULD_USE_CONTINUATION?l.now()+250:Infinity;p=0){var k=k.match(g),f,b;if(b=
    !k){b=n;for(var o=void 0,c=b.firstChild;c;c=c.nextSibling)var i=c.nodeType,o=i===1?o?b:c:i===3?N.test(c.nodeValue)?b:o:o;b=(f=o===b?void 0:o)&&"CODE"===f.tagName}b&&(k=f.className.match(g));k&&(k=k[1]);b=!1;for(o=n.parentNode;o;o=o.parentNode)if((o.tagName==="pre"||o.tagName==="code"||o.tagName==="xmp")&&o.className&&o.className.indexOf("prettyprint")>=0){b=!0;break}b||((b=(b=n.className.match(/\blinenums\b(?::(\d+))?/))?b[1]&&b[1].length?+b[1]:!0:!1)&&D(n,b),d={g:k,h:n,i:b},E(d))}}p 1010) sx = 1010 - document.documentElement.offsetWidth;
        }
        else sx = 0;
    
        $('span.methodClicker, article.article, i.methodClicker').each(function () {
            var a = $(this);
            var constructorPos = a.attr("id").indexOf("new ");
    
            var objName = a.attr("id");
            if (constructorPos >= 0) {
                objName = objName.substring(constructorPos + 4);
                objName += ".new";
            }
    
            a.attr("id", objName);
        });
        
        function showMethodContent() {
            var locationHash = location.hash.replace(/^#/, '').replace(/\./g, '\\.');
            var equalsPos = location.hash.indexOf("=");
            
            if (equalsPos >=0) {
                locationHash = locationHash.substring(0, location.hash.indexOf("="));
            }
            
            var $clickerEl = $('span#' + locationHash);
            if ($clickerEl.length > 0 && $clickerEl.hasClass('methodClicker')) {
                var p = $clickerEl.parent();
                p[0].force = true;
                p.trigger('click');
                p[0].force = false;
            }
        }
    
        if (location.hash.indexOf("section") >= 1) {
            showMethodContent();
            var data = location.hash;
            scrollTo(null, data.substr(1));
        }
    
        window.onhashchange = function () {
            showMethodContent();
        }
    };
    
    function scrollTo(el, data) {
        if (!data) {
            data = el.getAttribute("data-id");
            //location.hash = data;
        }
        var el = $("span#" + data.replace(/\./g, "\\."))[0];
        if (!el) return;
    
        var article = $(el).closest('.article')[0];
    
        var top = article.offsetTop - 100;
    
        if (document.body.scrollTop > top || document.body.scrollTop != top && document.body.scrollTop + (window.innerHeight || document.documentElement.offsetHeight) < top + article.offsetHeight) {
            $('body').animate({
                scrollTop: top
            }, {
                duration: 200,
                easing: "swing"
            });
        }
    }
    
    ================================================
    FILE: experiments/animate_folding.html
    ================================================
    
    
    
    
    
    
      
      
      Editor
      
    
    
    
    
    ================================================ FILE: experiments/basic_animation.html ================================================
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Typi non habent claritatem insitam; est usus legentis in iis qui facit eorum claritatem. Investigationes demonstraverunt lectores legere me lius quod ii legunt saepius. Claritas est etiam processus dynamicus, qui sequitur mutationem consuetudium lectorum. Mirum est notare quam littera gothica, quam nunc putamus parum claram, anteposuerit litterarum formas humanitatis per seacula quarta decima et quinta decima. Eodem modo typi, qui nunc nobis videntur parum clari, fiant sollemnes in futurum.
    ================================================ FILE: experiments/capture.html ================================================
    ================================================ FILE: experiments/cut_copy.html ================================================ Text Events
    ================================================ FILE: experiments/debug_mem_leak.html ================================================

    ================================================ FILE: experiments/dom.html ================================================ Dom test
    
    
    
    
    
    
    
    
    ================================================
    FILE: experiments/triple_click.html
    ================================================
    
    
    
    
    	
    	triple_click
    	
    
    
    
    
    
    Juhu Kinners
    ================================================ FILE: experiments/worker.html ================================================ worker ================================================ FILE: experiments/worker.js ================================================ onmessage = function(e) { onmessage = new Function("e", e.data); }; ================================================ FILE: index.html ================================================ Ace - The High Performance Code Editor for the Web Fork me on GitHub

    The high performance code editor for the web.

    Built for Code

    Ace is an embeddable code editor written in JavaScript. It matches the features and performance of native editors such as Sublime, Vim and TextMate. It can be easily embedded in any web page and JavaScript application. Ace is maintained as the primary editor for Cloud9 IDE and is the successor of the Mozilla Skywriter (Bespin) project.

    /**
     * In fact, you're looking at ACE right now. Go ahead and play with it!
     *
     * We are currently showing off the JavaScript mode. ACE has support for 45
     * language modes and 24 color themes!
     */
    
    function add(x, y) {
        var resultString = "Hello, ACE! The result of your math is: ";
        var result = x + y;
        return resultString + result;
    }
    
    var addResult = add(3, 2);
    console.log(addResult);
    

    Looking for a more full-featured demo? Check out the kitchen sink.

    Features

    • Syntax highlighting for over 110 languages (TextMate/Sublime Text.tmlanguage files can be imported)
    • Over 20 themes (TextMate/Sublime Text .tmtheme files can be imported)
    • Automatic indent and outdent
    • An optional command line
    • Handles huge documents (four million lines seems to be the limit!)
    • Fully customizable key bindings including vim and Emacs modes
    • Search and replace with regular expressions
    • Highlight matching parentheses
    • Toggle between soft tabs and real tabs
    • Displays hidden characters
    • Drag and drop text using the mouse
    • Line wrapping
    • Code folding
    • Multiple cursors and selections
    • Live syntax checker (currently JavaScript/CoffeeScript/CSS/XQuery)
    • Cut, copy, and paste functionality

    Get the Open-Source Code

    Ace is a community project. We actively encourage and support contributions! The Ace source code is hosted on GitHub and released under the BSD license ‐ very simple and friendly to all kinds of projects, whether open-source or not. Take charge of your editor and add your favorite language highlighting and keybindings!

    git clone git://github.com/ajaxorg/ace.git

    History

    Skywriter/Bespin and Ace started as two independent projects both aiming to build a no compromise code editor component for the web. Bespin started as part of Mozilla Labs and was based on the <canvas> tag, while Ace is the editor component of Cloud9 IDE and uses the DOM for rendering. After the release of Ace at JSConf.eu 2010 in Berlin the Skywriter team decided to merge Ace with a simplified version of Skywriter's plugin system and some of Skywriter's extensibility points. All these changes have been merged back to Ace now, which supersedes Skywriter. Both Cloud9 IDE and Mozilla are actively developing and maintaining Ace.

    Related Projects

    Embedding Ace in Your Site

    Ace can be easily embedded into a web page. Get prebuilt version of ace from ace-builds repository and use the code below:

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <title>ACE in Action</title>
    <style type="text/css" media="screen">
        #editor { 
            position: absolute;
            top: 0;
            right: 0;
            bottom: 0;
            left: 0;
        }
    </style>
    </head>
    <body>
    
    <div id="editor">function foo(items) {
        var x = "All this is syntax highlighted";
        return x;
    }</div>
        
    <script src="/ace-builds/src-noconflict/ace.js" type="text/javascript" charset="utf-8"></script>
    <script>
        var editor = ace.edit("editor");
        editor.setTheme("ace/theme/monokai");
        editor.getSession().setMode("ace/mode/javascript");
    </script>
    </body>
    </html>

    Now check out the How-To Guide for instructions on common operations, such as setting a different language mode or getting the contents from the editor.

    Loading Ace from a Local URL

    If you want to clone and host Ace locally you can use one of the pre-packaged versions. Just copy one of src* subdirectories somewhere into your project, or use RequireJS to load the contents of lib/ace folder as ace:

    The packaged version can also be loaded from CDN's such as jsDelivr or cdnjs.

    Working with Ace

    In all of these examples Ace has been invoked as shown in the embedding guide.

    Setting Themes

    Themes are loaded on demand; all you have to do is pass the string name:

    editor.setTheme("ace/theme/twilight");

    > See all themes

    Setting the Programming Language Mode

    By default, the editor supports plain text mode. All other language modes are available as separate modules, loaded on demand like this:

    editor.getSession().setMode("ace/mode/javascript");

    Common Operations

    Set and get content:

    editor.setValue("the new text here"); // or session.setValue
    editor.getValue(); // or session.getValue

    Get selected text:

    editor.session.getTextRange(editor.getSelectionRange());

    Insert at cursor:

    editor.insert("Something cool");

    Get the current cursor line and column:

    editor.selection.getCursor();

    Go to a line:

    editor.gotoLine(lineNumber);

    Get total number of lines:

    editor.session.getLength();

    Set the default tab size:

    editor.getSession().setTabSize(4);

    Use soft tabs:

    editor.getSession().setUseSoftTabs(true);

    Set the font size:

    document.getElementById('editor').style.fontSize='12px';

    Toggle word wrapping:

    editor.getSession().setUseWrapMode(true);

    Set line highlighting:

    editor.setHighlightActiveLine(false);

    Set the print margin visibility:

    editor.setShowPrintMargin(false);

    Set the editor to read-only:

    editor.setReadOnly(true);  // false to make it editable

    Triggering Resizes

    Ace only resizes itself on window events. If you resize the editor div in another manner, and need Ace to resize, use the following:

    editor.resize()

    Searching

    editor.find('needle',{
        backwards: false,
        wrap: false,
        caseSensitive: false,
        wholeWord: false,
        regExp: false
    });
    editor.findNext();
    editor.findPrevious();

    The following options are available to you for your search parameters:

    • needle: The string or regular expression you're looking for
    • backwards: Whether to search backwards from where cursor currently is. Defaults to false.
    • wrap: Whether to wrap the search back to the beginning when it hits the end. Defaults to false.
    • caseSensitive: Whether the search ought to be case-sensitive. Defaults to false.
    • wholeWord: Whether the search matches only on whole words. Defaults to false.
    • range: The Range to search within. Set this to null for the whole document
    • regExp: Whether the search is a regular expression or not. Defaults to false.
    • start: The starting Range or cursor position to begin the search
    • skipCurrent: Whether or not to include the current line in the search. Default to false.

    Here's how you can perform a replace:

    editor.find('foo');
    editor.replace('bar');

    And here's a replace all:

    editor.replaceAll('bar');

    (editor.replaceAll uses the needle set earlier by editor.find('needle', ...)

    Listening to Events

    To listen for an onchange:

    editor.getSession().on('change', function(e) {
        // e.type, etc
    });

    To listen for an selection change:

    editor.getSession().selection.on('changeSelection', function(e) {
    });

    To listen for a cursor change:

    editor.getSession().selection.on('changeCursor', function(e) {
    });

    Adding New Commands and Keybindings

    To assign key bindings to a custom function:

    editor.commands.addCommand({
        name: 'myCommand',
        bindKey: {win: 'Ctrl-M',  mac: 'Command-M'},
        exec: function(editor) {
            //...
        },
        readOnly: true // false if this command should not apply in readOnly mode
    });

    Creating a Syntax Highlighter for Ace

    Creating a new syntax highlighter for Ace is extremely simple. You'll need to define two pieces of code: a new mode, and a new set of highlighting rules.

    Where to Start

    We recommend using the Ace Mode Creator when defining your highlighter. This allows you to inspect your code's tokens, as well as providing a live preview of the syntax highlighter in action.

    Defining a Mode

    Every language needs a mode. A mode contains the paths to a language's syntax highlighting rules, indentation rules, and code folding rules. Without defining a mode, Ace won't know anything about the finer aspects of your language.

    Here is the starter template we'll use to create a new mode:

    define(function(require, exports, module) {
    "use strict";
    
    var oop = require("../lib/oop");
    // defines the parent mode
    var TextMode = require("./text").Mode;
    var Tokenizer = require("../tokenizer").Tokenizer;
    var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent;
    
    // defines the language specific highlighters and folding rules
    var MyNewHighlightRules = require("./mynew_highlight_rules").MyNewHighlightRules;
    var MyNewFoldMode = require("./folding/mynew").MyNewFoldMode;
    
    var Mode = function() {
        // set everything up
        this.HighlightRules = MyNewHighlightRules;
        this.$outdent = new MatchingBraceOutdent();
        this.foldingRules = new MyNewFoldMode();
    };
    oop.inherits(Mode, TextMode);
    
    (function() {
        // configure comment start/end characters
        this.lineCommentStart = "//";
        this.blockComment = {start: "/*", end: "*/"};
        
        // special logic for indent/outdent. 
        // By default ace keeps indentation of previous line
        this.getNextLineIndent = function(state, line, tab) {
            var indent = this.$getIndent(line);
            return indent;
        };
    
        this.checkOutdent = function(state, line, input) {
            return this.$outdent.checkOutdent(line, input);
        };
    
        this.autoOutdent = function(state, doc, row) {
            this.$outdent.autoOutdent(doc, row);
        };
        
        // create worker for live syntax checking
        this.createWorker = function(session) {
            var worker = new WorkerClient(["ace"], "ace/mode/mynew_worker", "NewWorker");
            worker.attachToDocument(session.getDocument());
            worker.on("errors", function(e) {
                session.setAnnotations(e.data);
            });
            return worker;
        };
        
    }).call(Mode.prototype);
    
    exports.Mode = Mode;
    });

    What's going on here? First, you're defining the path to TextMode (more on this later). Then you're pointing the mode to your definitions for the highlighting rules, as well as your rules for code folding. Finally, you're setting everything up to find those rules, and exporting the Mode so that it can be consumed. That's it!

    Regarding TextMode, you'll notice that it's only being used once: oop.inherits(Mode, TextMode);. If your new language depends on the rules of another language, you can choose to inherit the same rules, while expanding on it with your language's own requirements. For example, PHP inherits from HTML, since it can be embedded directly inside .html pages. You can either inherit from TextMode, or any other existing mode, if it already relates to your language.

    All Ace modes can be found in the lib/ace/mode folder.

    Defining Syntax Highlighting Rules

    The Ace highlighter can be considered to be a state machine. Regular expressions define the tokens for the current state, as well as the transitions into another state. Let's define mynew_highlight_rules.js, which our mode above uses.

    All syntax highlighters start off looking something like this:

    define(function(require, exports, module) {
    "use strict";
    
    var oop = require("../lib/oop");
    var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
    
    var MyNewHighlightRules = function() {
    
        // regexp must not have capturing parentheses. Use (?:) instead.
        // regexps are ordered -> the first match is used
       this.$rules = {
            "start" : [
                {
                    token: token, // String, Array, or Function: the CSS token to apply
                    regex: regex, // String or RegExp: the regexp to match
                    next:  next   // [Optional] String: next state to enter
                }
            ]
        };
    };
    
    oop.inherits(MyNewHighlightRules, TextHighlightRules);
    
    exports.MyNewHighlightRules = MyNewHighlightRules;
    
    });

    The token state machine operates on whatever is defined in this.$rules. The highlighter always begins at the start state, and progresses down the list, looking for a matching regex. When one is found, the resulting text is wrapped within a <span class="ace_<token>"> tag, where <token> is defined as the token property. Note that all tokens are preceded by the ace_ prefix when they're rendered on the page.

    Once again, we're inheriting from TextHighlightRules here. We could choose to make this any other language set we want, if our new language requires previously defined syntaxes. For more information on extending languages, see "extending Highlighters" below.

    Defining Tokens

    The Ace highlighting system is heavily inspired by the TextMate language grammar. Most tokens will follow the conventions of TextMate when naming grammars. A thorough (albeit incomplete) list of tokens can be found on the Ace Wiki.

    For the complete list of tokens, see tool/tmtheme.js. It is possible to add new token names, but the scope of that knowledge is outside of this document.

    Multiple tokens can be applied to the same text by adding dots in the token, e.g. token: support.function wraps the text in a <span class="ace_support ace_function"> tag.

    Defining Regular Expressions

    Regular expressions can either be a RegExp or String definition

    If you're using a regular expression, remember to start and end the line with the / character, like this:

    {
        token : "constant.language.escape",
        regex : /\$[\w\d]+/
    }

    A caveat of using stringed regular expressions is that any \ character must be escaped. That means that even an innocuous regular expression like this:

    regex: "function\s*\(\w+\)"

    Must actually be written like this:

    regex: "function\\s*\(\\w+\)"

    Groupings

    You can also include flat regexps--(var)--or have matching groups--((a+)(b+)). There is a strict requirement whereby matching groups must cover the entire matched string; thus, (hel)lo is invalid. If you want to create a non-matching group, simply start the group with the ?: predicate; thus, (hel)(?:lo) is okay. You can, of course, create longer non-matching groups. For example:

    {
        token : "constant.language.boolean",
        regex : /(?:true|false)\b/
    },

    For flat regular expression matches, token can be a String, or a Function that takes a single argument (the match) and returns a string token. For example, using a function might look like this:

    var colors = lang.arrayToMap(
        ("aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|" +
        "purple|red|silver|teal|white|yellow").split("|")
    );
    
    var fonts = lang.arrayToMap(
        ("arial|century|comic|courier|garamond|georgia|helvetica|impact|lucida|" +
        "symbol|system|tahoma|times|trebuchet|utopia|verdana|webdings|sans-serif|" +
        "serif|monospace").split("|")
    );
    
    ...
    
    {
        token: function(value) {
            if (colors.hasOwnProperty(value.toLowerCase())) {
                return "support.constant.color";
            }
            else if (fonts.hasOwnProperty(value.toLowerCase())) {
                return "support.constant.fonts";
            }
            else {
                return "text";
            }
        },
        regex: "\\-?[a-zA-Z_][a-zA-Z0-9_\\-]*"
    }

    If token is a function,it should take the same number of arguments as there are groups, and return an array of tokens.

    For grouped regular expressions, token can be a String, in which case all matched groups are given that same token, like this:

    {
        token: "identifier",
        regex: "(\\w+\\s*:)(\\w*)"
    }

    More commonly, though, token is an Array (of the same length as the number of groups), whereby matches are given the token of the same alignment as in the match. For a complicated regular expression, like defining a function, that might look something like this:

    {
        token : ["storage.type", "text", "entity.name.function"],
        regex : "(function)(\\s+)([a-zA-Z_][a-zA-Z0-9_]*\\b)"
    }

    Defining States

    The syntax highlighting state machine stays in the start state, until you define a next state for it to advance to. At that point, the tokenizer stays in that new state, until it advances to another state. Afterwards, you should return to the original start state.

    Here's an example:

    this.$rules = {
        "start" : [ {
            token : "text",
            regex : "<\\!\\[CDATA\\[",
            next : "cdata"
        } ],
    
        "cdata" : [ {
            token : "text",
            regex : "\\]\\]>",
            next : "start"
        }, {
            defaultToken : "text"
        } ]
    };

    In this extremely short sample, we're defining some highlighting rules for when Ace detects a <![CDATA tag. When one is encountered, the tokenizer moves from start into the cdata state. It remains there, applying the text token to any string it encounters. Finally, when it hits a closing ]> symbol, it returns to the start state and continues to tokenize anything else.

    Using the TMLanguage Tool

    There is a tool that will take an existing tmlanguage file and do its best to convert it into Javascript for Ace to consume. Here's what you need to get started:

    1. In the Ace repository, navigate to the tools folder.
    2. Run npm install to install required dependencies.
    3. Run node tmlanguage.js <path_to_tmlanguage_file>; for example, node <path_to_tmlanguage_file> /Users/Elrond/elven.tmLanguage

    Two files are created and placed in lib/ace/mode: one for the language mode, and one for the set of highlight rules. You will still need to add the code into ace/ext/modelist.js, and add a sample file for testing.

    A Note on Accuracy

    Your .tmlanguage file will then be converted to the best of the converter’s ability. It is an understatement to say that the tool is imperfect. Probably, language mode creation will never be able to be fully autogenerated. There's a list of non-determinable items; for example:

    • The use of regular expression lookbehinds
      This is a concept that JavaScript simply does not have and needs to be faked
    • Deciding which state to transition to
      While the tool does create new states correctly, it labels them with generic terms like state_2, state_10, e.t.c.
    • Extending modes
      Many modes say something like include source.c, to mean, “add all the rules in C highlighting.” That syntax does not make sense to Ace or this tool (though of course you can extending existing highlighters).
    • Rule preference order
    • Gathering keywords
      Most likely, you’ll need to take keywords from your language file and run them through createKeywordMapper()

    However, the tool is an excellent way to get a quick start, if you already possess a tmlanguage file for you language.

    Extending Highlighters

    Suppose you're working on a LuaPage, PHP embedded in HTML, or a Django template. You'll need to create a syntax highlighter that takes all the rules from the original language (Lua, PHP, or Python) and extends it with some additional identifiers (<?lua, <?php, {%, for example). Ace allows you to easily extend a highlighter using a few helper functions.

    Getting Existing Rules

    To get the existing syntax highlighting rules for a particular language, use the getRules() function. For example:

    var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
    
    this.$rules = new HtmlHighlightRules().getRules();
    
    /*
        this.$rules == Same this.$rules as HTML highlighting
    */

    Extending a Highlighter

    The addRules method does one thing, and it does one thing well: it adds new rules to an existing rule set, and prefixes any state with a given tag. For example, let's say you've got two sets of rules, defined like this:

    this.$rules = {
        "start": [ /* ... */ ]
    };
    
    var newRules = {
        "start": [ /* ... */ ]
    }

    If you want to incorporate newRules into this.$rules, you'd do something like this:

    this.addRules(newRules, "new-");
    
    /*
        this.$rules = {
            "start": [ ... ],
            "new-start": [ ... ]
        };
    */

    Extending Two Highlighters

    The last function available to you combines both of these concepts, and it's called embedRules. It takes three parameters:

    1. An existing rule set to embed with
    2. A prefix to apply for each state in the existing rule set
    3. A set of new states to add

    Like addRules, embedRules adds on to the existing this.$rules object.

    To explain this visually, let's take a look at the syntax highlighter for Lua pages, which combines all of these concepts:

    var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules;
    var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules;
    
    var LuaPageHighlightRules = function() {
        this.$rules = new HtmlHighlightRules().getRules();
    
        for (var i in this.$rules) {
            this.$rules[i].unshift({
                token: "keyword",
                regex: "<\\%\\=?",
                next: "lua-start"
            }, {
                token: "keyword",
                regex: "<\\?lua\\=?",
                next: "lua-start"
            });
        }
        this.embedRules(LuaHighlightRules, "lua-", [
            {
                token: "keyword",
                regex: "\\%>",
                next: "start"
            },
            {
                token: "keyword",
                regex: "\\?>",
                next: "start"
            }
        ]);
    };

    Here, this.$rules starts off as a set of HTML highlighting rules. To this set, we add two new checks for <%= and <?lua=. We also delegate that if one of these rules are matched, we should move onto the lua-start state. Next, embedRules takes the already existing set of LuaHighlightRules and applies the lua- prefix to each state there. Finally, it adds two new checks for %> and ?>, allowing the state machine to return to start.

    Code Folding

    Adding new folding rules to your mode can be a little tricky. First, insert the following lines of code into your mode definition:

    var MyFoldMode = require("./folding/newrules").FoldMode;
    
    ...
    var MyMode = function() {
    
        ...
    
        this.foldingRules = new MyFoldMode();
    };

    You'll be defining your code folding rules into the lib/ace/mode/folding folder. Here's a template that you can use to get started:

    define(function(require, exports, module) {
    "use strict";
    
    var oop = require("../../lib/oop");
    var Range = require("../../range").Range;
    var BaseFoldMode = require("./fold_mode").FoldMode;
    
    var FoldMode = exports.FoldMode = function() {};
    oop.inherits(FoldMode, BaseFoldMode);
    
    (function() {
    
        // regular expressions that identify starting and stopping points
        this.foldingStartMarker; 
        this.foldingStopMarker;
    
        this.getFoldWidgetRange = function(session, foldStyle, row) {
            var line = session.getLine(row);
    
            // test each line, and return a range of segments to collapse
        };
    
    }).call(FoldMode.prototype);
    
    });

    Just like with TextMode for syntax highlighting, BaseFoldMode contains the starting point for code folding logic. foldingStartMarker defines your opening folding point, while foldingStopMarker defines the stopping point. For example, for a C-style folding system, these values might look like this:

    this.foldingStartMarker = /(\{|\[)[^\}\]]*$|^\s*(\/\*)/;
    this.foldingStopMarker = /^[^\[\{]*(\}|\])|^[\s\*]*(\*\/)/;

    These regular expressions identify various symbols--{, [, //--to pay attention to. getFoldWidgetRange matches on these regular expressions, and when found, returns the range of relevant folding points. For more information on the Range object, see the Ace API documentation.

    Again, for a C-style folding mechanism, a range to return for the starting fold might look like this:

    var line = session.getLine(row);
    var match = line.match(this.foldingStartMarker);
    if (match) {
        var i = match.index;
    
        if (match[1])
            return this.openingBracketBlock(session, match[1], row, i);
    
        var range = session.getCommentFoldRange(row, i + match[0].length);
        range.end.column -= 2;
        return range;
    }

    Let's say we stumble across the code block hello_world() {. Our range object here becomes:

    {
      startRow: 0,
      endRow: 0,
      startColumn: 0,
      endColumn: 13
    }

    Testing Your Highlighter

    The best way to test your tokenizer is to see it live, right? To do that, you'll want to modify the live Ace demo to preview your changes. You can find this file in the root Ace directory with the name kitchen-sink.html.

    1. add an entry to supportedModes in ace/ext/modelist.js
    2. add a sample file to demo/kitchen-sink/docs/ with same name as the mode file

    Once you set this up, you should be able to witness a live demonstration of your new highlighter.

    Adding Automated Tests

    Adding automated tests for a highlighter is trivial so you are not required to do it, but it can help during development.

    In lib/ace/mode/_test create a file named

    text_<modeName>.txt
    with some example code. (You can skip this if the document you have added in demo/docs both looks good and covers various edge cases in your language syntax).

    Run node highlight_rules_test.js -gen to preserve current output of your tokenizer in tokens_<modeName>.json

    After this running highlight_rules_test.js optionalLanguageName will compare output of your tokenizer with the correct output you've created.

    Any files ending with the _test.js suffix are automatically run by Ace's Travis CI server.

    Ace API Reference

    Welcome to the Ace API Reference!

    On the left, you'll find a list of all of our currently documented classes. These is not a complete set of classes, but rather, the "core" set. For more information on how to work with Ace, check out the embedding guide.

    Below is an ERD diagram describing some fundamentals about how the internals of Ace works:

    Projects Using Ace

    Ace is used all over the web in all kinds of production applications. Here is just a small sampling:

    Support and User Resources

    Aside from our GitHub page, here's a list of places you can find help for Ace:

    ================================================ FILE: kitchen-sink.html ================================================ Ace Kitchen Sink
    ================================================ FILE: lib/ace/ace.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /** * The main class required to set up an Ace instance in the browser. * * @class Ace **/ define(function(require, exports, module) { "use strict"; require("./lib/fixoldbrowsers"); var dom = require("./lib/dom"); var event = require("./lib/event"); var Editor = require("./editor").Editor; var EditSession = require("./edit_session").EditSession; var UndoManager = require("./undomanager").UndoManager; var Renderer = require("./virtual_renderer").VirtualRenderer; // The following require()s are for inclusion in the built ace file require("./worker/worker_client"); require("./keyboard/hash_handler"); require("./placeholder"); require("./multi_select"); require("./mode/folding/fold_mode"); require("./theme/textmate"); require("./ext/error_marker"); exports.config = require("./config"); /** * Provides access to require in packed noconflict mode * @param {String} moduleName * @returns {Object} **/ exports.require = require; if (typeof define === "function") exports.define = define; /** * Embeds the Ace editor into the DOM, at the element provided by `el`. * @param {String | DOMElement} el Either the id of an element, or the element itself * **/ exports.edit = function(el) { if (typeof el == "string") { var _id = el; el = document.getElementById(_id); if (!el) throw new Error("ace.edit can't find div #" + _id); } if (el && el.env && el.env.editor instanceof Editor) return el.env.editor; var value = ""; if (el && /input|textarea/i.test(el.tagName)) { var oldNode = el; value = oldNode.value; el = dom.createElement("pre"); oldNode.parentNode.replaceChild(el, oldNode); } else if (el) { value = dom.getInnerText(el); el.innerHTML = ""; } var doc = exports.createEditSession(value); var editor = new Editor(new Renderer(el)); editor.setSession(doc); var env = { document: doc, editor: editor, onResize: editor.resize.bind(editor, null) }; if (oldNode) env.textarea = oldNode; event.addListener(window, "resize", env.onResize); editor.on("destroy", function() { event.removeListener(window, "resize", env.onResize); env.editor.container.env = null; // prevent memory leak on old ie }); editor.container.env = editor.env = env; return editor; }; /** * Creates a new [[EditSession]], and returns the associated [[Document]]. * @param {Document | String} text {:textParam} * @param {TextMode} mode {:modeParam} * **/ exports.createEditSession = function(text, mode) { var doc = new EditSession(text, mode); doc.setUndoManager(new UndoManager()); return doc; }; exports.EditSession = EditSession; exports.UndoManager = UndoManager; exports.version = "1.2.9"; }); ================================================ FILE: lib/ace/anchor.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; /** * * Defines a floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the anchor is updated. * * @class Anchor **/ /** * Creates a new `Anchor` and associates it with a document. * * @param {Document} doc The document to associate with the anchor * @param {Number} row The starting row position * @param {Number} column The starting column position * * @constructor **/ var Anchor = exports.Anchor = function(doc, row, column) { this.$onChange = this.onChange.bind(this); this.attach(doc); if (typeof column == "undefined") this.setPosition(row.row, row.column); else this.setPosition(row, column); }; (function() { oop.implement(this, EventEmitter); /** * Returns an object identifying the `row` and `column` position of the current anchor. * @returns {Object} **/ this.getPosition = function() { return this.$clipPositionToDocument(this.row, this.column); }; /** * * Returns the current document. * @returns {Document} **/ this.getDocument = function() { return this.document; }; /** * experimental: allows anchor to stick to the next on the left */ this.$insertRight = false; /** * Fires whenever the anchor position changes. * * Both of these objects have a `row` and `column` property corresponding to the position. * * Events that can trigger this function include [[Anchor.setPosition `setPosition()`]]. * * @event change * @param {Object} e An object containing information about the anchor position. It has two properties: * - `old`: An object describing the old Anchor position * - `value`: An object describing the new Anchor position * **/ this.onChange = function(delta) { if (delta.start.row == delta.end.row && delta.start.row != this.row) return; if (delta.start.row > this.row) return; var point = $getTransformedPoint(delta, {row: this.row, column: this.column}, this.$insertRight); this.setPosition(point.row, point.column, true); }; function $pointsInOrder(point1, point2, equalPointsInOrder) { var bColIsAfter = equalPointsInOrder ? point1.column <= point2.column : point1.column < point2.column; return (point1.row < point2.row) || (point1.row == point2.row && bColIsAfter); } function $getTransformedPoint(delta, point, moveIfEqual) { // Get delta info. var deltaIsInsert = delta.action == "insert"; var deltaRowShift = (deltaIsInsert ? 1 : -1) * (delta.end.row - delta.start.row); var deltaColShift = (deltaIsInsert ? 1 : -1) * (delta.end.column - delta.start.column); var deltaStart = delta.start; var deltaEnd = deltaIsInsert ? deltaStart : delta.end; // Collapse insert range. // DELTA AFTER POINT: No change needed. if ($pointsInOrder(point, deltaStart, moveIfEqual)) { return { row: point.row, column: point.column }; } // DELTA BEFORE POINT: Move point by delta shift. if ($pointsInOrder(deltaEnd, point, !moveIfEqual)) { return { row: point.row + deltaRowShift, column: point.column + (point.row == deltaEnd.row ? deltaColShift : 0) }; } // DELTA ENVELOPS POINT (delete only): Move point to delta start. // TODO warn if delta.action != "remove" ? return { row: deltaStart.row, column: deltaStart.column }; } /** * Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped. * @param {Number} row The row index to move the anchor to * @param {Number} column The column index to move the anchor to * @param {Boolean} noClip Identifies if you want the position to be clipped * **/ this.setPosition = function(row, column, noClip) { var pos; if (noClip) { pos = { row: row, column: column }; } else { pos = this.$clipPositionToDocument(row, column); } if (this.row == pos.row && this.column == pos.column) return; var old = { row: this.row, column: this.column }; this.row = pos.row; this.column = pos.column; this._signal("change", { old: old, value: pos }); }; /** * When called, the `"change"` event listener is removed. * **/ this.detach = function() { this.document.removeEventListener("change", this.$onChange); }; this.attach = function(doc) { this.document = doc || this.document; this.document.on("change", this.$onChange); }; /** * Clips the anchor position to the specified row and column. * @param {Number} row The row index to clip the anchor to * @param {Number} column The column index to clip the anchor to * **/ this.$clipPositionToDocument = function(row, column) { var pos = {}; if (row >= this.document.getLength()) { pos.row = Math.max(0, this.document.getLength() - 1); pos.column = this.document.getLine(pos.row).length; } else if (row < 0) { pos.row = 0; pos.column = 0; } else { pos.row = row; pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column)); } if (column < 0) pos.column = 0; return pos; }; }).call(Anchor.prototype); }); ================================================ FILE: lib/ace/anchor_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var Document = require("./document").Document; var Anchor = require("./anchor").Anchor; var Range = require("./range").Range; var assert = require("./test/assertions"); module.exports = { "test create anchor" : function() { var doc = new Document("juhu"); var anchor = new Anchor(doc, 0, 0); assert.position(anchor.getPosition(), 0, 0); assert.equal(anchor.getDocument(), doc); }, "test insert text in same row before cursor should move anchor column": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.insert({row: 1, column: 1}, "123"); assert.position(anchor.getPosition(), 1, 7); }, "test insert text at anchor should not move anchor when insertRight is true": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); anchor.$insertRight = true; doc.insert({row: 1, column: 4}, "123"); assert.position(anchor.getPosition(), 1, 4); }, "test insert lines before cursor should move anchor row": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.insertFullLines(1, ["123", "456"]); assert.position(anchor.getPosition(), 3, 4); }, "test insert lines at anchor position should move anchor down": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 0); doc.insertLines(1, ["line"]); assert.position(anchor.getPosition(), 2, 0); }, "test insert lines at anchor position should not move anchor down when insertRight is true and column is 0": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 0); anchor.$insertRight = true; doc.insertLines(1, ["line"]); assert.position(anchor.getPosition(), 1, 0); }, "test insert lines at anchor row should move anchor down when column > 0": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 2); anchor.$insertRight = true; doc.insertLines(1, ["line"]); assert.position(anchor.getPosition(), 2, 2); }, "test insert new line before cursor should move anchor column": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.insertMergedLines({row: 0, column: 0}, ['', '']); assert.position(anchor.getPosition(), 2, 4); }, "test insert new line in anchor line before anchor should move anchor column and row": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.insertMergedLines({row: 1, column: 2}, ['', '']); assert.position(anchor.getPosition(), 2, 2); }, "test delete text in anchor line before anchor should move anchor column": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.remove(new Range(1, 1, 1, 3)); assert.position(anchor.getPosition(), 1, 2); }, "test remove range which contains the anchor should move the anchor to the start of the range": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 0, 3); doc.remove(new Range(0, 1, 1, 3)); assert.position(anchor.getPosition(), 0, 1); }, "test delete character before the anchor should have no effect": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.remove(new Range(1, 4, 1, 5)); assert.position(anchor.getPosition(), 1, 4); }, "test delete lines in anchor line before anchor should move anchor row": function() { var doc = new Document("juhu\n1\n2\nkinners"); var anchor = new Anchor(doc, 3, 4); doc.removeFullLines(1, 2); assert.position(anchor.getPosition(), 1, 4); }, "test remove new line before the cursor": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.removeNewLine(0); assert.position(anchor.getPosition(), 0, 8); }, "test delete range which contains the anchor should move anchor to the end of the range": function() { var doc = new Document("juhu\nkinners"); var anchor = new Anchor(doc, 1, 4); doc.remove(new Range(0, 2, 1, 2)); assert.position(anchor.getPosition(), 0, 4); }, "test delete line which contains the anchor should move anchor to the end of the range": function() { var doc = new Document("juhu\nkinners\n123"); var anchor = new Anchor(doc, 1, 5); doc.removeFullLines(1, 1); assert.position(anchor.getPosition(), 1, 0); }, "test remove after the anchor should have no effect": function() { var doc = new Document("juhu\nkinners\n123"); var anchor = new Anchor(doc, 1, 2); doc.remove(new Range(1, 4, 2, 2)); assert.position(anchor.getPosition(), 1, 2); }, "test anchor changes triggered by document changes should emit change event": function(next) { var doc = new Document("juhu\nkinners\n123"); var anchor = new Anchor(doc, 1, 5); anchor.on("change", function(e) { assert.position(anchor.getPosition(), 0, 0); next(); }); doc.remove(new Range(0, 0, 2, 1)); }, "test only fire change event if position changes": function() { var doc = new Document("juhu\nkinners\n123"); var anchor = new Anchor(doc, 1, 5); anchor.on("change", function(e) { assert.fail(); }); doc.remove(new Range(2, 0, 2, 1)); }, "test insert/remove lines at the end of the document": function() { var doc = new Document("juhu\nkinners\n123"); var anchor = new Anchor(doc, 2, 4); doc.removeFullLines(0, 3); assert.position(anchor.getPosition(), 0, 0); doc.insertFullLines(0, ["a", "b", "c"]); assert.position(anchor.getPosition(), 3, 0); assert.equal(doc.getValue(), "a\nb\nc\n"); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/apply_delta.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; function throwDeltaError(delta, errorText){ console.log("Invalid Delta:", delta); throw "Invalid Delta: " + errorText; } function positionInDocument(docLines, position) { return position.row >= 0 && position.row < docLines.length && position.column >= 0 && position.column <= docLines[position.row].length; } function validateDelta(docLines, delta) { // Validate action string. if (delta.action != "insert" && delta.action != "remove") throwDeltaError(delta, "delta.action must be 'insert' or 'remove'"); // Validate lines type. if (!(delta.lines instanceof Array)) throwDeltaError(delta, "delta.lines must be an Array"); // Validate range type. if (!delta.start || !delta.end) throwDeltaError(delta, "delta.start/end must be an present"); // Validate that the start point is contained in the document. var start = delta.start; if (!positionInDocument(docLines, delta.start)) throwDeltaError(delta, "delta.start must be contained in document"); // Validate that the end point is contained in the document (remove deltas only). var end = delta.end; if (delta.action == "remove" && !positionInDocument(docLines, end)) throwDeltaError(delta, "delta.end must contained in document for 'remove' actions"); // Validate that the .range size matches the .lines size. var numRangeRows = end.row - start.row; var numRangeLastLineChars = (end.column - (numRangeRows == 0 ? start.column : 0)); if (numRangeRows != delta.lines.length - 1 || delta.lines[numRangeRows].length != numRangeLastLineChars) throwDeltaError(delta, "delta.range must match delta lines"); } exports.applyDelta = function(docLines, delta, doNotValidate) { // disabled validation since it breaks autocompletion popup // if (!doNotValidate) // validateDelta(docLines, delta); var row = delta.start.row; var startColumn = delta.start.column; var line = docLines[row] || ""; switch (delta.action) { case "insert": var lines = delta.lines; if (lines.length === 1) { docLines[row] = line.substring(0, startColumn) + delta.lines[0] + line.substring(startColumn); } else { var args = [row, 1].concat(delta.lines); docLines.splice.apply(docLines, args); docLines[row] = line.substring(0, startColumn) + docLines[row]; docLines[row + delta.lines.length - 1] += line.substring(startColumn); } break; case "remove": var endColumn = delta.end.column; var endRow = delta.end.row; if (row === endRow) { docLines[row] = line.substring(0, startColumn) + line.substring(endColumn); } else { docLines.splice( row, endRow - row + 1, line.substring(0, startColumn) + docLines[endRow].substring(endColumn) ); } break; } }; }); ================================================ FILE: lib/ace/autocomplete/popup.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Renderer = require("../virtual_renderer").VirtualRenderer; var Editor = require("../editor").Editor; var Range = require("../range").Range; var event = require("../lib/event"); var lang = require("../lib/lang"); var dom = require("../lib/dom"); var $singleLineEditor = function(el) { var renderer = new Renderer(el); renderer.$maxLines = 4; var editor = new Editor(renderer); editor.setHighlightActiveLine(false); editor.setShowPrintMargin(false); editor.renderer.setShowGutter(false); editor.renderer.setHighlightGutterLine(false); editor.$mouseHandler.$focusWaitTimout = 0; editor.$highlightTagPending = true; return editor; }; var AcePopup = function(parentNode) { var el = dom.createElement("div"); var popup = new $singleLineEditor(el); if (parentNode) parentNode.appendChild(el); el.style.display = "none"; popup.renderer.content.style.cursor = "default"; popup.renderer.setStyle("ace_autocomplete"); popup.setOption("displayIndentGuides", false); popup.setOption("dragDelay", 150); var noop = function(){}; popup.focus = noop; popup.$isFocused = true; popup.renderer.$cursorLayer.restartTimer = noop; popup.renderer.$cursorLayer.element.style.opacity = 0; popup.renderer.$maxLines = 8; popup.renderer.$keepTextAreaAtCursor = false; popup.setHighlightActiveLine(false); // set default highlight color popup.session.highlight(""); popup.session.$searchHighlight.clazz = "ace_highlight-marker"; popup.on("mousedown", function(e) { var pos = e.getDocumentPosition(); popup.selection.moveToPosition(pos); selectionMarker.start.row = selectionMarker.end.row = pos.row; e.stop(); }); var lastMouseEvent; var hoverMarker = new Range(-1,0,-1,Infinity); var selectionMarker = new Range(-1,0,-1,Infinity); selectionMarker.id = popup.session.addMarker(selectionMarker, "ace_active-line", "fullLine"); popup.setSelectOnHover = function(val) { if (!val) { hoverMarker.id = popup.session.addMarker(hoverMarker, "ace_line-hover", "fullLine"); } else if (hoverMarker.id) { popup.session.removeMarker(hoverMarker.id); hoverMarker.id = null; } }; popup.setSelectOnHover(false); popup.on("mousemove", function(e) { if (!lastMouseEvent) { lastMouseEvent = e; return; } if (lastMouseEvent.x == e.x && lastMouseEvent.y == e.y) { return; } lastMouseEvent = e; lastMouseEvent.scrollTop = popup.renderer.scrollTop; var row = lastMouseEvent.getDocumentPosition().row; if (hoverMarker.start.row != row) { if (!hoverMarker.id) popup.setRow(row); setHoverMarker(row); } }); popup.renderer.on("beforeRender", function() { if (lastMouseEvent && hoverMarker.start.row != -1) { lastMouseEvent.$pos = null; var row = lastMouseEvent.getDocumentPosition().row; if (!hoverMarker.id) popup.setRow(row); setHoverMarker(row, true); } }); popup.renderer.on("afterRender", function() { var row = popup.getRow(); var t = popup.renderer.$textLayer; var selected = t.element.childNodes[row - t.config.firstRow]; if (selected == t.selectedNode) return; if (t.selectedNode) dom.removeCssClass(t.selectedNode, "ace_selected"); t.selectedNode = selected; if (selected) dom.addCssClass(selected, "ace_selected"); }); var hideHoverMarker = function() { setHoverMarker(-1); }; var setHoverMarker = function(row, suppressRedraw) { if (row !== hoverMarker.start.row) { hoverMarker.start.row = hoverMarker.end.row = row; if (!suppressRedraw) popup.session._emit("changeBackMarker"); popup._emit("changeHoverMarker"); } }; popup.getHoveredRow = function() { return hoverMarker.start.row; }; event.addListener(popup.container, "mouseout", hideHoverMarker); popup.on("hide", hideHoverMarker); popup.on("changeSelection", hideHoverMarker); popup.session.doc.getLength = function() { return popup.data.length; }; popup.session.doc.getLine = function(i) { var data = popup.data[i]; if (typeof data == "string") return data; return (data && data.value) || ""; }; var bgTokenizer = popup.session.bgTokenizer; bgTokenizer.$tokenizeRow = function(row) { var data = popup.data[row]; var tokens = []; if (!data) return tokens; if (typeof data == "string") data = {value: data}; if (!data.caption) data.caption = data.value || data.name; var last = -1; var flag, c; for (var i = 0; i < data.caption.length; i++) { c = data.caption[i]; flag = data.matchMask & (1 << i) ? 1 : 0; if (last !== flag) { tokens.push({type: data.className || "" + ( flag ? "completion-highlight" : ""), value: c}); last = flag; } else { tokens[tokens.length - 1].value += c; } } if (data.meta) { var maxW = popup.renderer.$size.scrollerWidth / popup.renderer.layerConfig.characterWidth; var metaData = data.meta; if (metaData.length + data.caption.length > maxW - 2) { // trim meta to fit this popup and add ellipsis metaData = metaData.substr(0, maxW - data.caption.length - 3) + "\u2026"; } tokens.push({type: "rightAlignedText", value: metaData}); } return tokens; }; bgTokenizer.$updateOnChange = noop; bgTokenizer.start = noop; popup.session.$computeWidth = function() { return this.screenWidth = 0; }; // public popup.isOpen = false; popup.isTopdown = false; popup.autoSelect = true; popup.data = []; popup.setData = function(list) { popup.setValue(lang.stringRepeat("\n", list.length), -1); popup.data = list || []; popup.setRow(0); }; popup.getData = function(row) { return popup.data[row]; }; popup.getRow = function() { return selectionMarker.start.row; }; popup.setRow = function(line) { line = Math.max(this.autoSelect ? 0 : -1, Math.min(this.data.length, line)); if (selectionMarker.start.row != line) { popup.selection.clearSelection(); selectionMarker.start.row = selectionMarker.end.row = line || 0; popup.session._emit("changeBackMarker"); popup.moveCursorTo(line || 0, 0); if (popup.isOpen) popup._signal("select"); } }; popup.on("changeSelection", function() { if (popup.isOpen) popup.setRow(popup.selection.lead.row); popup.renderer.scrollCursorIntoView(); }); popup.hide = function() { this.container.style.display = "none"; this._signal("hide"); popup.isOpen = false; }; popup.show = function(pos, lineHeight, topdownOnly) { var el = this.container; var screenHeight = window.innerHeight; var screenWidth = window.innerWidth; var renderer = this.renderer; // var maxLines = Math.min(renderer.$maxLines, this.session.getLength()); var maxH = renderer.$maxLines * lineHeight * 1.4; var top = pos.top + this.$borderSize; var allowTopdown = top > screenHeight / 2 && !topdownOnly; if (allowTopdown && top + lineHeight + maxH > screenHeight) { renderer.$maxPixelHeight = top - 2 * this.$borderSize; el.style.top = ""; el.style.bottom = screenHeight - top + "px"; popup.isTopdown = false; } else { top += lineHeight; renderer.$maxPixelHeight = screenHeight - top - 0.2 * lineHeight; el.style.top = top + "px"; el.style.bottom = ""; popup.isTopdown = true; } el.style.display = ""; this.renderer.$textLayer.checkForSizeChanges(); var left = pos.left; if (left + el.offsetWidth > screenWidth) left = screenWidth - el.offsetWidth; el.style.left = left + "px"; this._signal("show"); lastMouseEvent = null; popup.isOpen = true; }; popup.getTextLeftOffset = function() { return this.$borderSize + this.renderer.$padding + this.$imageSize; }; popup.$imageSize = 0; popup.$borderSize = 1; return popup; }; dom.importCssString("\ .ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line {\ background-color: #CAD6FA;\ z-index: 1;\ }\ .ace_editor.ace_autocomplete .ace_line-hover {\ border: 1px solid #abbffe;\ margin-top: -1px;\ background: rgba(233,233,253,0.4);\ }\ .ace_editor.ace_autocomplete .ace_line-hover {\ position: absolute;\ z-index: 2;\ }\ .ace_editor.ace_autocomplete .ace_scroller {\ background: none;\ border: none;\ box-shadow: none;\ }\ .ace_rightAlignedText {\ color: gray;\ display: inline-block;\ position: absolute;\ right: 4px;\ text-align: right;\ z-index: -1;\ }\ .ace_editor.ace_autocomplete .ace_completion-highlight{\ color: #000;\ text-shadow: 0 0 0.01em;\ }\ .ace_editor.ace_autocomplete {\ width: 280px;\ z-index: 200000;\ background: #fbfbfb;\ color: #444;\ border: 1px lightgray solid;\ position: fixed;\ box-shadow: 2px 3px 5px rgba(0,0,0,.2);\ line-height: 1.4;\ }"); exports.AcePopup = AcePopup; }); ================================================ FILE: lib/ace/autocomplete/text_completer.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { var Range = require("../range").Range; var splitRegex = /[^a-zA-Z_0-9\$\-\u00C0-\u1FFF\u2C00-\uD7FF\w]+/; function getWordIndex(doc, pos) { var textBefore = doc.getTextRange(Range.fromPoints({row: 0, column:0}, pos)); return textBefore.split(splitRegex).length - 1; } /** * Does a distance analysis of the word `prefix` at position `pos` in `doc`. * @return Map */ function wordDistance(doc, pos) { var prefixPos = getWordIndex(doc, pos); var words = doc.getValue().split(splitRegex); var wordScores = Object.create(null); var currentWord = words[prefixPos]; words.forEach(function(word, idx) { if (!word || word === currentWord) return; var distance = Math.abs(prefixPos - idx); var score = words.length - distance; if (wordScores[word]) { wordScores[word] = Math.max(score, wordScores[word]); } else { wordScores[word] = score; } }); return wordScores; } exports.getCompletions = function(editor, session, pos, prefix, callback) { var wordScore = wordDistance(session, pos); var wordList = Object.keys(wordScore); callback(null, wordList.map(function(word) { return { caption: word, value: word, score: wordScore[word], meta: "local" }; })); }; }); ================================================ FILE: lib/ace/autocomplete/util.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; exports.parForEach = function(array, fn, callback) { var completed = 0; var arLength = array.length; if (arLength === 0) callback(); for (var i = 0; i < arLength; i++) { fn(array[i], function(result, err) { completed++; if (completed === arLength) callback(result, err); }); } }; var ID_REGEX = /[a-zA-Z_0-9\$\-\u00A2-\uFFFF]/; exports.retrievePrecedingIdentifier = function(text, pos, regex) { regex = regex || ID_REGEX; var buf = []; for (var i = pos-1; i >= 0; i--) { if (regex.test(text[i])) buf.push(text[i]); else break; } return buf.reverse().join(""); }; exports.retrieveFollowingIdentifier = function(text, pos, regex) { regex = regex || ID_REGEX; var buf = []; for (var i = pos; i < text.length; i++) { if (regex.test(text[i])) buf.push(text[i]); else break; } return buf; }; exports.getCompletionPrefix = function (editor) { var pos = editor.getCursorPosition(); var line = editor.session.getLine(pos.row); var prefix; editor.completers.forEach(function(completer) { if (completer.identifierRegexps) { completer.identifierRegexps.forEach(function(identifierRegex) { if (!prefix && identifierRegex) prefix = this.retrievePrecedingIdentifier(line, pos.column, identifierRegex); }.bind(this)); } }.bind(this)); return prefix || this.retrievePrecedingIdentifier(line, pos.column); }; }); ================================================ FILE: lib/ace/autocomplete.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var HashHandler = require("./keyboard/hash_handler").HashHandler; var AcePopup = require("./autocomplete/popup").AcePopup; var util = require("./autocomplete/util"); var event = require("./lib/event"); var lang = require("./lib/lang"); var dom = require("./lib/dom"); var snippetManager = require("./snippets").snippetManager; var Autocomplete = function() { this.autoInsert = false; this.autoSelect = true; this.exactMatch = false; this.gatherCompletionsId = 0; this.keyboardHandler = new HashHandler(); this.keyboardHandler.bindKeys(this.commands); this.blurListener = this.blurListener.bind(this); this.changeListener = this.changeListener.bind(this); this.mousedownListener = this.mousedownListener.bind(this); this.mousewheelListener = this.mousewheelListener.bind(this); this.changeTimer = lang.delayedCall(function() { this.updateCompletions(true); }.bind(this)); this.tooltipTimer = lang.delayedCall(this.updateDocTooltip.bind(this), 50); }; (function() { this.$init = function() { this.popup = new AcePopup(document.body || document.documentElement); this.popup.on("click", function(e) { this.insertMatch(); e.stop(); }.bind(this)); this.popup.focus = this.editor.focus.bind(this.editor); this.popup.on("show", this.tooltipTimer.bind(null, null)); this.popup.on("select", this.tooltipTimer.bind(null, null)); this.popup.on("changeHoverMarker", this.tooltipTimer.bind(null, null)); return this.popup; }; this.getPopup = function() { return this.popup || this.$init(); }; this.openPopup = function(editor, prefix, keepPopupPosition) { if (!this.popup) this.$init(); this.popup.autoSelect = this.autoSelect; this.popup.setData(this.completions.filtered); editor.keyBinding.addKeyboardHandler(this.keyboardHandler); var renderer = editor.renderer; this.popup.setRow(this.autoSelect ? 0 : -1); if (!keepPopupPosition) { this.popup.setTheme(editor.getTheme()); this.popup.setFontSize(editor.getFontSize()); var lineHeight = renderer.layerConfig.lineHeight; var pos = renderer.$cursorLayer.getPixelPosition(this.base, true); pos.left -= this.popup.getTextLeftOffset(); var rect = editor.container.getBoundingClientRect(); pos.top += rect.top - renderer.layerConfig.offset; pos.left += rect.left - editor.renderer.scrollLeft; pos.left += renderer.gutterWidth; this.popup.show(pos, lineHeight); } else if (keepPopupPosition && !prefix) { this.detach(); } }; this.detach = function() { this.editor.keyBinding.removeKeyboardHandler(this.keyboardHandler); this.editor.off("changeSelection", this.changeListener); this.editor.off("blur", this.blurListener); this.editor.off("mousedown", this.mousedownListener); this.editor.off("mousewheel", this.mousewheelListener); this.changeTimer.cancel(); this.hideDocTooltip(); this.gatherCompletionsId += 1; if (this.popup && this.popup.isOpen) this.popup.hide(); if (this.base) this.base.detach(); this.activated = false; this.completions = this.base = null; }; this.changeListener = function(e) { var cursor = this.editor.selection.lead; if (cursor.row != this.base.row || cursor.column < this.base.column) { this.detach(); } if (this.activated) this.changeTimer.schedule(); else this.detach(); }; this.blurListener = function(e) { // we have to check if activeElement is a child of popup because // on IE preventDefault doesn't stop scrollbar from being focussed var el = document.activeElement; var text = this.editor.textInput.getElement(); var fromTooltip = e.relatedTarget && this.tooltipNode && this.tooltipNode.contains(e.relatedTarget); var container = this.popup && this.popup.container; if (el != text && el.parentNode != container && !fromTooltip && el != this.tooltipNode && e.relatedTarget != text ) { this.detach(); } }; this.mousedownListener = function(e) { this.detach(); }; this.mousewheelListener = function(e) { this.detach(); }; this.goTo = function(where) { var row = this.popup.getRow(); var max = this.popup.session.getLength() - 1; switch(where) { case "up": row = row <= 0 ? max : row - 1; break; case "down": row = row >= max ? -1 : row + 1; break; case "start": row = 0; break; case "end": row = max; break; } this.popup.setRow(row); }; this.insertMatch = function(data, options) { if (!data) data = this.popup.getData(this.popup.getRow()); if (!data) return false; if (data.completer && data.completer.insertMatch) { data.completer.insertMatch(this.editor, data); } else { // TODO add support for options.deleteSuffix if (this.completions.filterText) { var ranges = this.editor.selection.getAllRanges(); for (var i = 0, range; range = ranges[i]; i++) { range.start.column -= this.completions.filterText.length; this.editor.session.remove(range); } } if (data.snippet) snippetManager.insertSnippet(this.editor, data.snippet); else this.editor.execCommand("insertstring", data.value || data); } this.detach(); }; this.commands = { "Up": function(editor) { editor.completer.goTo("up"); }, "Down": function(editor) { editor.completer.goTo("down"); }, "Ctrl-Up|Ctrl-Home": function(editor) { editor.completer.goTo("start"); }, "Ctrl-Down|Ctrl-End": function(editor) { editor.completer.goTo("end"); }, "Esc": function(editor) { editor.completer.detach(); }, "Return": function(editor) { return editor.completer.insertMatch(); }, "Shift-Return": function(editor) { editor.completer.insertMatch(null, {deleteSuffix: true}); }, "Tab": function(editor) { var result = editor.completer.insertMatch(); if (!result && !editor.tabstopManager) editor.completer.goTo("down"); else return result; }, "PageUp": function(editor) { editor.completer.popup.gotoPageUp(); }, "PageDown": function(editor) { editor.completer.popup.gotoPageDown(); } }; this.gatherCompletions = function(editor, callback) { var session = editor.getSession(); var pos = editor.getCursorPosition(); var prefix = util.getCompletionPrefix(editor); this.base = session.doc.createAnchor(pos.row, pos.column - prefix.length); this.base.$insertRight = true; var matches = []; var total = editor.completers.length; editor.completers.forEach(function(completer, i) { completer.getCompletions(editor, session, pos, prefix, function(err, results) { if (!err && results) matches = matches.concat(results); // Fetch prefix again, because they may have changed by now callback(null, { prefix: util.getCompletionPrefix(editor), matches: matches, finished: (--total === 0) }); }); }); return true; }; this.showPopup = function(editor) { if (this.editor) this.detach(); this.activated = true; this.editor = editor; if (editor.completer != this) { if (editor.completer) editor.completer.detach(); editor.completer = this; } editor.on("changeSelection", this.changeListener); editor.on("blur", this.blurListener); editor.on("mousedown", this.mousedownListener); editor.on("mousewheel", this.mousewheelListener); this.updateCompletions(); }; this.updateCompletions = function(keepPopupPosition) { if (keepPopupPosition && this.base && this.completions) { var pos = this.editor.getCursorPosition(); var prefix = this.editor.session.getTextRange({start: this.base, end: pos}); if (prefix == this.completions.filterText) return; this.completions.setFilter(prefix); if (!this.completions.filtered.length) return this.detach(); if (this.completions.filtered.length == 1 && this.completions.filtered[0].value == prefix && !this.completions.filtered[0].snippet) return this.detach(); this.openPopup(this.editor, prefix, keepPopupPosition); return; } // Save current gatherCompletions session, session is close when a match is insert var _id = this.gatherCompletionsId; this.gatherCompletions(this.editor, function(err, results) { // Only detach if result gathering is finished var detachIfFinished = function() { if (!results.finished) return; return this.detach(); }.bind(this); var prefix = results.prefix; var matches = results && results.matches; if (!matches || !matches.length) return detachIfFinished(); // Wrong prefix or wrong session -> ignore if (prefix.indexOf(results.prefix) !== 0 || _id != this.gatherCompletionsId) return; this.completions = new FilteredList(matches); if (this.exactMatch) this.completions.exactMatch = true; this.completions.setFilter(prefix); var filtered = this.completions.filtered; // No results if (!filtered.length) return detachIfFinished(); // One result equals to the prefix if (filtered.length == 1 && filtered[0].value == prefix && !filtered[0].snippet) return detachIfFinished(); // Autoinsert if one result if (this.autoInsert && filtered.length == 1 && results.finished) return this.insertMatch(filtered[0]); this.openPopup(this.editor, prefix, keepPopupPosition); }.bind(this)); }; this.cancelContextMenu = function() { this.editor.$mouseHandler.cancelContextMenu(); }; this.updateDocTooltip = function() { var popup = this.popup; var all = popup.data; var selected = all && (all[popup.getHoveredRow()] || all[popup.getRow()]); var doc = null; if (!selected || !this.editor || !this.popup.isOpen) return this.hideDocTooltip(); this.editor.completers.some(function(completer) { if (completer.getDocTooltip) doc = completer.getDocTooltip(selected); return doc; }); if (!doc) doc = selected; if (typeof doc == "string") doc = {docText: doc}; if (!doc || !(doc.docHTML || doc.docText)) return this.hideDocTooltip(); this.showDocTooltip(doc); }; this.showDocTooltip = function(item) { if (!this.tooltipNode) { this.tooltipNode = dom.createElement("div"); this.tooltipNode.className = "ace_tooltip ace_doc-tooltip"; this.tooltipNode.style.margin = 0; this.tooltipNode.style.pointerEvents = "auto"; this.tooltipNode.tabIndex = -1; this.tooltipNode.onblur = this.blurListener.bind(this); this.tooltipNode.onclick = this.onTooltipClick.bind(this); } var tooltipNode = this.tooltipNode; if (item.docHTML) { tooltipNode.innerHTML = item.docHTML; } else if (item.docText) { tooltipNode.textContent = item.docText; } if (!tooltipNode.parentNode) document.body.appendChild(tooltipNode); var popup = this.popup; var rect = popup.container.getBoundingClientRect(); tooltipNode.style.top = popup.container.style.top; tooltipNode.style.bottom = popup.container.style.bottom; if (window.innerWidth - rect.right < 320) { tooltipNode.style.right = window.innerWidth - rect.left + "px"; tooltipNode.style.left = ""; } else { tooltipNode.style.left = (rect.right + 1) + "px"; tooltipNode.style.right = ""; } tooltipNode.style.display = "block"; }; this.hideDocTooltip = function() { this.tooltipTimer.cancel(); if (!this.tooltipNode) return; var el = this.tooltipNode; if (!this.editor.isFocused() && document.activeElement == el) this.editor.focus(); this.tooltipNode = null; if (el.parentNode) el.parentNode.removeChild(el); }; this.onTooltipClick = function(e) { var a = e.target; while (a && a != this.tooltipNode) { if (a.nodeName == "A" && a.href) { a.rel = "noreferrer"; a.target = "_blank"; break; } a = a.parentNode; } }; }).call(Autocomplete.prototype); Autocomplete.startCommand = { name: "startAutocomplete", exec: function(editor) { if (!editor.completer) editor.completer = new Autocomplete(); editor.completer.autoInsert = false; editor.completer.autoSelect = true; editor.completer.showPopup(editor); // prevent ctrl-space opening context menu on firefox on mac editor.completer.cancelContextMenu(); }, bindKey: "Ctrl-Space|Ctrl-Shift-Space|Alt-Space" }; var FilteredList = function(array, filterText) { this.all = array; this.filtered = array; this.filterText = filterText || ""; this.exactMatch = false; }; (function(){ this.setFilter = function(str) { if (str.length > this.filterText && str.lastIndexOf(this.filterText, 0) === 0) var matches = this.filtered; else var matches = this.all; this.filterText = str; matches = this.filterCompletions(matches, this.filterText); matches = matches.sort(function(a, b) { return b.exactMatch - a.exactMatch || b.score - a.score; }); // make unique var prev = null; matches = matches.filter(function(item){ var caption = item.snippet || item.caption || item.value; if (caption === prev) return false; prev = caption; return true; }); this.filtered = matches; }; this.filterCompletions = function(items, needle) { var results = []; var upper = needle.toUpperCase(); var lower = needle.toLowerCase(); loop: for (var i = 0, item; item = items[i]; i++) { var caption = item.value || item.caption || item.snippet; if (!caption) continue; var lastIndex = -1; var matchMask = 0; var penalty = 0; var index, distance; if (this.exactMatch) { if (needle !== caption.substr(0, needle.length)) continue loop; }else{ // caption char iteration is faster in Chrome but slower in Firefox, so lets use indexOf for (var j = 0; j < needle.length; j++) { // TODO add penalty on case mismatch var i1 = caption.indexOf(lower[j], lastIndex + 1); var i2 = caption.indexOf(upper[j], lastIndex + 1); index = (i1 >= 0) ? ((i2 < 0 || i1 < i2) ? i1 : i2) : i2; if (index < 0) continue loop; distance = index - lastIndex - 1; if (distance > 0) { // first char mismatch should be more sensitive if (lastIndex === -1) penalty += 10; penalty += distance; } matchMask = matchMask | (1 << index); lastIndex = index; } } item.matchMask = matchMask; item.exactMatch = penalty ? 0 : 1; item.score = (item.score || 0) - penalty; results.push(item); } return results; }; }).call(FilteredList.prototype); exports.Autocomplete = Autocomplete; exports.FilteredList = FilteredList; }); ================================================ FILE: lib/ace/background_tokenizer.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var EventEmitter = require("./lib/event_emitter").EventEmitter; /** * Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use. * * If a certain row is changed, everything below that row is re-tokenized. * * @class BackgroundTokenizer **/ /** * Creates a new `BackgroundTokenizer` object. * @param {Tokenizer} tokenizer The tokenizer to use * @param {Editor} editor The editor to associate with * * @constructor **/ var BackgroundTokenizer = function(tokenizer, editor) { this.running = false; this.lines = []; this.states = []; this.currentLine = 0; this.tokenizer = tokenizer; var self = this; this.$worker = function() { if (!self.running) { return; } var workerStart = new Date(); var currentLine = self.currentLine; var endLine = -1; var doc = self.doc; var startLine = currentLine; while (self.lines[currentLine]) currentLine++; var len = doc.getLength(); var processedLines = 0; self.running = false; while (currentLine < len) { self.$tokenizeRow(currentLine); endLine = currentLine; do { currentLine++; } while (self.lines[currentLine]); // only check every 5 lines processedLines ++; if ((processedLines % 5 === 0) && (new Date() - workerStart) > 20) { self.running = setTimeout(self.$worker, 20); break; } } self.currentLine = currentLine; if (endLine == -1) endLine = currentLine; if (startLine <= endLine) self.fireUpdateEvent(startLine, endLine); }; }; (function(){ oop.implement(this, EventEmitter); /** * Sets a new tokenizer for this object. * * @param {Tokenizer} tokenizer The new tokenizer to use * **/ this.setTokenizer = function(tokenizer) { this.tokenizer = tokenizer; this.lines = []; this.states = []; this.start(0); }; /** * Sets a new document to associate with this object. * @param {Document} doc The new document to associate with **/ this.setDocument = function(doc) { this.doc = doc; this.lines = []; this.states = []; this.stop(); }; /** * Fires whenever the background tokeniziers between a range of rows are going to be updated. * * @event update * @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated. * **/ /** * Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated. * @param {Number} firstRow The starting row region * @param {Number} lastRow The final row region * **/ this.fireUpdateEvent = function(firstRow, lastRow) { var data = { first: firstRow, last: lastRow }; this._signal("update", {data: data}); }; /** * Starts tokenizing at the row indicated. * * @param {Number} startRow The row to start at * **/ this.start = function(startRow) { this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength()); // remove all cached items below this line this.lines.splice(this.currentLine, this.lines.length); this.states.splice(this.currentLine, this.states.length); this.stop(); // pretty long delay to prevent the tokenizer from interfering with the user this.running = setTimeout(this.$worker, 700); }; this.scheduleStart = function() { if (!this.running) this.running = setTimeout(this.$worker, 700); }; this.$updateOnChange = function(delta) { var startRow = delta.start.row; var len = delta.end.row - startRow; if (len === 0) { this.lines[startRow] = null; } else if (delta.action == "remove") { this.lines.splice(startRow, len + 1, null); this.states.splice(startRow, len + 1, null); } else { var args = Array(len + 1); args.unshift(startRow, 1); this.lines.splice.apply(this.lines, args); this.states.splice.apply(this.states, args); } this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength()); this.stop(); }; /** * Stops tokenizing. * **/ this.stop = function() { if (this.running) clearTimeout(this.running); this.running = false; }; /** * Gives list of tokens of the row. (tokens are cached) * * @param {Number} row The row to get tokens at * * * **/ this.getTokens = function(row) { return this.lines[row] || this.$tokenizeRow(row); }; /** * [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState} * * @param {Number} row The row to get state at **/ this.getState = function(row) { if (this.currentLine == row) this.$tokenizeRow(row); return this.states[row] || "start"; }; this.$tokenizeRow = function(row) { var line = this.doc.getLine(row); var state = this.states[row - 1]; var data = this.tokenizer.getLineTokens(line, state, row); if (this.states[row] + "" !== data.state + "") { this.states[row] = data.state; this.lines[row + 1] = null; if (this.currentLine > row + 1) this.currentLine = row + 1; } else if (this.currentLine == row) { this.currentLine = row + 1; } return this.lines[row] = data.tokens; }; }).call(BackgroundTokenizer.prototype); exports.BackgroundTokenizer = BackgroundTokenizer; }); ================================================ FILE: lib/ace/background_tokenizer_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var EditSession = require("./edit_session").EditSession; var JavaScriptMode = require("./mode/javascript").Mode; var LuaMode = require("./mode/lua").Mode; var Range = require("./range").Range; var assert = require("./test/assertions"); function forceTokenize(session, startLine) { for (var i = startLine || 0, l = session.getLength(); i < l; i++) session.getTokens(i); } function testStates(session, states) { for (var i = 0, l = session.getLength(); i < l; i++) assert.equal(session.bgTokenizer.states[i], states[i]); assert.ok(l == states.length); } module.exports = { "test background tokenizer update on session change" : function() { var doc = new EditSession([ "/*", "*/", "var juhu" ]); doc.setMode("./mode/javascript"); forceTokenize(doc); testStates(doc, ["comment1", "start", "no_regex"]); doc.remove(new Range(0,2,1,2)); testStates(doc, [null, "no_regex"]); forceTokenize(doc); testStates(doc, ["comment1", "comment1"]); doc.insert({row:0, column:2}, "\n*/"); testStates(doc, [undefined, undefined, "comment1"]); forceTokenize(doc); testStates(doc, ["comment1", "start", "no_regex"]); }, "test background tokenizer sends update event" : function() { var doc = new EditSession([ "/*", "var", "juhu", "*/" ]); doc.setMode("./mode/javascript"); var updateEvent = null; doc.bgTokenizer.on("update", function(e) { updateEvent = e.data; }); function checkEvent(first, last) { assert.ok(!updateEvent, "unneccessary update event"); doc.bgTokenizer.running = 1; doc.bgTokenizer.$worker(); assert.ok(updateEvent); assert.equal([first, last] + "", [updateEvent.first, updateEvent.last] + ""); updateEvent = null; } forceTokenize(doc); var comment = "comment1"; testStates(doc, [comment, comment, comment, "start"]); doc.remove(new Range(0,0,0,2)); testStates(doc, [comment, comment, comment, "start"]); checkEvent(0, 3); testStates(doc, ["start", "no_regex", "no_regex", "regex"]); // insert /* and and press down several times quickly doc.insert({row:0, column:0}, "/*"); doc.getTokens(0); doc.getTokens(1); doc.getTokens(2); checkEvent(0, 3); forceTokenize(doc); testStates(doc, [comment, comment, comment, "start"]); }, "test background tokenizer sends update event 2" : function(next) { var doc = new EditSession([ "-[[", "juhu", "kinners]]--", "" ]); doc.setMode("./mode/lua"); forceTokenize(doc); var string = "bracketedString,2,start"; var comment = "bracketedComment,2,start"; testStates(doc, [string, string, "start", "start"]); doc.insert({row:0, column:0}, "-"); forceTokenize(doc); doc.bgTokenizer.once("update", function(e) { assert.equal([0, 4] + "", [e.data.first, e.data.last] + ""); testStates(doc, [comment, comment, "start", "start"]); next(); }); doc.bgTokenizer.running = 1; doc.bgTokenizer.$worker(); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/bidihandler.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var bidiUtil = require("./lib/bidiutil"); var lang = require("./lib/lang"); var useragent = require("./lib/useragent"); var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/; /** * This object is used to ensure Bi-Directional support (for languages with text flowing from right to left, like Arabic or Hebrew) * including correct caret positioning, text selection mouse and keyboard arrows functioning * @class BidiHandler **/ /** * Creates a new `BidiHandler` object * @param {EditSession} session The session to use * * @constructor **/ var BidiHandler = function(session) { this.session = session; this.bidiMap = {}; /* current screen row */ this.currentRow = null; this.bidiUtil = bidiUtil; /* Arabic/Hebrew character width differs from regular character width */ this.charWidths = []; this.EOL = "\xAC"; this.showInvisibles = true; this.isRtlDir = false; this.line = ""; this.wrapIndent = 0; this.isLastRow = false; this.EOF = "\xB6"; this.seenBidi = false; }; (function() { /** * Returns 'true' if row contains Bidi characters, in such case * creates Bidi map to be used in operations related to selection * (keyboard arrays, mouse click, select) * @param {Number} the screen row to be checked * @param {Number} the document row to be checked [optional] * @param {Number} the wrapped screen line index [ optional] **/ this.isBidiRow = function(screenRow, docRow, splitIndex) { if (!this.seenBidi) return false; if (screenRow !== this.currentRow) { this.currentRow = screenRow; this.updateRowLine(docRow, splitIndex); this.updateBidiMap(); } return this.bidiMap.bidiLevels; }; this.onChange = function(delta) { if (!this.seenBidi) { if (delta.action == "insert" && bidiRE.test(delta.lines.join("\n"))) { this.seenBidi = true; this.currentRow = null; } } else { this.currentRow = null; } }; this.getDocumentRow = function() { var docRow = 0; var rowCache = this.session.$screenRowCache; if (rowCache.length) { var index = this.session.$getRowCacheIndex(rowCache, this.currentRow); if (index >= 0) docRow = this.session.$docRowCache[index]; } return docRow; }; this.getSplitIndex = function() { var splitIndex = 0; var rowCache = this.session.$screenRowCache; if (rowCache.length) { var currentIndex, prevIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow); while (this.currentRow - splitIndex > 0) { currentIndex = this.session.$getRowCacheIndex(rowCache, this.currentRow - splitIndex - 1); if (currentIndex !== prevIndex) break; prevIndex = currentIndex; splitIndex++; } } return splitIndex; }; this.updateRowLine = function(docRow, splitIndex) { if (docRow === undefined) docRow = this.getDocumentRow(); this.wrapIndent = 0; this.isLastRow = (docRow === this.session.getLength() - 1); this.line = this.session.getLine(docRow); if (this.session.$useWrapMode) { var splits = this.session.$wrapData[docRow]; if (splits) { if (splitIndex === undefined) splitIndex = this.getSplitIndex(); if(splitIndex > 0 && splits.length) { this.wrapIndent = splits.indent; this.line = (splitIndex < splits.length) ? this.line.substring(splits[splitIndex - 1], splits[splits.length - 1]) : this.line.substring(splits[splits.length - 1]); } else { this.line = this.line.substring(0, splits[splitIndex]); } } } /* replace tab and wide characters by commensurate spaces */ var session = this.session, shift = 0, size; this.line = this.line.replace(/\t|[\u1100-\u2029, \u202F-\uFFE6]/g, function(ch, i){ if (ch === '\t' || session.isFullWidth(ch.charCodeAt(0))) { size = (ch === '\t') ? session.getScreenTabSize(i + shift) : 2; shift += size - 1; return lang.stringRepeat(bidiUtil.DOT, size); } return ch; }); }; this.updateBidiMap = function() { var textCharTypes = [], endOfLine = this.isLastRow ? this.EOF : this.EOL; var line = this.line + (this.showInvisibles ? endOfLine : bidiUtil.DOT); if (bidiUtil.hasBidiCharacters(line, textCharTypes)) { this.bidiMap = bidiUtil.doBidiReorder(line, textCharTypes, this.isRtlDir); } else { this.bidiMap = {}; } }; /** * Resets stored info related to current screen row **/ this.markAsDirty = function() { this.currentRow = null; }; /** * Updates array of character widths * @param {Object} font metrics * **/ this.updateCharacterWidths = function(fontMetrics) { if (!this.seenBidi) return; if (this.characterWidth === fontMetrics.$characterSize.width) return; var characterWidth = this.characterWidth = fontMetrics.$characterSize.width; var bidiCharWidth = fontMetrics.$measureCharWidth("\u05d4"); this.charWidths[bidiUtil.L] = this.charWidths[bidiUtil.EN] = this.charWidths[bidiUtil.ON_R] = characterWidth; this.charWidths[bidiUtil.R] = this.charWidths[bidiUtil.AN] = bidiCharWidth; this.charWidths[bidiUtil.R_H] = useragent.isChrome ? bidiCharWidth : bidiCharWidth * 0.45; this.charWidths[bidiUtil.B] = 0; this.currentRow = null; }; this.getShowInvisibles = function() { return this.showInvisibles; }; this.setShowInvisibles = function(showInvisibles) { this.showInvisibles = showInvisibles; this.currentRow = null; }; this.setEolChar = function(eolChar) { this.EOL = eolChar; }; this.setTextDir = function(isRtlDir) { this.isRtlDir = isRtlDir; }; /** * Returns offset of character at position defined by column. * @param {Number} the screen column position * * @return {int} horizontal pixel offset of given screen column **/ this.getPosLeft = function(col) { col -= this.wrapIndent; var visualIdx = bidiUtil.getVisualFromLogicalIdx(col > 0 ? col - 1 : 0, this.bidiMap), levels = this.bidiMap.bidiLevels, left = 0; if (col === 0 && levels[visualIdx] % 2 !== 0) visualIdx++; for (var i = 0; i < visualIdx; i++) { left += this.charWidths[levels[i]]; } if (col !== 0 && levels[visualIdx] % 2 === 0) left += this.charWidths[levels[visualIdx]]; if (this.wrapIndent) left += this.wrapIndent * this.charWidths[bidiUtil.L]; return left; }; /** * Returns 'selections' - array of objects defining set of selection rectangles * @param {Number} the start column position * @param {Number} the end column position * * @return {Array of Objects} Each object contains 'left' and 'width' values defining selection rectangle. **/ this.getSelections = function(startCol, endCol) { var map = this.bidiMap, levels = map.bidiLevels, level, offset = this.wrapIndent * this.charWidths[bidiUtil.L], selections = [], selColMin = Math.min(startCol, endCol) - this.wrapIndent, selColMax = Math.max(startCol, endCol) - this.wrapIndent, isSelected = false, isSelectedPrev = false, selectionStart = 0; for (var logIdx, visIdx = 0; visIdx < levels.length; visIdx++) { logIdx = map.logicalFromVisual[visIdx]; level = levels[visIdx]; isSelected = (logIdx >= selColMin) && (logIdx < selColMax); if (isSelected && !isSelectedPrev) { selectionStart = offset; } else if (!isSelected && isSelectedPrev) { selections.push({left: selectionStart, width: offset - selectionStart}); } offset += this.charWidths[level]; isSelectedPrev = isSelected; } if (isSelected && (visIdx === levels.length)) { selections.push({left: selectionStart, width: offset - selectionStart}); } return selections; }; /** * Converts character coordinates on the screen to respective document column number * @param {int} character horizontal offset * * @return {Number} screen column number corresponding to given pixel offset **/ this.offsetToCol = function(posX) { var logicalIdx = 0, posX = Math.max(posX, 0), offset = 0, visualIdx = 0, levels = this.bidiMap.bidiLevels, charWidth = this.charWidths[levels[visualIdx]]; if (this.wrapIndent) { posX -= this.wrapIndent * this.charWidths[bidiUtil.L]; } while(posX > offset + charWidth/2) { offset += charWidth; if(visualIdx === levels.length - 1) { /* quit when we on the right of the last character, flag this by charWidth = 0 */ charWidth = 0; break; } charWidth = this.charWidths[levels[++visualIdx]]; } if (visualIdx > 0 && (levels[visualIdx - 1] % 2 !== 0) && (levels[visualIdx] % 2 === 0)){ /* Bidi character on the left and None Bidi character on the right */ if(posX < offset) visualIdx--; logicalIdx = this.bidiMap.logicalFromVisual[visualIdx]; } else if (visualIdx > 0 && (levels[visualIdx - 1] % 2 === 0) && (levels[visualIdx] % 2 !== 0)){ /* None Bidi character on the left and Bidi character on the right */ logicalIdx = 1 + ((posX > offset) ? this.bidiMap.logicalFromVisual[visualIdx] : this.bidiMap.logicalFromVisual[visualIdx - 1]); } else if ((this.isRtlDir && visualIdx === levels.length - 1 && charWidth === 0 && (levels[visualIdx - 1] % 2 === 0)) || (!this.isRtlDir && visualIdx === 0 && (levels[visualIdx] % 2 !== 0))){ /* To the right of last character, which is None Bidi, in RTL direction or */ /* to the left of first Bidi character, in LTR direction */ logicalIdx = 1 + this.bidiMap.logicalFromVisual[visualIdx]; } else { /* Tweak visual position when Bidi character on the left in order to map it to corresponding logical position */ if (visualIdx > 0 && (levels[visualIdx - 1] % 2 !== 0) && charWidth !== 0) visualIdx--; /* Regular case */ logicalIdx = this.bidiMap.logicalFromVisual[visualIdx]; } return (logicalIdx + this.wrapIndent); }; }).call(BidiHandler.prototype); exports.BidiHandler = BidiHandler; }); ================================================ FILE: lib/ace/clipboard.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; module.exports = { lineMode: false }; }); ================================================ FILE: lib/ace/commands/command_manager.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var MultiHashHandler = require("../keyboard/hash_handler").MultiHashHandler; var EventEmitter = require("../lib/event_emitter").EventEmitter; /** * @class CommandManager * **/ /** * new CommandManager(platform, commands) * @param {String} platform Identifier for the platform; must be either `"mac"` or `"win"` * @param {Array} commands A list of commands * **/ var CommandManager = function(platform, commands) { MultiHashHandler.call(this, commands, platform); this.byName = this.commands; this.setDefaultHandler("exec", function(e) { return e.command.exec(e.editor, e.args || {}); }); }; oop.inherits(CommandManager, MultiHashHandler); (function() { oop.implement(this, EventEmitter); this.exec = function(command, editor, args) { if (Array.isArray(command)) { for (var i = command.length; i--; ) { if (this.exec(command[i], editor, args)) return true; } return false; } if (typeof command === "string") command = this.commands[command]; if (!command) return false; if (editor && editor.$readOnly && !command.readOnly) return false; if (command.isAvailable && !command.isAvailable(editor)) return false; var e = {editor: editor, command: command, args: args}; e.returnValue = this._emit("exec", e); this._signal("afterExec", e); return e.returnValue === false ? false : true; }; this.toggleRecording = function(editor) { if (this.$inReplay) return; editor && editor._emit("changeStatus"); if (this.recording) { this.macro.pop(); this.removeEventListener("exec", this.$addCommandToMacro); if (!this.macro.length) this.macro = this.oldMacro; return this.recording = false; } if (!this.$addCommandToMacro) { this.$addCommandToMacro = function(e) { this.macro.push([e.command, e.args]); }.bind(this); } this.oldMacro = this.macro; this.macro = []; this.on("exec", this.$addCommandToMacro); return this.recording = true; }; this.replay = function(editor) { if (this.$inReplay || !this.macro) return; if (this.recording) return this.toggleRecording(editor); try { this.$inReplay = true; this.macro.forEach(function(x) { if (typeof x == "string") this.exec(x, editor); else this.exec(x[0], editor, x[1]); }, this); } finally { this.$inReplay = false; } }; this.trimMacro = function(m) { return m.map(function(x){ if (typeof x[0] != "string") x[0] = x[0].name; if (!x[1]) x = x[0]; return x; }); }; }).call(CommandManager.prototype); exports.CommandManager = CommandManager; }); ================================================ FILE: lib/ace/commands/command_manager_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var CommandManager = require("./command_manager").CommandManager; var keys = require("../lib/keys"); var assert = require("../test/assertions"); module.exports = { setUp: function() { this.command = { name: "gotoline", bindKey: { mac: "Command-L", win: "Ctrl-L" }, called: false, available: true, exec: function(editor) { this.called = true; }, isAvailable: function(editor) { return this.available; } }; this.cm = new CommandManager("mac", [this.command]); }, "test: register command": function() { this.cm.exec("gotoline"); assert.ok(this.command.called); }, "test: mac hotkeys": function() { var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l"); assert.equal(command, this.command); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "l"); assert.equal(command, undefined); }, "test: win hotkeys": function() { var cm = new CommandManager("win", [this.command]); var command = cm.findKeyCommand(keys.KEY_MODS.command, "l"); assert.equal(command, undefined); var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "l"); assert.equal(command, this.command); }, "test: command isAvailable": function() { this.command.available = false; this.cm.exec("gotoline"); assert.ok(!this.command.called); }, "test: remove command by object": function() { this.cm.removeCommand(this.command); this.cm.exec("gotoline"); assert.ok(!this.command.called); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l"); assert.equal(command, null); }, "test: remove command by name": function() { this.cm.removeCommand("gotoline"); this.cm.exec("gotoline"); assert.ok(!this.command.called); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l"); assert.equal(command, null); }, "test: adding a new command with the same name as an existing one should remove the old one first": function() { var command = { name: "gotoline", bindKey: { mac: "Command-L", win: "Ctrl-L" }, called: false, exec: function(editor) { this.called = true; } }; this.cm.addCommand(command); this.cm.exec("gotoline"); assert.ok(command.called); assert.ok(!this.command.called); assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "l"), command); }, "test: adding commands and recording a macro": function() { var called = ""; this.cm.addCommands({ togglerecording: function(editor) { editor.cm.toggleRecording(editor); }, replay: function(editor) { editor.cm.replay(); }, cm1: function(editor, arg) { called += "1" + (arg || ""); }, cm2: function(editor) { called += "2"; } }); var statusUpdateEmitted = false; this._emit = function() {statusUpdateEmitted = true;}; this.cm.exec("togglerecording", this); assert.ok(this.cm.recording); assert.ok(statusUpdateEmitted); this.cm.exec("cm1", this, "-"); this.cm.exec("cm2"); this.cm.exec("replay", this); assert.ok(!this.cm.recording); assert.equal(called, "1-2"); called = ""; this.cm.exec("replay", this); assert.equal(called, "1-2"); }, "test: bindkeys": function() { this.cm.bindKeys({ "Ctrl-L|Command-C": "cm1", "Ctrl-R": "cm2" }); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "c"); assert.equal(command, "cm1"); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r"); assert.equal(command, "cm2"); this.cm.bindKeys({ "Ctrl-R": null }); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r"); assert.equal(command, null); }, "test: binding keys without modifiers": function() { this.cm.bindKeys({ "R": "cm1", "Shift-r": "cm2", "Return": "cm4", "Enter": "cm3" }); var command = this.cm.findKeyCommand(-1, "r"); assert.equal(command, "cm1"); var command = this.cm.findKeyCommand(-1, "R"); assert.equal(command, "cm2"); var command = this.cm.findKeyCommand(0, "return"); assert.equal(command + "", ["cm4", "cm3"] + ""); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/commands/default_commands.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var lang = require("../lib/lang"); var config = require("../config"); var Range = require("../range").Range; function bindKey(win, mac) { return {win: win, mac: mac}; } /* multiSelectAction: "forEach"|"forEachLine"|function|undefined, scrollIntoView: true|"cursor"|"center"|"selectionPart" */ exports.commands = [{ name: "showSettingsMenu", bindKey: bindKey("Ctrl-,", "Command-,"), exec: function(editor) { config.loadModule("ace/ext/settings_menu", function(module) { module.init(editor); editor.showSettingsMenu(); }); }, readOnly: true }, { name: "goToNextError", bindKey: bindKey("Alt-E", "F4"), exec: function(editor) { config.loadModule("ace/ext/error_marker", function(module) { module.showErrorMarker(editor, 1); }); }, scrollIntoView: "animate", readOnly: true }, { name: "goToPreviousError", bindKey: bindKey("Alt-Shift-E", "Shift-F4"), exec: function(editor) { config.loadModule("ace/ext/error_marker", function(module) { module.showErrorMarker(editor, -1); }); }, scrollIntoView: "animate", readOnly: true }, { name: "selectall", bindKey: bindKey("Ctrl-A", "Command-A"), exec: function(editor) { editor.selectAll(); }, readOnly: true }, { name: "centerselection", bindKey: bindKey(null, "Ctrl-L"), exec: function(editor) { editor.centerSelection(); }, readOnly: true }, { name: "gotoline", bindKey: bindKey("Ctrl-L", "Command-L"), exec: function(editor, line) { if (typeof line !== "number") line = parseInt(prompt("Enter line number:"), 10); if (!isNaN(line)) { editor.gotoLine(line); } }, readOnly: true }, { name: "fold", bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"), exec: function(editor) { editor.session.toggleFold(false); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "unfold", bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"), exec: function(editor) { editor.session.toggleFold(true); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "toggleFoldWidget", bindKey: bindKey("F2", "F2"), exec: function(editor) { editor.session.toggleFoldWidget(); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "toggleParentFoldWidget", bindKey: bindKey("Alt-F2", "Alt-F2"), exec: function(editor) { editor.session.toggleFoldWidget(true); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "foldall", bindKey: bindKey(null, "Ctrl-Command-Option-0"), exec: function(editor) { editor.session.foldAll(); }, scrollIntoView: "center", readOnly: true }, { name: "foldOther", bindKey: bindKey("Alt-0", "Command-Option-0"), exec: function(editor) { editor.session.foldAll(); editor.session.unfold(editor.selection.getAllRanges()); }, scrollIntoView: "center", readOnly: true }, { name: "unfoldall", bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"), exec: function(editor) { editor.session.unfold(); }, scrollIntoView: "center", readOnly: true }, { name: "findnext", bindKey: bindKey("Ctrl-K", "Command-G"), exec: function(editor) { editor.findNext(); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "findprevious", bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"), exec: function(editor) { editor.findPrevious(); }, multiSelectAction: "forEach", scrollIntoView: "center", readOnly: true }, { name: "selectOrFindNext", bindKey: bindKey("Alt-K", "Ctrl-G"), exec: function(editor) { if (editor.selection.isEmpty()) editor.selection.selectWord(); else editor.findNext(); }, readOnly: true }, { name: "selectOrFindPrevious", bindKey: bindKey("Alt-Shift-K", "Ctrl-Shift-G"), exec: function(editor) { if (editor.selection.isEmpty()) editor.selection.selectWord(); else editor.findPrevious(); }, readOnly: true }, { name: "find", bindKey: bindKey("Ctrl-F", "Command-F"), exec: function(editor) { config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor);}); }, readOnly: true }, { name: "overwrite", bindKey: "Insert", exec: function(editor) { editor.toggleOverwrite(); }, readOnly: true }, { name: "selecttostart", bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Home|Command-Shift-Up"), exec: function(editor) { editor.getSelection().selectFileStart(); }, multiSelectAction: "forEach", readOnly: true, scrollIntoView: "animate", aceCommandGroup: "fileJump" }, { name: "gotostart", bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), exec: function(editor) { editor.navigateFileStart(); }, multiSelectAction: "forEach", readOnly: true, scrollIntoView: "animate", aceCommandGroup: "fileJump" }, { name: "selectup", bindKey: bindKey("Shift-Up", "Shift-Up|Ctrl-Shift-P"), exec: function(editor) { editor.getSelection().selectUp(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "golineup", bindKey: bindKey("Up", "Up|Ctrl-P"), exec: function(editor, args) { editor.navigateUp(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selecttoend", bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-End|Command-Shift-Down"), exec: function(editor) { editor.getSelection().selectFileEnd(); }, multiSelectAction: "forEach", readOnly: true, scrollIntoView: "animate", aceCommandGroup: "fileJump" }, { name: "gotoend", bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"), exec: function(editor) { editor.navigateFileEnd(); }, multiSelectAction: "forEach", readOnly: true, scrollIntoView: "animate", aceCommandGroup: "fileJump" }, { name: "selectdown", bindKey: bindKey("Shift-Down", "Shift-Down|Ctrl-Shift-N"), exec: function(editor) { editor.getSelection().selectDown(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "golinedown", bindKey: bindKey("Down", "Down|Ctrl-N"), exec: function(editor, args) { editor.navigateDown(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectwordleft", bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"), exec: function(editor) { editor.getSelection().selectWordLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotowordleft", bindKey: bindKey("Ctrl-Left", "Option-Left"), exec: function(editor) { editor.navigateWordLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selecttolinestart", bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left|Ctrl-Shift-A"), exec: function(editor) { editor.getSelection().selectLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotolinestart", bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"), exec: function(editor) { editor.navigateLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectleft", bindKey: bindKey("Shift-Left", "Shift-Left|Ctrl-Shift-B"), exec: function(editor) { editor.getSelection().selectLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotoleft", bindKey: bindKey("Left", "Left|Ctrl-B"), exec: function(editor, args) { editor.navigateLeft(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectwordright", bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"), exec: function(editor) { editor.getSelection().selectWordRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotowordright", bindKey: bindKey("Ctrl-Right", "Option-Right"), exec: function(editor) { editor.navigateWordRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selecttolineend", bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right|Shift-End|Ctrl-Shift-E"), exec: function(editor) { editor.getSelection().selectLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotolineend", bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"), exec: function(editor) { editor.navigateLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectright", bindKey: bindKey("Shift-Right", "Shift-Right"), exec: function(editor) { editor.getSelection().selectRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "gotoright", bindKey: bindKey("Right", "Right|Ctrl-F"), exec: function(editor, args) { editor.navigateRight(args.times); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectpagedown", bindKey: "Shift-PageDown", exec: function(editor) { editor.selectPageDown(); }, readOnly: true }, { name: "pagedown", bindKey: bindKey(null, "Option-PageDown"), exec: function(editor) { editor.scrollPageDown(); }, readOnly: true }, { name: "gotopagedown", bindKey: bindKey("PageDown", "PageDown|Ctrl-V"), exec: function(editor) { editor.gotoPageDown(); }, readOnly: true }, { name: "selectpageup", bindKey: "Shift-PageUp", exec: function(editor) { editor.selectPageUp(); }, readOnly: true }, { name: "pageup", bindKey: bindKey(null, "Option-PageUp"), exec: function(editor) { editor.scrollPageUp(); }, readOnly: true }, { name: "gotopageup", bindKey: "PageUp", exec: function(editor) { editor.gotoPageUp(); }, readOnly: true }, { name: "scrollup", bindKey: bindKey("Ctrl-Up", null), exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); }, readOnly: true }, { name: "scrolldown", bindKey: bindKey("Ctrl-Down", null), exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); }, readOnly: true }, { name: "selectlinestart", bindKey: "Shift-Home", exec: function(editor) { editor.getSelection().selectLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "selectlineend", bindKey: "Shift-End", exec: function(editor) { editor.getSelection().selectLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "togglerecording", bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"), exec: function(editor) { editor.commands.toggleRecording(editor); }, readOnly: true }, { name: "replaymacro", bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"), exec: function(editor) { editor.commands.replay(editor); }, readOnly: true }, { name: "jumptomatching", bindKey: bindKey("Ctrl-P", "Ctrl-P"), exec: function(editor) { editor.jumpToMatching(); }, multiSelectAction: "forEach", scrollIntoView: "animate", readOnly: true }, { name: "selecttomatching", bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"), exec: function(editor) { editor.jumpToMatching(true); }, multiSelectAction: "forEach", scrollIntoView: "animate", readOnly: true }, { name: "expandToMatching", bindKey: bindKey("Ctrl-Shift-M", "Ctrl-Shift-M"), exec: function(editor) { editor.jumpToMatching(true, true); }, multiSelectAction: "forEach", scrollIntoView: "animate", readOnly: true }, { name: "passKeysToBrowser", bindKey: bindKey(null, null), exec: function() {}, passEvent: true, readOnly: true }, { name: "copy", exec: function(editor) { // placeholder for replay macro }, readOnly: true }, // commands disabled in readOnly mode { name: "cut", exec: function(editor) { var cutLine = editor.$copyWithEmptySelection && editor.selection.isEmpty(); var range = cutLine ? editor.selection.getLineRange() : editor.selection.getRange(); editor._emit("cut", range); if (!range.isEmpty()) editor.session.remove(range); editor.clearSelection(); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "paste", exec: function(editor, args) { editor.$handlePaste(args); }, scrollIntoView: "cursor" }, { name: "removeline", bindKey: bindKey("Ctrl-D", "Command-D"), exec: function(editor) { editor.removeLines(); }, scrollIntoView: "cursor", multiSelectAction: "forEachLine" }, { name: "duplicateSelection", bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), exec: function(editor) { editor.duplicateSelection(); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "sortlines", bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"), exec: function(editor) { editor.sortLines(); }, scrollIntoView: "selection", multiSelectAction: "forEachLine" }, { name: "togglecomment", bindKey: bindKey("Ctrl-/", "Command-/"), exec: function(editor) { editor.toggleCommentLines(); }, multiSelectAction: "forEachLine", scrollIntoView: "selectionPart" }, { name: "toggleBlockComment", bindKey: bindKey("Ctrl-Shift-/", "Command-Shift-/"), exec: function(editor) { editor.toggleBlockComment(); }, multiSelectAction: "forEach", scrollIntoView: "selectionPart" }, { name: "modifyNumberUp", bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"), exec: function(editor) { editor.modifyNumber(1); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "modifyNumberDown", bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"), exec: function(editor) { editor.modifyNumber(-1); }, scrollIntoView: "cursor", multiSelectAction: "forEach" }, { name: "replace", bindKey: bindKey("Ctrl-H", "Command-Option-F"), exec: function(editor) { config.loadModule("ace/ext/searchbox", function(e) {e.Search(editor, true);}); } }, { name: "undo", bindKey: bindKey("Ctrl-Z", "Command-Z"), exec: function(editor) { editor.undo(); } }, { name: "redo", bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"), exec: function(editor) { editor.redo(); } }, { name: "copylinesup", bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"), exec: function(editor) { editor.copyLinesUp(); }, scrollIntoView: "cursor" }, { name: "movelinesup", bindKey: bindKey("Alt-Up", "Option-Up"), exec: function(editor) { editor.moveLinesUp(); }, scrollIntoView: "cursor" }, { name: "copylinesdown", bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"), exec: function(editor) { editor.copyLinesDown(); }, scrollIntoView: "cursor" }, { name: "movelinesdown", bindKey: bindKey("Alt-Down", "Option-Down"), exec: function(editor) { editor.moveLinesDown(); }, scrollIntoView: "cursor" }, { name: "del", bindKey: bindKey("Delete", "Delete|Ctrl-D|Shift-Delete"), exec: function(editor) { editor.remove("right"); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "backspace", bindKey: bindKey( "Shift-Backspace|Backspace", "Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H" ), exec: function(editor) { editor.remove("left"); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "cut_or_delete", bindKey: bindKey("Shift-Delete", null), exec: function(editor) { if (editor.selection.isEmpty()) { editor.remove("left"); } else { return false; } }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removetolinestart", bindKey: bindKey("Alt-Backspace", "Command-Backspace"), exec: function(editor) { editor.removeToLineStart(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removetolineend", bindKey: bindKey("Alt-Delete", "Ctrl-K|Command-Delete"), exec: function(editor) { editor.removeToLineEnd(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removetolinestarthard", bindKey: bindKey("Ctrl-Shift-Backspace", null), exec: function(editor) { var range = editor.selection.getRange(); range.start.column = 0; editor.session.remove(range); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removetolineendhard", bindKey: bindKey("Ctrl-Shift-Delete", null), exec: function(editor) { var range = editor.selection.getRange(); range.end.column = Number.MAX_VALUE; editor.session.remove(range); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removewordleft", bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"), exec: function(editor) { editor.removeWordLeft(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "removewordright", bindKey: bindKey("Ctrl-Delete", "Alt-Delete"), exec: function(editor) { editor.removeWordRight(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "outdent", bindKey: bindKey("Shift-Tab", "Shift-Tab"), exec: function(editor) { editor.blockOutdent(); }, multiSelectAction: "forEach", scrollIntoView: "selectionPart" }, { name: "indent", bindKey: bindKey("Tab", "Tab"), exec: function(editor) { editor.indent(); }, multiSelectAction: "forEach", scrollIntoView: "selectionPart" }, { name: "blockoutdent", bindKey: bindKey("Ctrl-[", "Ctrl-["), exec: function(editor) { editor.blockOutdent(); }, multiSelectAction: "forEachLine", scrollIntoView: "selectionPart" }, { name: "blockindent", bindKey: bindKey("Ctrl-]", "Ctrl-]"), exec: function(editor) { editor.blockIndent(); }, multiSelectAction: "forEachLine", scrollIntoView: "selectionPart" }, { name: "insertstring", exec: function(editor, str) { editor.insert(str); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "inserttext", exec: function(editor, args) { editor.insert(lang.stringRepeat(args.text || "", args.times || 1)); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "splitline", bindKey: bindKey(null, "Ctrl-O"), exec: function(editor) { editor.splitLine(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "transposeletters", bindKey: bindKey("Alt-Shift-X", "Ctrl-T"), exec: function(editor) { editor.transposeLetters(); }, multiSelectAction: function(editor) {editor.transposeSelections(1); }, scrollIntoView: "cursor" }, { name: "touppercase", bindKey: bindKey("Ctrl-U", "Ctrl-U"), exec: function(editor) { editor.toUpperCase(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "tolowercase", bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"), exec: function(editor) { editor.toLowerCase(); }, multiSelectAction: "forEach", scrollIntoView: "cursor" }, { name: "expandtoline", bindKey: bindKey("Ctrl-Shift-L", "Command-Shift-L"), exec: function(editor) { var range = editor.selection.getRange(); range.start.column = range.end.column = 0; range.end.row++; editor.selection.setRange(range, false); }, multiSelectAction: "forEach", scrollIntoView: "cursor", readOnly: true }, { name: "joinlines", bindKey: bindKey(null, null), exec: function(editor) { var isBackwards = editor.selection.isBackwards(); var selectionStart = isBackwards ? editor.selection.getSelectionLead() : editor.selection.getSelectionAnchor(); var selectionEnd = isBackwards ? editor.selection.getSelectionAnchor() : editor.selection.getSelectionLead(); var firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length; var selectedText = editor.session.doc.getTextRange(editor.selection.getRange()); var selectedCount = selectedText.replace(/\n\s*/, " ").length; var insertLine = editor.session.doc.getLine(selectionStart.row); for (var i = selectionStart.row + 1; i <= selectionEnd.row + 1; i++) { var curLine = lang.stringTrimLeft(lang.stringTrimRight(editor.session.doc.getLine(i))); if (curLine.length !== 0) { curLine = " " + curLine; } insertLine += curLine; } if (selectionEnd.row + 1 < (editor.session.doc.getLength() - 1)) { // Don't insert a newline at the end of the document insertLine += editor.session.doc.getNewLineCharacter(); } editor.clearSelection(); editor.session.doc.replace(new Range(selectionStart.row, 0, selectionEnd.row + 2, 0), insertLine); if (selectedCount > 0) { // Select the text that was previously selected editor.selection.moveCursorTo(selectionStart.row, selectionStart.column); editor.selection.selectTo(selectionStart.row, selectionStart.column + selectedCount); } else { // If the joined line had something in it, start the cursor at that something firstLineEndCol = editor.session.doc.getLine(selectionStart.row).length > firstLineEndCol ? (firstLineEndCol + 1) : firstLineEndCol; editor.selection.moveCursorTo(selectionStart.row, firstLineEndCol); } }, multiSelectAction: "forEach", readOnly: true }, { name: "invertSelection", bindKey: bindKey(null, null), exec: function(editor) { var endRow = editor.session.doc.getLength() - 1; var endCol = editor.session.doc.getLine(endRow).length; var ranges = editor.selection.rangeList.ranges; var newRanges = []; // If multiple selections don't exist, rangeList will return 0 so replace with single range if (ranges.length < 1) { ranges = [editor.selection.getRange()]; } for (var i = 0; i < ranges.length; i++) { if (i == (ranges.length - 1)) { // The last selection must connect to the end of the document, unless it already does if (!(ranges[i].end.row === endRow && ranges[i].end.column === endCol)) { newRanges.push(new Range(ranges[i].end.row, ranges[i].end.column, endRow, endCol)); } } if (i === 0) { // The first selection must connect to the start of the document, unless it already does if (!(ranges[i].start.row === 0 && ranges[i].start.column === 0)) { newRanges.push(new Range(0, 0, ranges[i].start.row, ranges[i].start.column)); } } else { newRanges.push(new Range(ranges[i-1].end.row, ranges[i-1].end.column, ranges[i].start.row, ranges[i].start.column)); } } editor.exitMultiSelectMode(); editor.clearSelection(); for(var i = 0; i < newRanges.length; i++) { editor.selection.addRange(newRanges[i], false); } }, readOnly: true, scrollIntoView: "none" }]; }); ================================================ FILE: lib/ace/commands/incremental_search_commands.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { var config = require("../config"); var oop = require("../lib/oop"); var HashHandler = require("../keyboard/hash_handler").HashHandler; var occurStartCommand = require("./occur_commands").occurStartCommand; // These commands can be installed in a normal key handler to start iSearch: exports.iSearchStartCommands = [{ name: "iSearch", bindKey: {win: "Ctrl-F", mac: "Command-F"}, exec: function(editor, options) { config.loadModule(["core", "ace/incremental_search"], function(e) { var iSearch = e.iSearch = e.iSearch || new e.IncrementalSearch(); iSearch.activate(editor, options.backwards); if (options.jumpToFirstMatch) iSearch.next(options); }); }, readOnly: true }, { name: "iSearchBackwards", exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {backwards: true}); }, readOnly: true }, { name: "iSearchAndGo", bindKey: {win: "Ctrl-K", mac: "Command-G"}, exec: function(editor, jumpToNext) { editor.execCommand('iSearch', {jumpToFirstMatch: true, useCurrentOrPrevSearch: true}); }, readOnly: true }, { name: "iSearchBackwardsAndGo", bindKey: {win: "Ctrl-Shift-K", mac: "Command-Shift-G"}, exec: function(editor) { editor.execCommand('iSearch', {jumpToFirstMatch: true, backwards: true, useCurrentOrPrevSearch: true}); }, readOnly: true }]; // These commands are only available when incremental search mode is active: exports.iSearchCommands = [{ name: "restartSearch", bindKey: {win: "Ctrl-F", mac: "Command-F"}, exec: function(iSearch) { iSearch.cancelSearch(true); } }, { name: "searchForward", bindKey: {win: "Ctrl-S|Ctrl-K", mac: "Ctrl-S|Command-G"}, exec: function(iSearch, options) { options.useCurrentOrPrevSearch = true; iSearch.next(options); } }, { name: "searchBackward", bindKey: {win: "Ctrl-R|Ctrl-Shift-K", mac: "Ctrl-R|Command-Shift-G"}, exec: function(iSearch, options) { options.useCurrentOrPrevSearch = true; options.backwards = true; iSearch.next(options); } }, { name: "extendSearchTerm", exec: function(iSearch, string) { iSearch.addString(string); } }, { name: "extendSearchTermSpace", bindKey: "space", exec: function(iSearch) { iSearch.addString(' '); } }, { name: "shrinkSearchTerm", bindKey: "backspace", exec: function(iSearch) { iSearch.removeChar(); } }, { name: 'confirmSearch', bindKey: 'return', exec: function(iSearch) { iSearch.deactivate(); } }, { name: 'cancelSearch', bindKey: 'esc|Ctrl-G', exec: function(iSearch) { iSearch.deactivate(true); } }, { name: 'occurisearch', bindKey: 'Ctrl-O', exec: function(iSearch) { var options = oop.mixin({}, iSearch.$options); iSearch.deactivate(); occurStartCommand.exec(iSearch.$editor, options); } }, { name: "yankNextWord", bindKey: "Ctrl-w", exec: function(iSearch) { var ed = iSearch.$editor, range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorWordRight(); }), string = ed.session.getTextRange(range); iSearch.addString(string); } }, { name: "yankNextChar", bindKey: "Ctrl-Alt-y", exec: function(iSearch) { var ed = iSearch.$editor, range = ed.selection.getRangeOfMovements(function(sel) { sel.moveCursorRight(); }), string = ed.session.getTextRange(range); iSearch.addString(string); } }, { name: 'recenterTopBottom', bindKey: 'Ctrl-l', exec: function(iSearch) { iSearch.$editor.execCommand('recenterTopBottom'); } }, { name: 'selectAllMatches', bindKey: 'Ctrl-space', exec: function(iSearch) { var ed = iSearch.$editor, hl = ed.session.$isearchHighlight, ranges = hl && hl.cache ? hl.cache .reduce(function(ranges, ea) { return ranges.concat(ea ? ea : []); }, []) : []; iSearch.deactivate(false); ranges.forEach(ed.selection.addRange.bind(ed.selection)); } }, { name: 'searchAsRegExp', bindKey: 'Alt-r', exec: function(iSearch) { iSearch.convertNeedleToRegExp(); } }].map(function(cmd) { cmd.readOnly = true; cmd.isIncrementalSearchCommand = true; cmd.scrollIntoView = "animate-cursor"; return cmd; }); function IncrementalSearchKeyboardHandler(iSearch) { this.$iSearch = iSearch; } oop.inherits(IncrementalSearchKeyboardHandler, HashHandler); (function() { this.attach = function(editor) { var iSearch = this.$iSearch; HashHandler.call(this, exports.iSearchCommands, editor.commands.platform); this.$commandExecHandler = editor.commands.addEventListener('exec', function(e) { if (!e.command.isIncrementalSearchCommand) return iSearch.deactivate(); e.stopPropagation(); e.preventDefault(); var scrollTop = editor.session.getScrollTop(); var result = e.command.exec(iSearch, e.args || {}); editor.renderer.scrollCursorIntoView(null, 0.5); editor.renderer.animateScrolling(scrollTop); return result; }); }; this.detach = function(editor) { if (!this.$commandExecHandler) return; editor.commands.removeEventListener('exec', this.$commandExecHandler); delete this.$commandExecHandler; }; var handleKeyboard$super = this.handleKeyboard; this.handleKeyboard = function(data, hashId, key, keyCode) { if (((hashId === 1/*ctrl*/ || hashId === 8/*command*/) && key === 'v') || (hashId === 1/*ctrl*/ && key === 'y')) return null; var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); if (cmd.command) { return cmd; } if (hashId == -1) { var extendCmd = this.commands.extendSearchTerm; if (extendCmd) { return {command: extendCmd, args: key}; } } return false; }; }).call(IncrementalSearchKeyboardHandler.prototype); exports.IncrementalSearchKeyboardHandler = IncrementalSearchKeyboardHandler; }); ================================================ FILE: lib/ace/commands/multi_select_commands.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { // commands to enter multiselect mode exports.defaultCommands = [{ name: "addCursorAbove", exec: function(editor) { editor.selectMoreLines(-1); }, bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"}, scrollIntoView: "cursor", readOnly: true }, { name: "addCursorBelow", exec: function(editor) { editor.selectMoreLines(1); }, bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"}, scrollIntoView: "cursor", readOnly: true }, { name: "addCursorAboveSkipCurrent", exec: function(editor) { editor.selectMoreLines(-1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"}, scrollIntoView: "cursor", readOnly: true }, { name: "addCursorBelowSkipCurrent", exec: function(editor) { editor.selectMoreLines(1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectMoreBefore", exec: function(editor) { editor.selectMore(-1); }, bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectMoreAfter", exec: function(editor) { editor.selectMore(1); }, bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectNextBefore", exec: function(editor) { editor.selectMore(-1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"}, scrollIntoView: "cursor", readOnly: true }, { name: "selectNextAfter", exec: function(editor) { editor.selectMore(1, true); }, bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"}, scrollIntoView: "cursor", readOnly: true }, { name: "splitIntoLines", exec: function(editor) { editor.multiSelect.splitIntoLines(); }, bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"}, readOnly: true }, { name: "alignCursors", exec: function(editor) { editor.alignCursors(); }, bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}, scrollIntoView: "cursor" }, { name: "findAll", exec: function(editor) { editor.findAll(); }, bindKey: {win: "Ctrl-Alt-K", mac: "Ctrl-Alt-G"}, scrollIntoView: "cursor", readOnly: true }]; // commands active only in multiselect mode exports.multiSelectCommands = [{ name: "singleSelection", bindKey: "esc", exec: function(editor) { editor.exitMultiSelectMode(); }, scrollIntoView: "cursor", readOnly: true, isAvailable: function(editor) {return editor && editor.inMultiSelectMode;} }]; var HashHandler = require("../keyboard/hash_handler").HashHandler; exports.keyboardHandler = new HashHandler(exports.multiSelectCommands); }); ================================================ FILE: lib/ace/commands/occur_commands.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { var config = require("../config"), Occur = require("../occur").Occur; // These commands can be installed in a normal command handler to start occur: var occurStartCommand = { name: "occur", exec: function(editor, options) { var alreadyInOccur = !!editor.session.$occur; var occurSessionActive = new Occur().enter(editor, options); if (occurSessionActive && !alreadyInOccur) OccurKeyboardHandler.installIn(editor); }, readOnly: true }; var occurCommands = [{ name: "occurexit", bindKey: 'esc|Ctrl-G', exec: function(editor) { var occur = editor.session.$occur; if (!occur) return; occur.exit(editor, {}); if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); }, readOnly: true }, { name: "occuraccept", bindKey: 'enter', exec: function(editor) { var occur = editor.session.$occur; if (!occur) return; occur.exit(editor, {translatePosition: true}); if (!editor.session.$occur) OccurKeyboardHandler.uninstallFrom(editor); }, readOnly: true }]; var HashHandler = require("../keyboard/hash_handler").HashHandler; var oop = require("../lib/oop"); function OccurKeyboardHandler() {} oop.inherits(OccurKeyboardHandler, HashHandler); (function() { this.isOccurHandler = true; this.attach = function(editor) { HashHandler.call(this, occurCommands, editor.commands.platform); this.$editor = editor; }; var handleKeyboard$super = this.handleKeyboard; this.handleKeyboard = function(data, hashId, key, keyCode) { var cmd = handleKeyboard$super.call(this, data, hashId, key, keyCode); return (cmd && cmd.command) ? cmd : undefined; }; }).call(OccurKeyboardHandler.prototype); OccurKeyboardHandler.installIn = function(editor) { var handler = new this(); editor.keyBinding.addKeyboardHandler(handler); editor.commands.addCommands(occurCommands); }; OccurKeyboardHandler.uninstallFrom = function(editor) { editor.commands.removeCommands(occurCommands); var handler = editor.getKeyboardHandler(); if (handler.isOccurHandler) editor.keyBinding.removeKeyboardHandler(handler); }; exports.occurStartCommand = occurStartCommand; }); ================================================ FILE: lib/ace/config.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "no use strict"; var lang = require("./lib/lang"); var oop = require("./lib/oop"); var net = require("./lib/net"); var AppConfig = require("./lib/app_config").AppConfig; module.exports = exports = new AppConfig(); var global = (function() { return this || typeof window != "undefined" && window; })(); var options = { packaged: false, workerPath: null, modePath: null, themePath: null, basePath: "", suffix: ".js", $moduleUrls: {} }; exports.get = function(key) { if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); return options[key]; }; exports.set = function(key, value) { if (!options.hasOwnProperty(key)) throw new Error("Unknown config key: " + key); options[key] = value; }; exports.all = function() { return lang.copyObject(options); }; // module loading exports.moduleUrl = function(name, component) { if (options.$moduleUrls[name]) return options.$moduleUrls[name]; var parts = name.split("/"); component = component || parts[parts.length - 2] || ""; // todo make this configurable or get rid of '-' var sep = component == "snippets" ? "/" : "-"; var base = parts[parts.length - 1]; if (component == "worker" && sep == "-") { var re = new RegExp("^" + component + "[\\-_]|[\\-_]" + component + "$", "g"); base = base.replace(re, ""); } if ((!base || base == component) && parts.length > 1) base = parts[parts.length - 2]; var path = options[component + "Path"]; if (path == null) { path = options.basePath; } else if (sep == "/") { component = sep = ""; } if (path && path.slice(-1) != "/") path += "/"; return path + component + sep + base + this.get("suffix"); }; exports.setModuleUrl = function(name, subst) { return options.$moduleUrls[name] = subst; }; exports.$loading = {}; exports.loadModule = function(moduleName, onLoad) { var module, moduleType; if (Array.isArray(moduleName)) { moduleType = moduleName[0]; moduleName = moduleName[1]; } try { module = require(moduleName); } catch (e) {} // require(moduleName) can return empty object if called after require([moduleName], callback) if (module && !exports.$loading[moduleName]) return onLoad && onLoad(module); if (!exports.$loading[moduleName]) exports.$loading[moduleName] = []; exports.$loading[moduleName].push(onLoad); if (exports.$loading[moduleName].length > 1) return; var afterLoad = function() { require([moduleName], function(module) { exports._emit("load.module", {name: moduleName, module: module}); var listeners = exports.$loading[moduleName]; exports.$loading[moduleName] = null; listeners.forEach(function(onLoad) { onLoad && onLoad(module); }); }); }; if (!exports.get("packaged")) return afterLoad(); net.loadScript(exports.moduleUrl(moduleName, moduleType), afterLoad); }; // initialization function init(packaged) { if (!global || !global.document) return; options.packaged = packaged || require.packaged || module.packaged || (global.define && define.packaged); var scriptOptions = {}; var scriptUrl = ""; // Use currentScript.ownerDocument in case this file was loaded from imported document. (HTML Imports) var currentScript = (document.currentScript || document._currentScript ); // native or polyfill var currentDocument = currentScript && currentScript.ownerDocument || document; var scripts = currentDocument.getElementsByTagName("script"); for (var i=0; i .ace_gutter-cell { padding-right: 13px; } .ace_fold-widget { -moz-box-sizing: border-box; -webkit-box-sizing: border-box; box-sizing: border-box; margin: 0 -12px 0 1px; display: none; width: 11px; vertical-align: top; background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg=="); background-repeat: no-repeat; background-position: center; border-radius: 3px; border: 1px solid transparent; cursor: pointer; } .ace_folding-enabled .ace_fold-widget { display: inline-block; } .ace_fold-widget.ace_end { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg=="); } .ace_fold-widget.ace_closed { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA=="); } .ace_fold-widget:hover { border: 1px solid rgba(0, 0, 0, 0.3); background-color: rgba(255, 255, 255, 0.2); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); } .ace_fold-widget:active { border: 1px solid rgba(0, 0, 0, 0.4); background-color: rgba(0, 0, 0, 0.05); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8); } /** * Dark version for fold widgets */ .ace_dark .ace_fold-widget { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); } .ace_dark .ace_fold-widget.ace_end { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg=="); } .ace_dark .ace_fold-widget.ace_closed { background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg=="); } .ace_dark .ace_fold-widget:hover { box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); background-color: rgba(255, 255, 255, 0.1); } .ace_dark .ace_fold-widget:active { box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2); } .ace_fold-widget.ace_invalid { background-color: #FFB4B4; border-color: #DE5555; } .ace_fade-fold-widgets .ace_fold-widget { -webkit-transition: opacity 0.4s ease 0.05s; transition: opacity 0.4s ease 0.05s; opacity: 0; } .ace_fade-fold-widgets:hover .ace_fold-widget { -webkit-transition: opacity 0.05s ease 0.05s; transition: opacity 0.05s ease 0.05s; opacity:1; } .ace_underline { text-decoration: underline; } .ace_bold { font-weight: bold; } .ace_nobold .ace_bold { font-weight: normal; } .ace_italic { font-style: italic; } .ace_error-marker { background-color: rgba(255, 0, 0,0.2); position: absolute; z-index: 9; } .ace_highlight-marker { background-color: rgba(255, 255, 0,0.2); position: absolute; z-index: 8; } /* styles = [] for (var i = 1; i < 16; i++) { styles.push(".ace_br" + i + "{" + ( ["top-left", "top-right", "bottom-right", "bottom-left"] ).map(function(x, j) { return i & (1<= length) { row = length - 1; column = undefined; } var line = this.getLine(row); if (column == undefined) column = line.length; column = Math.min(Math.max(column, 0), line.length); return {row: row, column: column}; }; this.clonePos = function(pos) { return {row: pos.row, column: pos.column}; }; this.pos = function(row, column) { return {row: row, column: column}; }; this.$clipPosition = function(position) { var length = this.getLength(); if (position.row >= length) { position.row = Math.max(0, length - 1); position.column = this.getLine(length - 1).length; } else { position.row = Math.max(0, position.row); position.column = Math.min(Math.max(position.column, 0), this.getLine(position.row).length); } return position; }; /** * Fires whenever the document changes. * * Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available: * * * `"insert"` * * `range`: the [[Range]] of the change within the document * * `lines`: the lines being added * * `"remove"` * * `range`: the [[Range]] of the change within the document * * `lines`: the lines being removed * * @event change * @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties. * **/ /** * Inserts the elements in `lines` into the document as full lines (does not merge with existing line), starting at the row index given by `row`. This method also triggers the `"change"` event. * @param {Number} row The index of the row to insert at * @param {Array} lines An array of strings * @returns {Object} Contains the final row and column, like this: * ``` * {row: endRow, column: 0} * ``` * If `lines` is empty, this function returns an object containing the current row, and column, like this: * ``` * {row: row, column: 0} * ``` * **/ this.insertFullLines = function(row, lines) { // Clip to document. // Allow one past the document end. row = Math.min(Math.max(row, 0), this.getLength()); // Calculate insertion point. var column = 0; if (row < this.getLength()) { // Insert before the specified row. lines = lines.concat([""]); column = 0; } else { // Insert after the last row in the document. lines = [""].concat(lines); row--; column = this.$lines[row].length; } // Insert. this.insertMergedLines({row: row, column: column}, lines); }; /** * Inserts the elements in `lines` into the document, starting at the position index given by `row`. This method also triggers the `"change"` event. * @param {Number} row The index of the row to insert at * @param {Array} lines An array of strings * @returns {Object} Contains the final row and column, like this: * ``` * {row: endRow, column: 0} * ``` * If `lines` is empty, this function returns an object containing the current row, and column, like this: * ``` * {row: row, column: 0} * ``` * **/ this.insertMergedLines = function(position, lines) { var start = this.clippedPos(position.row, position.column); var end = { row: start.row + lines.length - 1, column: (lines.length == 1 ? start.column : 0) + lines[lines.length - 1].length }; this.applyDelta({ start: start, end: end, action: "insert", lines: lines }); return this.clonePos(end); }; /** * Removes the `range` from the document. * @param {Range} range A specified Range to remove * @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. * **/ this.remove = function(range) { var start = this.clippedPos(range.start.row, range.start.column); var end = this.clippedPos(range.end.row, range.end.column); this.applyDelta({ start: start, end: end, action: "remove", lines: this.getLinesForRange({start: start, end: end}) }); return this.clonePos(start); }; /** * Removes the specified columns from the `row`. This method also triggers a `"change"` event. * @param {Number} row The row to remove from * @param {Number} startColumn The column to start removing at * @param {Number} endColumn The column to stop removing at * @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.
    If `startColumn` is equal to `endColumn`, this function returns nothing. * **/ this.removeInLine = function(row, startColumn, endColumn) { var start = this.clippedPos(row, startColumn); var end = this.clippedPos(row, endColumn); this.applyDelta({ start: start, end: end, action: "remove", lines: this.getLinesForRange({start: start, end: end}) }, true); return this.clonePos(start); }; /** * Removes a range of full lines. This method also triggers the `"change"` event. * @param {Number} firstRow The first row to be removed * @param {Number} lastRow The last row to be removed * @returns {[String]} Returns all the removed lines. * **/ this.removeFullLines = function(firstRow, lastRow) { // Clip to document. firstRow = Math.min(Math.max(0, firstRow), this.getLength() - 1); lastRow = Math.min(Math.max(0, lastRow ), this.getLength() - 1); // Calculate deletion range. // Delete the ending new line unless we're at the end of the document. // If we're at the end of the document, delete the starting new line. var deleteFirstNewLine = lastRow == this.getLength() - 1 && firstRow > 0; var deleteLastNewLine = lastRow < this.getLength() - 1; var startRow = ( deleteFirstNewLine ? firstRow - 1 : firstRow ); var startCol = ( deleteFirstNewLine ? this.getLine(startRow).length : 0 ); var endRow = ( deleteLastNewLine ? lastRow + 1 : lastRow ); var endCol = ( deleteLastNewLine ? 0 : this.getLine(endRow).length ); var range = new Range(startRow, startCol, endRow, endCol); // Store delelted lines with bounding newlines ommitted (maintains previous behavior). var deletedLines = this.$lines.slice(firstRow, lastRow + 1); this.applyDelta({ start: range.start, end: range.end, action: "remove", lines: this.getLinesForRange(range) }); // Return the deleted lines. return deletedLines; }; /** * Removes the new line between `row` and the row immediately following it. This method also triggers the `"change"` event. * @param {Number} row The row to check * **/ this.removeNewLine = function(row) { if (row < this.getLength() - 1 && row >= 0) { this.applyDelta({ start: this.pos(row, this.getLine(row).length), end: this.pos(row + 1, 0), action: "remove", lines: ["", ""] }); } }; /** * Replaces a range in the document with the new `text`. * @param {Range} range A specified Range to replace * @param {String} text The new text to use as a replacement * @returns {Object} Returns an object containing the final row and column, like this: * {row: endRow, column: 0} * If the text and range are empty, this function returns an object containing the current `range.start` value. * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value. * **/ this.replace = function(range, text) { if (!(range instanceof Range)) range = Range.fromPoints(range.start, range.end); if (text.length === 0 && range.isEmpty()) return range.start; // Shortcut: If the text we want to insert is the same as it is already // in the document, we don't have to replace anything. if (text == this.getTextRange(range)) return range.end; this.remove(range); var end; if (text) { end = this.insert(range.start, text); } else { end = range.start; } return end; }; /** * Applies all changes in `deltas` to the document. * @param {Array} deltas An array of delta objects (can include "insert" and "remove" actions) **/ this.applyDeltas = function(deltas) { for (var i=0; i=0; i--) { this.revertDelta(deltas[i]); } }; /** * Applies `delta` to the document. * @param {Object} delta A delta object (can include "insert" and "remove" actions) **/ this.applyDelta = function(delta, doNotValidate) { var isInsert = delta.action == "insert"; // An empty range is a NOOP. if (isInsert ? delta.lines.length <= 1 && !delta.lines[0] : !Range.comparePoints(delta.start, delta.end)) { return; } if (isInsert && delta.lines.length > 20000) this.$splitAndapplyLargeDelta(delta, 20000); // Apply. applyDelta(this.$lines, delta, doNotValidate); this._signal("change", delta); }; this.$splitAndapplyLargeDelta = function(delta, MAX) { // Split large insert deltas. This is necessary because: // 1. We need to support splicing delta lines into the document via $lines.splice.apply(...) // 2. fn.apply() doesn't work for a large number of params. The smallest threshold is on chrome 40 ~42000. // we use 20000 to leave some space for actual stack // // To Do: Ideally we'd be consistent and also split 'delete' deltas. We don't do this now, because delete // delta handling is too slow. If we make delete delta handling faster we can split all large deltas // as shown in https://gist.github.com/aldendaniels/8367109#file-document-snippet-js // If we do this, update validateDelta() to limit the number of lines in a delete delta. var lines = delta.lines; var l = lines.length; var row = delta.start.row; var column = delta.start.column; var from = 0, to = 0; do { from = to; to += MAX - 1; var chunk = lines.slice(from, to); if (to > l) { // Update remaining delta. delta.lines = chunk; delta.start.row = row + from; delta.start.column = column; break; } chunk.push(""); this.applyDelta({ start: this.pos(row + from, column), end: this.pos(row + to, column = 0), action: delta.action, lines: chunk }, true); } while(true); }; /** * Reverts `delta` from the document. * @param {Object} delta A delta object (can include "insert" and "remove" actions) **/ this.revertDelta = function(delta) { this.applyDelta({ start: this.clonePos(delta.start), end: this.clonePos(delta.end), action: (delta.action == "insert" ? "remove" : "insert"), lines: delta.lines.slice() }); }; /** * Converts an index position in a document to a `{row, column}` object. * * Index refers to the "absolute position" of a character in the document. For example: * * ```javascript * var x = 0; // 10 characters, plus one for newline * var y = -1; * ``` * * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second. * * @param {Number} index An index to convert * @param {Number} startRow=0 The row from which to start the conversion * @returns {Object} A `{row, column}` object of the `index` position */ this.indexToPosition = function(index, startRow) { var lines = this.$lines || this.getAllLines(); var newlineLength = this.getNewLineCharacter().length; for (var i = startRow || 0, l = lines.length; i < l; i++) { index -= lines[i].length + newlineLength; if (index < 0) return {row: i, column: index + lines[i].length + newlineLength}; } return {row: l-1, column: lines[l-1].length}; }; /** * Converts the `{row, column}` position in a document to the character's index. * * Index refers to the "absolute position" of a character in the document. For example: * * ```javascript * var x = 0; // 10 characters, plus one for newline * var y = -1; * ``` * * Here, `y` is an index 15: 11 characters for the first row, and 5 characters until `y` in the second. * * @param {Object} pos The `{row, column}` to convert * @param {Number} startRow=0 The row from which to start the conversion * @returns {Number} The index position in the document */ this.positionToIndex = function(pos, startRow) { var lines = this.$lines || this.getAllLines(); var newlineLength = this.getNewLineCharacter().length; var index = 0; var row = Math.min(pos.row, lines.length); for (var i = startRow || 0; i < row; ++i) index += lines[i].length + newlineLength; return index + pos.column; }; }).call(Document.prototype); exports.Document = Document; }); ================================================ FILE: lib/ace/document_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("./test/mockdom"); } define(function(require, exports, module) { "use strict"; var Document = require("./document").Document; var Range = require("./range").Range; var assert = require("./test/assertions"); module.exports = { "test: insert text in line" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insert({row: 0, column: 1}, "juhu"); assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["1juhu2", "34"].join("\n")); }, "test: insert new line" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insertMergedLines({row: 0, column: 1}, ['', '']); assert.equal(doc.getValue(), ["1", "2", "34"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["1", "2", "34"].join("\n")); }, "test: insert lines at the beginning" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insertFullLines(0, ["aa", "bb"]); assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["aa", "bb", "12", "34"].join("\n")); }, "test: insert lines at the end" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insertFullLines(2, ["aa", "bb"]); assert.equal(doc.getValue(), ["12", "34", "aa", "bb"].join("\n")); }, "test: insert lines in the middle" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insertFullLines(1, ["aa", "bb"]); assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["12", "aa", "bb", "34"].join("\n")); }, "test: insert multi line string at the start" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insert({row: 0, column: 0}, "aa\nbb\ncc"); assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["aa", "bb", "cc12", "34"].join("\n")); }, "test: insert multi line string at the end" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insert({row: 1, column: 2}, "aa\nbb\ncc"); assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["12", "34aa", "bb", "cc"].join("\n")); }, "test: insert multi line string in the middle" : function() { var doc = new Document(["12", "34"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.insert({row: 0, column: 1}, "aa\nbb\ncc"); assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["12", "34"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["1aa", "bb", "cc2", "34"].join("\n")); }, "test: delete in line" : function() { var doc = new Document(["1234", "5678"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.remove(new Range(0, 1, 0, 3)); assert.equal(doc.getValue(), ["14", "5678"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["1234", "5678"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["14", "5678"].join("\n")); }, "test: delete new line" : function() { var doc = new Document(["1234", "5678"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.remove(new Range(0, 4, 1, 0)); assert.equal(doc.getValue(), ["12345678"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["1234", "5678"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["12345678"].join("\n")); }, "test: delete multi line range line" : function() { var doc = new Document(["1234", "5678", "abcd"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.remove(new Range(0, 2, 2, 2)); assert.equal(doc.getValue(), ["12cd"].join("\n")); var d = deltas.concat(); doc.revertDeltas(d); assert.equal(doc.getValue(), ["1234", "5678", "abcd"].join("\n")); doc.applyDeltas(d); assert.equal(doc.getValue(), ["12cd"].join("\n")); }, "test: delete full lines" : function() { var doc = new Document(["1234", "5678", "abcd"]); var deltas = []; doc.on("change", function(e) { deltas.push(e); }); doc.remove(new Range(1, 0, 3, 0)); assert.equal(doc.getValue(), ["1234", ""].join("\n")); }, "test: remove lines should return the removed lines" : function() { var doc = new Document(["1234", "5678", "abcd"]); var removed = doc.removeFullLines(1, 2); assert.equal(removed.join("\n"), ["5678", "abcd"].join("\n")); }, "test: should handle unix style new lines" : function() { var doc = new Document(["1", "2", "3"]); assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); }, "test: should handle windows style new lines" : function() { var doc = new Document(["1", "2", "3"].join("\r\n")); doc.setNewLineMode("unix"); assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); }, "test: set new line mode to 'windows' should use '\\r\\n' as new lines": function() { var doc = new Document(["1", "2", "3"].join("\n")); doc.setNewLineMode("windows"); assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n")); }, "test: set new line mode to 'unix' should use '\\n' as new lines": function() { var doc = new Document(["1", "2", "3"].join("\r\n")); doc.setNewLineMode("unix"); assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); }, "test: set new line mode to 'auto' should detect the incoming nl type": function() { var doc = new Document(["1", "2", "3"].join("\n")); doc.setNewLineMode("auto"); assert.equal(doc.getValue(), ["1", "2", "3"].join("\n")); var doc = new Document(["1", "2", "3"].join("\r\n")); doc.setNewLineMode("auto"); assert.equal(doc.getValue(), ["1", "2", "3"].join("\r\n")); doc.replace(new Range(0, 0, 2, 1), ["4", "5", "6"].join("\n")); assert.equal(["4", "5", "6"].join("\n"), doc.getValue()); }, "test: set value": function() { var doc = new Document("1"); assert.equal("1", doc.getValue()); doc.setValue(doc.getValue()); assert.equal("1", doc.getValue()); var doc = new Document("1\n2"); assert.equal("1\n2", doc.getValue()); doc.setValue(doc.getValue()); assert.equal("1\n2", doc.getValue()); }, "test: empty document has to contain one line": function() { var doc = new Document(""); assert.equal(doc.$lines.length, 1); }, "test: ignore empty delta": function() { var doc = new Document(""); doc.on("change", function() { throw "should ignore empty delta"; }); doc.insert({row: 0, column: 0}, ""); doc.insert({row: 1, column: 1}, ""); doc.remove({start: {row: 1, column: 1}, end: {row: 1, column: 1}}); }, "test: inserting huge delta": function() { var doc = new Document(""); var val = ""; var MAX = 0xF000; for (var i = 0; i < 10 * MAX; i++) { val += i + "\n"; } doc.setValue(val); assert.equal(doc.getValue(), val); for (var i = 3 * MAX + 2; i >= 3 * MAX - 2; i--) { val = doc.getLines(0, i).join("\n"); doc.setValue("\nab"); assert.equal(doc.getValue(), "\nab"); doc.insert({row: 1, column: 1}, val); assert.equal(doc.getValue(), "\na" + val + "b"); } } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/edit_session/bracket_match.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var TokenIterator = require("../token_iterator").TokenIterator; var Range = require("../range").Range; function BracketMatch() { this.findMatchingBracket = function(position, chr) { if (position.column == 0) return null; var charBeforeCursor = chr || this.getLine(position.row).charAt(position.column-1); if (charBeforeCursor == "") return null; var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/); if (!match) return null; if (match[1]) return this.$findClosingBracket(match[1], position); else return this.$findOpeningBracket(match[2], position); }; this.getBracketRange = function(pos) { var line = this.getLine(pos.row); var before = true, range; var chr = line.charAt(pos.column-1); var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); if (!match) { chr = line.charAt(pos.column); pos = {row: pos.row, column: pos.column + 1}; match = chr && chr.match(/([\(\[\{])|([\)\]\}])/); before = false; } if (!match) return null; if (match[1]) { var bracketPos = this.$findClosingBracket(match[1], pos); if (!bracketPos) return null; range = Range.fromPoints(pos, bracketPos); if (!before) { range.end.column++; range.start.column--; } range.cursor = range.end; } else { var bracketPos = this.$findOpeningBracket(match[2], pos); if (!bracketPos) return null; range = Range.fromPoints(bracketPos, pos); if (!before) { range.start.column++; range.end.column--; } range.cursor = range.start; } return range; }; this.$brackets = { ")": "(", "(": ")", "]": "[", "[": "]", "{": "}", "}": "{" }; this.$findOpeningBracket = function(bracket, position, typeRe) { var openBracket = this.$brackets[bracket]; var depth = 1; var iterator = new TokenIterator(this, position.row, position.column); var token = iterator.getCurrentToken(); if (!token) token = iterator.stepForward(); if (!token) return; if (!typeRe){ typeRe = new RegExp( "(\\.?" + token.type.replace(".", "\\.").replace("rparen", ".paren") .replace(/\b(?:end)\b/, "(?:start|begin|end)") + ")+" ); } // Start searching in token, just before the character at position.column var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2; var value = token.value; while (true) { while (valueIndex >= 0) { var chr = value.charAt(valueIndex); if (chr == openBracket) { depth -= 1; if (depth == 0) { return {row: iterator.getCurrentTokenRow(), column: valueIndex + iterator.getCurrentTokenColumn()}; } } else if (chr == bracket) { depth += 1; } valueIndex -= 1; } // Scan backward through the document, looking for the next token // whose type matches typeRe do { token = iterator.stepBackward(); } while (token && !typeRe.test(token.type)); if (token == null) break; value = token.value; valueIndex = value.length - 1; } return null; }; this.$findClosingBracket = function(bracket, position, typeRe) { var closingBracket = this.$brackets[bracket]; var depth = 1; var iterator = new TokenIterator(this, position.row, position.column); var token = iterator.getCurrentToken(); if (!token) token = iterator.stepForward(); if (!token) return; if (!typeRe){ typeRe = new RegExp( "(\\.?" + token.type.replace(".", "\\.").replace("lparen", ".paren") .replace(/\b(?:start|begin)\b/, "(?:start|begin|end)") + ")+" ); } // Start searching in token, after the character at position.column var valueIndex = position.column - iterator.getCurrentTokenColumn(); while (true) { var value = token.value; var valueLength = value.length; while (valueIndex < valueLength) { var chr = value.charAt(valueIndex); if (chr == closingBracket) { depth -= 1; if (depth == 0) { return {row: iterator.getCurrentTokenRow(), column: valueIndex + iterator.getCurrentTokenColumn()}; } } else if (chr == bracket) { depth += 1; } valueIndex += 1; } // Scan forward through the document, looking for the next token // whose type matches typeRe do { token = iterator.stepForward(); } while (token && !typeRe.test(token.type)); if (token == null) break; valueIndex = 0; } return null; }; } exports.BracketMatch = BracketMatch; }); ================================================ FILE: lib/ace/edit_session/fold.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Range = require("../range").Range; var RangeList = require("../range_list").RangeList; var oop = require("../lib/oop"); /* * Simple fold-data struct. **/ var Fold = exports.Fold = function(range, placeholder) { this.foldLine = null; this.placeholder = placeholder; this.range = range; this.start = range.start; this.end = range.end; this.sameRow = range.start.row == range.end.row; this.subFolds = this.ranges = []; }; oop.inherits(Fold, RangeList); (function() { this.toString = function() { return '"' + this.placeholder + '" ' + this.range.toString(); }; this.setFoldLine = function(foldLine) { this.foldLine = foldLine; this.subFolds.forEach(function(fold) { fold.setFoldLine(foldLine); }); }; this.clone = function() { var range = this.range.clone(); var fold = new Fold(range, this.placeholder); this.subFolds.forEach(function(subFold) { fold.subFolds.push(subFold.clone()); }); fold.collapseChildren = this.collapseChildren; return fold; }; this.addSubFold = function(fold) { if (this.range.isEqual(fold)) return; if (!this.range.containsRange(fold)) throw new Error("A fold can't intersect already existing fold" + fold.range + this.range); // transform fold to local coordinates consumeRange(fold, this.start); var row = fold.start.row, column = fold.start.column; for (var i = 0, cmp = -1; i < this.subFolds.length; i++) { cmp = this.subFolds[i].range.compare(row, column); if (cmp != 1) break; } var afterStart = this.subFolds[i]; if (cmp == 0) return afterStart.addSubFold(fold); // cmp == -1 var row = fold.range.end.row, column = fold.range.end.column; for (var j = i, cmp = -1; j < this.subFolds.length; j++) { cmp = this.subFolds[j].range.compare(row, column); if (cmp != 1) break; } var afterEnd = this.subFolds[j]; if (cmp == 0) throw new Error("A fold can't intersect already existing fold" + fold.range + this.range); var consumedFolds = this.subFolds.splice(i, j - i, fold); fold.setFoldLine(this.foldLine); return fold; }; this.restoreRange = function(range) { return restoreRange(range, this.start); }; }).call(Fold.prototype); function consumePoint(point, anchor) { point.row -= anchor.row; if (point.row == 0) point.column -= anchor.column; } function consumeRange(range, anchor) { consumePoint(range.start, anchor); consumePoint(range.end, anchor); } function restorePoint(point, anchor) { if (point.row == 0) point.column += anchor.column; point.row += anchor.row; } function restoreRange(range, anchor) { restorePoint(range.start, anchor); restorePoint(range.end, anchor); } }); ================================================ FILE: lib/ace/edit_session/fold_line.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Range = require("../range").Range; /* * If an array is passed in, the folds are expected to be sorted already. */ function FoldLine(foldData, folds) { this.foldData = foldData; if (Array.isArray(folds)) { this.folds = folds; } else { folds = this.folds = [ folds ]; } var last = folds[folds.length - 1]; this.range = new Range(folds[0].start.row, folds[0].start.column, last.end.row, last.end.column); this.start = this.range.start; this.end = this.range.end; this.folds.forEach(function(fold) { fold.setFoldLine(this); }, this); } (function() { /* * Note: This doesn't update wrapData! */ this.shiftRow = function(shift) { this.start.row += shift; this.end.row += shift; this.folds.forEach(function(fold) { fold.start.row += shift; fold.end.row += shift; }); }; this.addFold = function(fold) { if (fold.sameRow) { if (fold.start.row < this.startRow || fold.endRow > this.endRow) { throw new Error("Can't add a fold to this FoldLine as it has no connection"); } this.folds.push(fold); this.folds.sort(function(a, b) { return -a.range.compareEnd(b.start.row, b.start.column); }); if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) { this.end.row = fold.end.row; this.end.column = fold.end.column; } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) { this.start.row = fold.start.row; this.start.column = fold.start.column; } } else if (fold.start.row == this.end.row) { this.folds.push(fold); this.end.row = fold.end.row; this.end.column = fold.end.column; } else if (fold.end.row == this.start.row) { this.folds.unshift(fold); this.start.row = fold.start.row; this.start.column = fold.start.column; } else { throw new Error("Trying to add fold to FoldRow that doesn't have a matching row"); } fold.foldLine = this; }; this.containsRow = function(row) { return row >= this.start.row && row <= this.end.row; }; this.walk = function(callback, endRow, endColumn) { var lastEnd = 0, folds = this.folds, fold, cmp, stop, isNewRow = true; if (endRow == null) { endRow = this.end.row; endColumn = this.end.column; } for (var i = 0; i < folds.length; i++) { fold = folds[i]; cmp = fold.range.compareStart(endRow, endColumn); // This fold is after the endRow/Column. if (cmp == -1) { callback(null, endRow, endColumn, lastEnd, isNewRow); return; } stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow); stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd); // If the user requested to stop the walk or endRow/endColumn is // inside of this fold (cmp == 0), then end here. if (stop || cmp === 0) { return; } // Note the new lastEnd might not be on the same line. However, // it's the callback's job to recognize this. isNewRow = !fold.sameRow; lastEnd = fold.end.column; } callback(null, endRow, endColumn, lastEnd, isNewRow); }; this.getNextFoldTo = function(row, column) { var fold, cmp; for (var i = 0; i < this.folds.length; i++) { fold = this.folds[i]; cmp = fold.range.compareEnd(row, column); if (cmp == -1) { return { fold: fold, kind: "after" }; } else if (cmp === 0) { return { fold: fold, kind: "inside" }; } } return null; }; this.addRemoveChars = function(row, column, len) { var ret = this.getNextFoldTo(row, column), fold, folds; if (ret) { fold = ret.fold; if (ret.kind == "inside" && fold.start.column != column && fold.start.row != row) { //throwing here breaks whole editor //TODO: properly handle this window.console && window.console.log(row, column, fold); } else if (fold.start.row == row) { folds = this.folds; var i = folds.indexOf(fold); if (i === 0) { this.start.column += len; } for (i; i < folds.length; i++) { fold = folds[i]; fold.start.column += len; if (!fold.sameRow) { return; } fold.end.column += len; } this.end.column += len; } } }; this.split = function(row, column) { var pos = this.getNextFoldTo(row, column); if (!pos || pos.kind == "inside") return null; var fold = pos.fold; var folds = this.folds; var foldData = this.foldData; var i = folds.indexOf(fold); var foldBefore = folds[i - 1]; this.end.row = foldBefore.end.row; this.end.column = foldBefore.end.column; // Remove the folds after row/column and create a new FoldLine // containing these removed folds. folds = folds.splice(i, folds.length - i); var newFoldLine = new FoldLine(foldData, folds); foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine); return newFoldLine; }; this.merge = function(foldLineNext) { var folds = foldLineNext.folds; for (var i = 0; i < folds.length; i++) { this.addFold(folds[i]); } // Remove the foldLineNext - no longer needed, as // it's merged now with foldLineNext. var foldData = this.foldData; foldData.splice(foldData.indexOf(foldLineNext), 1); }; this.toString = function() { var ret = [this.range.toString() + ": [" ]; this.folds.forEach(function(fold) { ret.push(" " + fold.toString()); }); ret.push("]"); return ret.join("\n"); }; this.idxToPosition = function(idx) { var lastFoldEndColumn = 0; for (var i = 0; i < this.folds.length; i++) { var fold = this.folds[i]; idx -= fold.start.column - lastFoldEndColumn; if (idx < 0) { return { row: fold.start.row, column: fold.start.column + idx }; } idx -= fold.placeholder.length; if (idx < 0) { return fold.start; } lastFoldEndColumn = fold.end.column; } return { row: this.end.row, column: this.end.column + idx }; }; }).call(FoldLine.prototype); exports.FoldLine = FoldLine; }); ================================================ FILE: lib/ace/edit_session/folding.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Range = require("../range").Range; var FoldLine = require("./fold_line").FoldLine; var Fold = require("./fold").Fold; var TokenIterator = require("../token_iterator").TokenIterator; function Folding() { /* * Looks up a fold at a given row/column. Possible values for side: * -1: ignore a fold if fold.start = row/column * +1: ignore a fold if fold.end = row/column */ this.getFoldAt = function(row, column, side) { var foldLine = this.getFoldLine(row); if (!foldLine) return null; var folds = foldLine.folds; for (var i = 0; i < folds.length; i++) { var fold = folds[i]; if (fold.range.contains(row, column)) { if (side == 1 && fold.range.isEnd(row, column)) { continue; } else if (side == -1 && fold.range.isStart(row, column)) { continue; } return fold; } } }; /* * Returns all folds in the given range. Note, that this will return folds * */ this.getFoldsInRange = function(range) { var start = range.start; var end = range.end; var foldLines = this.$foldData; var foundFolds = []; start.column += 1; end.column -= 1; for (var i = 0; i < foldLines.length; i++) { var cmp = foldLines[i].range.compareRange(range); if (cmp == 2) { // Range is before foldLine. No intersection. This means, // there might be other foldLines that intersect. continue; } else if (cmp == -2) { // Range is after foldLine. There can't be any other foldLines then, // so let's give up. break; } var folds = foldLines[i].folds; for (var j = 0; j < folds.length; j++) { var fold = folds[j]; cmp = fold.range.compareRange(range); if (cmp == -2) { break; } else if (cmp == 2) { continue; } else // WTF-state: Can happen due to -1/+1 to start/end column. if (cmp == 42) { break; } foundFolds.push(fold); } } start.column -= 1; end.column += 1; return foundFolds; }; this.getFoldsInRangeList = function(ranges) { if (Array.isArray(ranges)) { var folds = []; ranges.forEach(function(range) { folds = folds.concat(this.getFoldsInRange(range)); }, this); } else { var folds = this.getFoldsInRange(ranges); } return folds; }; /* * Returns all folds in the document */ this.getAllFolds = function() { var folds = []; var foldLines = this.$foldData; for (var i = 0; i < foldLines.length; i++) for (var j = 0; j < foldLines[i].folds.length; j++) folds.push(foldLines[i].folds[j]); return folds; }; /* * Returns the string between folds at the given position. * E.g. * foob|arwolrd -> "bar" * foobarwol|rd -> "world" * foobarwolrd -> * * where | means the position of row/column * * The trim option determs if the return string should be trimed according * to the "side" passed with the trim value: * * E.g. * foob|arwolrd -trim=-1> "b" * foobarwol|rd -trim=+1> "rld" * fo|obarwolrd -trim=00> "foo" */ this.getFoldStringAt = function(row, column, trim, foldLine) { foldLine = foldLine || this.getFoldLine(row); if (!foldLine) return null; var lastFold = { end: { column: 0 } }; // TODO: Refactor to use getNextFoldTo function. var str, fold; for (var i = 0; i < foldLine.folds.length; i++) { fold = foldLine.folds[i]; var cmp = fold.range.compareEnd(row, column); if (cmp == -1) { str = this .getLine(fold.start.row) .substring(lastFold.end.column, fold.start.column); break; } else if (cmp === 0) { return null; } lastFold = fold; } if (!str) str = this.getLine(fold.start.row).substring(lastFold.end.column); if (trim == -1) return str.substring(0, column - lastFold.end.column); else if (trim == 1) return str.substring(column - lastFold.end.column); else return str; }; this.getFoldLine = function(docRow, startFoldLine) { var foldData = this.$foldData; var i = 0; if (startFoldLine) i = foldData.indexOf(startFoldLine); if (i == -1) i = 0; for (i; i < foldData.length; i++) { var foldLine = foldData[i]; if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) { return foldLine; } else if (foldLine.end.row > docRow) { return null; } } return null; }; // returns the fold which starts after or contains docRow this.getNextFoldLine = function(docRow, startFoldLine) { var foldData = this.$foldData; var i = 0; if (startFoldLine) i = foldData.indexOf(startFoldLine); if (i == -1) i = 0; for (i; i < foldData.length; i++) { var foldLine = foldData[i]; if (foldLine.end.row >= docRow) { return foldLine; } } return null; }; this.getFoldedRowCount = function(first, last) { var foldData = this.$foldData, rowCount = last-first+1; for (var i = 0; i < foldData.length; i++) { var foldLine = foldData[i], end = foldLine.end.row, start = foldLine.start.row; if (end >= last) { if (start < last) { if (start >= first) rowCount -= last-start; else rowCount = 0; // in one fold } break; } else if (end >= first){ if (start >= first) // fold inside range rowCount -= end-start; else rowCount -= end-first+1; } } return rowCount; }; this.$addFoldLine = function(foldLine) { this.$foldData.push(foldLine); this.$foldData.sort(function(a, b) { return a.start.row - b.start.row; }); return foldLine; }; /** * Adds a new fold. * * @returns * The new created Fold object or an existing fold object in case the * passed in range fits an existing fold exactly. */ this.addFold = function(placeholder, range) { var foldData = this.$foldData; var added = false; var fold; if (placeholder instanceof Fold) fold = placeholder; else { fold = new Fold(range, placeholder); fold.collapseChildren = range.collapseChildren; } this.$clipRangeToDocument(fold.range); var startRow = fold.start.row; var startColumn = fold.start.column; var endRow = fold.end.row; var endColumn = fold.end.column; // --- Some checking --- if (!(startRow < endRow || startRow == endRow && startColumn <= endColumn - 2)) throw new Error("The range has to be at least 2 characters width"); var startFold = this.getFoldAt(startRow, startColumn, 1); var endFold = this.getFoldAt(endRow, endColumn, -1); if (startFold && endFold == startFold) return startFold.addSubFold(fold); if (startFold && !startFold.range.isStart(startRow, startColumn)) this.removeFold(startFold); if (endFold && !endFold.range.isEnd(endRow, endColumn)) this.removeFold(endFold); // Check if there are folds in the range we create the new fold for. var folds = this.getFoldsInRange(fold.range); if (folds.length > 0) { // Remove the folds from fold data. this.removeFolds(folds); // Add the removed folds as subfolds on the new fold. folds.forEach(function(subFold) { fold.addSubFold(subFold); }); } for (var i = 0; i < foldData.length; i++) { var foldLine = foldData[i]; if (endRow == foldLine.start.row) { foldLine.addFold(fold); added = true; break; } else if (startRow == foldLine.end.row) { foldLine.addFold(fold); added = true; if (!fold.sameRow) { // Check if we might have to merge two FoldLines. var foldLineNext = foldData[i + 1]; if (foldLineNext && foldLineNext.start.row == endRow) { // We need to merge! foldLine.merge(foldLineNext); break; } } break; } else if (endRow <= foldLine.start.row) { break; } } if (!added) foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold)); if (this.$useWrapMode) this.$updateWrapData(foldLine.start.row, foldLine.start.row); else this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row); // Notify that fold data has changed. this.$modified = true; this._signal("changeFold", { data: fold, action: "add" }); return fold; }; this.addFolds = function(folds) { folds.forEach(function(fold) { this.addFold(fold); }, this); }; this.removeFold = function(fold) { var foldLine = fold.foldLine; var startRow = foldLine.start.row; var endRow = foldLine.end.row; var foldLines = this.$foldData; var folds = foldLine.folds; // Simple case where there is only one fold in the FoldLine such that // the entire fold line can get removed directly. if (folds.length == 1) { foldLines.splice(foldLines.indexOf(foldLine), 1); } else // If the fold is the last fold of the foldLine, just remove it. if (foldLine.range.isEnd(fold.end.row, fold.end.column)) { folds.pop(); foldLine.end.row = folds[folds.length - 1].end.row; foldLine.end.column = folds[folds.length - 1].end.column; } else // If the fold is the first fold of the foldLine, just remove it. if (foldLine.range.isStart(fold.start.row, fold.start.column)) { folds.shift(); foldLine.start.row = folds[0].start.row; foldLine.start.column = folds[0].start.column; } else // We know there are more then 2 folds and the fold is not at the edge. // This means, the fold is somewhere in between. // // If the fold is in one row, we just can remove it. if (fold.sameRow) { folds.splice(folds.indexOf(fold), 1); } else // The fold goes over more then one row. This means remvoing this fold // will cause the fold line to get splitted up. newFoldLine is the second part { var newFoldLine = foldLine.split(fold.start.row, fold.start.column); folds = newFoldLine.folds; folds.shift(); newFoldLine.start.row = folds[0].start.row; newFoldLine.start.column = folds[0].start.column; } if (!this.$updating) { if (this.$useWrapMode) this.$updateWrapData(startRow, endRow); else this.$updateRowLengthCache(startRow, endRow); } // Notify that fold data has changed. this.$modified = true; this._signal("changeFold", { data: fold, action: "remove" }); }; this.removeFolds = function(folds) { // We need to clone the folds array passed in as it might be the folds // array of a fold line and as we call this.removeFold(fold), folds // are removed from folds and changes the current index. var cloneFolds = []; for (var i = 0; i < folds.length; i++) { cloneFolds.push(folds[i]); } cloneFolds.forEach(function(fold) { this.removeFold(fold); }, this); this.$modified = true; }; this.expandFold = function(fold) { this.removeFold(fold); fold.subFolds.forEach(function(subFold) { fold.restoreRange(subFold); this.addFold(subFold); }, this); if (fold.collapseChildren > 0) { this.foldAll(fold.start.row+1, fold.end.row, fold.collapseChildren-1); } fold.subFolds = []; }; this.expandFolds = function(folds) { folds.forEach(function(fold) { this.expandFold(fold); }, this); }; this.unfold = function(location, expandInner) { var range, folds; if (location == null) { range = new Range(0, 0, this.getLength(), 0); expandInner = true; } else if (typeof location == "number") range = new Range(location, 0, location, this.getLine(location).length); else if ("row" in location) range = Range.fromPoints(location, location); else range = location; folds = this.getFoldsInRangeList(range); if (expandInner) { this.removeFolds(folds); } else { var subFolds = folds; // TODO: might be better to remove and add folds in one go instead of using // expandFolds several times. while (subFolds.length) { this.expandFolds(subFolds); subFolds = this.getFoldsInRangeList(range); } } if (folds.length) return folds; }; /* * Checks if a given documentRow is folded. This is true if there are some * folded parts such that some parts of the line is still visible. **/ this.isRowFolded = function(docRow, startFoldRow) { return !!this.getFoldLine(docRow, startFoldRow); }; this.getRowFoldEnd = function(docRow, startFoldRow) { var foldLine = this.getFoldLine(docRow, startFoldRow); return foldLine ? foldLine.end.row : docRow; }; this.getRowFoldStart = function(docRow, startFoldRow) { var foldLine = this.getFoldLine(docRow, startFoldRow); return foldLine ? foldLine.start.row : docRow; }; this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { if (startRow == null) startRow = foldLine.start.row; if (startColumn == null) startColumn = 0; if (endRow == null) endRow = foldLine.end.row; if (endColumn == null) endColumn = this.getLine(endRow).length; // Build the textline using the FoldLine walker. var doc = this.doc; var textLine = ""; foldLine.walk(function(placeholder, row, column, lastColumn) { if (row < startRow) return; if (row == startRow) { if (column < startColumn) return; lastColumn = Math.max(startColumn, lastColumn); } if (placeholder != null) { textLine += placeholder; } else { textLine += doc.getLine(row).substring(lastColumn, column); } }, endRow, endColumn); return textLine; }; this.getDisplayLine = function(row, endColumn, startRow, startColumn) { var foldLine = this.getFoldLine(row); if (!foldLine) { var line; line = this.doc.getLine(row); return line.substring(startColumn || 0, endColumn || line.length); } else { return this.getFoldDisplayLine( foldLine, row, endColumn, startRow, startColumn); } }; this.$cloneFoldData = function() { var fd = []; fd = this.$foldData.map(function(foldLine) { var folds = foldLine.folds.map(function(fold) { return fold.clone(); }); return new FoldLine(fd, folds); }); return fd; }; this.toggleFold = function(tryToUnfold) { var selection = this.selection; var range = selection.getRange(); var fold; var bracketPos; if (range.isEmpty()) { var cursor = range.start; fold = this.getFoldAt(cursor.row, cursor.column); if (fold) { this.expandFold(fold); return; } else if (bracketPos = this.findMatchingBracket(cursor)) { if (range.comparePoint(bracketPos) == 1) { range.end = bracketPos; } else { range.start = bracketPos; range.start.column++; range.end.column--; } } else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) { if (range.comparePoint(bracketPos) == 1) range.end = bracketPos; else range.start = bracketPos; range.start.column++; } else { range = this.getCommentFoldRange(cursor.row, cursor.column) || range; } } else { var folds = this.getFoldsInRange(range); if (tryToUnfold && folds.length) { this.expandFolds(folds); return; } else if (folds.length == 1 ) { fold = folds[0]; } } if (!fold) fold = this.getFoldAt(range.start.row, range.start.column); if (fold && fold.range.toString() == range.toString()) { this.expandFold(fold); return; } var placeholder = "..."; if (!range.isMultiLine()) { placeholder = this.getTextRange(range); if (placeholder.length < 4) return; placeholder = placeholder.trim().substring(0, 2) + ".."; } this.addFold(placeholder, range); }; this.getCommentFoldRange = function(row, column, dir) { var iterator = new TokenIterator(this, row, column); var token = iterator.getCurrentToken(); var type = token.type; if (token && /^comment|string/.test(type)) { type = type.match(/comment|string/)[0]; if (type == "comment") type += "|doc-start"; var re = new RegExp(type); var range = new Range(); if (dir != 1) { do { token = iterator.stepBackward(); } while (token && re.test(token.type)); iterator.stepForward(); } range.start.row = iterator.getCurrentTokenRow(); range.start.column = iterator.getCurrentTokenColumn() + 2; iterator = new TokenIterator(this, row, column); if (dir != -1) { var lastRow = -1; do { token = iterator.stepForward(); if (lastRow == -1) { var state = this.getState(iterator.$row); if (!re.test(state)) lastRow = iterator.$row; } else if (iterator.$row > lastRow) { break; } } while (token && re.test(token.type)); token = iterator.stepBackward(); } else token = iterator.getCurrentToken(); range.end.row = iterator.getCurrentTokenRow(); range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2; return range; } }; this.foldAll = function(startRow, endRow, depth) { if (depth == undefined) depth = 100000; // JSON.stringify doesn't hanle Infinity var foldWidgets = this.foldWidgets; if (!foldWidgets) return; // mode doesn't support folding endRow = endRow || this.getLength(); startRow = startRow || 0; for (var row = startRow; row < endRow; row++) { if (foldWidgets[row] == null) foldWidgets[row] = this.getFoldWidget(row); if (foldWidgets[row] != "start") continue; var range = this.getFoldWidgetRange(row); // sometimes range can be incompatible with existing fold // TODO change addFold to return null istead of throwing if (range && range.isMultiLine() && range.end.row <= endRow && range.start.row >= startRow ) { row = range.end.row; try { // addFold can change the range var fold = this.addFold("...", range); if (fold) fold.collapseChildren = depth; } catch(e) {} } } }; // structured folding this.$foldStyles = { "manual": 1, "markbegin": 1, "markbeginend": 1 }; this.$foldStyle = "markbegin"; this.setFoldStyle = function(style) { if (!this.$foldStyles[style]) throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]"); if (this.$foldStyle == style) return; this.$foldStyle = style; if (style == "manual") this.unfold(); // reset folding var mode = this.$foldMode; this.$setFolding(null); this.$setFolding(mode); }; this.$setFolding = function(foldMode) { if (this.$foldMode == foldMode) return; this.$foldMode = foldMode; this.off('change', this.$updateFoldWidgets); this.off('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets); this._signal("changeAnnotation"); if (!foldMode || this.$foldStyle == "manual") { this.foldWidgets = null; return; } this.foldWidgets = []; this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle); this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle); this.$updateFoldWidgets = this.updateFoldWidgets.bind(this); this.$tokenizerUpdateFoldWidgets = this.tokenizerUpdateFoldWidgets.bind(this); this.on('change', this.$updateFoldWidgets); this.on('tokenizerUpdate', this.$tokenizerUpdateFoldWidgets); }; this.getParentFoldRangeData = function (row, ignoreCurrent) { var fw = this.foldWidgets; if (!fw || (ignoreCurrent && fw[row])) return {}; var i = row - 1, firstRange; while (i >= 0) { var c = fw[i]; if (c == null) c = fw[i] = this.getFoldWidget(i); if (c == "start") { var range = this.getFoldWidgetRange(i); if (!firstRange) firstRange = range; if (range && range.end.row >= row) break; } i--; } return { range: i !== -1 && range, firstRange: firstRange }; }; this.onFoldWidgetClick = function(row, e) { e = e.domEvent; var options = { children: e.shiftKey, all: e.ctrlKey || e.metaKey, siblings: e.altKey }; var range = this.$toggleFoldWidget(row, options); if (!range) { var el = (e.target || e.srcElement); if (el && /ace_fold-widget/.test(el.className)) el.className += " ace_invalid"; } }; this.$toggleFoldWidget = function(row, options) { if (!this.getFoldWidget) return; var type = this.getFoldWidget(row); var line = this.getLine(row); var dir = type === "end" ? -1 : 1; var fold = this.getFoldAt(row, dir === -1 ? 0 : line.length, dir); if (fold) { if (options.children || options.all) this.removeFold(fold); else this.expandFold(fold); return fold; } var range = this.getFoldWidgetRange(row, true); // sometimes singleline folds can be missed by the code above if (range && !range.isMultiLine()) { fold = this.getFoldAt(range.start.row, range.start.column, 1); if (fold && range.isEqual(fold.range)) { this.removeFold(fold); return fold; } } if (options.siblings) { var data = this.getParentFoldRangeData(row); if (data.range) { var startRow = data.range.start.row + 1; var endRow = data.range.end.row; } this.foldAll(startRow, endRow, options.all ? 10000 : 0); } else if (options.children) { endRow = range ? range.end.row : this.getLength(); this.foldAll(row + 1, endRow, options.all ? 10000 : 0); } else if (range) { if (options.all) range.collapseChildren = 10000; this.addFold("...", range); } return range; }; this.toggleFoldWidget = function(toggleParent) { var row = this.selection.getCursor().row; row = this.getRowFoldStart(row); var range = this.$toggleFoldWidget(row, {}); if (range) return; // handle toggleParent var data = this.getParentFoldRangeData(row, true); range = data.range || data.firstRange; if (range) { row = range.start.row; var fold = this.getFoldAt(row, this.getLine(row).length, 1); if (fold) { this.removeFold(fold); } else { this.addFold("...", range); } } }; this.updateFoldWidgets = function(delta) { var firstRow = delta.start.row; var len = delta.end.row - firstRow; if (len === 0) { this.foldWidgets[firstRow] = null; } else if (delta.action == 'remove') { this.foldWidgets.splice(firstRow, len + 1, null); } else { var args = Array(len + 1); args.unshift(firstRow, 1); this.foldWidgets.splice.apply(this.foldWidgets, args); } }; this.tokenizerUpdateFoldWidgets = function(e) { var rows = e.data; if (rows.first != rows.last) { if (this.foldWidgets.length > rows.first) this.foldWidgets.splice(rows.first, this.foldWidgets.length); } }; } exports.Folding = Folding; }); ================================================ FILE: lib/ace/edit_session.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var lang = require("./lib/lang"); var BidiHandler = require("./bidihandler").BidiHandler; var config = require("./config"); var EventEmitter = require("./lib/event_emitter").EventEmitter; var Selection = require("./selection").Selection; var TextMode = require("./mode/text").Mode; var Range = require("./range").Range; var Document = require("./document").Document; var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer; var SearchHighlight = require("./search_highlight").SearchHighlight; /** * Stores all the data about [[Editor `Editor`]] state providing easy way to change editors state. * * `EditSession` can be attached to only one [[Document `Document`]]. Same `Document` can be attached to several `EditSession`s. * @class EditSession **/ //{ events /** * * Emitted when the document changes. * @event change * @param {Object} e An object containing a `delta` of information about the change. **/ /** * Emitted when the tab size changes, via [[EditSession.setTabSize]]. * * @event changeTabSize **/ /** * Emitted when the ability to overwrite text changes, via [[EditSession.setOverwrite]]. * * @event changeOverwrite **/ /** * Emitted when the gutter changes, either by setting or removing breakpoints, or when the gutter decorations change. * * @event changeBreakpoint **/ /** * Emitted when a front marker changes. * * @event changeFrontMarker **/ /** * Emitted when a back marker changes. * * @event changeBackMarker **/ /** * Emitted when an annotation changes, like through [[EditSession.setAnnotations]]. * * @event changeAnnotation **/ /** * Emitted when a background tokenizer asynchronously processes new rows. * @event tokenizerUpdate * * @param {Object} e An object containing one property, `"data"`, that contains information about the changing rows * **/ /** * Emitted when the current mode changes. * * @event changeMode * **/ /** * Emitted when the wrap mode changes. * * @event changeWrapMode * **/ /** * Emitted when the wrapping limit changes. * * @event changeWrapLimit * **/ /** * Emitted when a code fold is added or removed. * * @event changeFold * **/ /** * Emitted when the scroll top changes. * @event changeScrollTop * * @param {Number} scrollTop The new scroll top value **/ /** * Emitted when the scroll left changes. * @event changeScrollLeft * * @param {Number} scrollLeft The new scroll left value **/ //} /** * Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`. * @param {Document | String} text [If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text]{: #textParam} * @param {TextMode} mode [The initial language mode to use for the document]{: #modeParam} * * @constructor **/ var EditSession = function(text, mode) { this.$breakpoints = []; this.$decorations = []; this.$frontMarkers = {}; this.$backMarkers = {}; this.$markerId = 1; this.$undoSelect = true; this.$foldData = []; this.id = "session" + (++EditSession.$uid); this.$foldData.toString = function() { return this.join("\n"); }; this.on("changeFold", this.onChangeFold.bind(this)); this.$onChange = this.onChange.bind(this); if (typeof text != "object" || !text.getLine) text = new Document(text); this.$bidiHandler = new BidiHandler(this); this.setDocument(text); this.selection = new Selection(this); config.resetOptions(this); this.setMode(mode); config._signal("session", this); }; EditSession.$uid = 0; (function() { oop.implement(this, EventEmitter); /** * Sets the `EditSession` to point to a new `Document`. If a `BackgroundTokenizer` exists, it also points to `doc`. * * @param {Document} doc The new `Document` to use * **/ this.setDocument = function(doc) { if (this.doc) this.doc.removeListener("change", this.$onChange); this.doc = doc; doc.on("change", this.$onChange); if (this.bgTokenizer) this.bgTokenizer.setDocument(this.getDocument()); this.resetCaches(); }; /** * Returns the `Document` associated with this session. * @return {Document} **/ this.getDocument = function() { return this.doc; }; /** * @param {Number} row The row to work with * **/ this.$resetRowCache = function(docRow) { if (!docRow) { this.$docRowCache = []; this.$screenRowCache = []; return; } var l = this.$docRowCache.length; var i = this.$getRowCacheIndex(this.$docRowCache, docRow) + 1; if (l > i) { this.$docRowCache.splice(i, l); this.$screenRowCache.splice(i, l); } }; this.$getRowCacheIndex = function(cacheArray, val) { var low = 0; var hi = cacheArray.length - 1; while (low <= hi) { var mid = (low + hi) >> 1; var c = cacheArray[mid]; if (val > c) low = mid + 1; else if (val < c) hi = mid - 1; else return mid; } return low -1; }; this.resetCaches = function() { this.$modified = true; this.$wrapData = []; this.$rowLengthCache = []; this.$resetRowCache(0); if (this.bgTokenizer) this.bgTokenizer.start(0); }; this.onChangeFold = function(e) { var fold = e.data; this.$resetRowCache(fold.start.row); }; this.onChange = function(delta) { this.$modified = true; this.$bidiHandler.onChange(delta); this.$resetRowCache(delta.start.row); var removedFolds = this.$updateInternalDataOnChange(delta); if (!this.$fromUndo && this.$undoManager) { if (removedFolds && removedFolds.length) { this.$undoManager.add({ action: "removeFolds", folds: removedFolds }, this.mergeUndoDeltas); this.mergeUndoDeltas = true; } this.$undoManager.add(delta, this.mergeUndoDeltas); this.mergeUndoDeltas = true; this.$informUndoManager.schedule(); } this.bgTokenizer && this.bgTokenizer.$updateOnChange(delta); this._signal("change", delta); }; /** * Sets the session text. * @param {String} text The new text to place * **/ this.setValue = function(text) { this.doc.setValue(text); this.selection.moveTo(0, 0); this.$resetRowCache(0); this.setUndoManager(this.$undoManager); this.getUndoManager().reset(); }; /** * Returns the current [[Document `Document`]] as a string. * @method toString * @returns {String} * @alias EditSession.getValue * **/ /** * Returns the current [[Document `Document`]] as a string. * @method getValue * @returns {String} * @alias EditSession.toString **/ this.getValue = this.toString = function() { return this.doc.getValue(); }; /** * Returns selection object. **/ this.getSelection = function() { return this.selection; }; /** * {:BackgroundTokenizer.getState} * @param {Number} row The row to start at * * @related BackgroundTokenizer.getState **/ this.getState = function(row) { return this.bgTokenizer.getState(row); }; /** * Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows. * @param {Number} row The row to start at * * * **/ this.getTokens = function(row) { return this.bgTokenizer.getTokens(row); }; /** * Returns an object indicating the token at the current row. The object has two properties: `index` and `start`. * @param {Number} row The row number to retrieve from * @param {Number} column The column number to retrieve from * * **/ this.getTokenAt = function(row, column) { var tokens = this.bgTokenizer.getTokens(row); var token, c = 0; if (column == null) { var i = tokens.length - 1; c = this.getLine(row).length; } else { for (var i = 0; i < tokens.length; i++) { c += tokens[i].value.length; if (c >= column) break; } } token = tokens[i]; if (!token) return null; token.index = i; token.start = c - token.value.length; return token; }; /** * Sets the undo manager. * @param {UndoManager} undoManager The new undo manager * * **/ this.setUndoManager = function(undoManager) { this.$undoManager = undoManager; if (this.$informUndoManager) this.$informUndoManager.cancel(); if (undoManager) { var self = this; undoManager.addSession(this); this.$syncInformUndoManager = function() { self.$informUndoManager.cancel(); self.mergeUndoDeltas = false; }; this.$informUndoManager = lang.delayedCall(this.$syncInformUndoManager); } else { this.$syncInformUndoManager = function() {}; } }; /** * starts a new group in undo history **/ this.markUndoGroup = function() { if (this.$syncInformUndoManager) this.$syncInformUndoManager(); }; this.$defaultUndoManager = { undo: function() {}, redo: function() {}, reset: function() {}, add: function() {}, addSelection: function() {}, startNewGroup: function() {}, addSession: function() {} }; /** * Returns the current undo manager. **/ this.getUndoManager = function() { return this.$undoManager || this.$defaultUndoManager; }; /** * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`. **/ this.getTabString = function() { if (this.getUseSoftTabs()) { return lang.stringRepeat(" ", this.getTabSize()); } else { return "\t"; } }; /** * Pass `true` to enable the use of soft tabs. Soft tabs means you're using spaces instead of the tab character (`'\t'`). * @param {Boolean} useSoftTabs Value indicating whether or not to use soft tabs **/ this.setUseSoftTabs = function(val) { this.setOption("useSoftTabs", val); }; /** * Returns `true` if soft tabs are being used, `false` otherwise. * @returns {Boolean} **/ this.getUseSoftTabs = function() { // todo might need more general way for changing settings from mode, but this is ok for now return this.$useSoftTabs && !this.$mode.$indentWithTabs; }; /** * Set the number of spaces that define a soft tab; for example, passing in `4` transforms the soft tabs to be equivalent to four spaces. This function also emits the `changeTabSize` event. * @param {Number} tabSize The new tab size **/ this.setTabSize = function(tabSize) { this.setOption("tabSize", tabSize); }; /** * Returns the current tab size. **/ this.getTabSize = function() { return this.$tabSize; }; /** * Returns `true` if the character at the position is a soft tab. * @param {Object} position The position to check * **/ this.isTabStop = function(position) { return this.$useSoftTabs && (position.column % this.$tabSize === 0); }; /** * Set whether keyboard navigation of soft tabs moves the cursor within the soft tab, rather than over * @param {Boolean} navigateWithinSoftTabs Value indicating whether or not to navigate within soft tabs **/ this.setNavigateWithinSoftTabs = function (navigateWithinSoftTabs) { this.setOption("navigateWithinSoftTabs", navigateWithinSoftTabs); }; /** * Returns `true` if keyboard navigation moves the cursor within soft tabs, `false` if it moves the cursor over soft tabs. * @returns {Boolean} **/ this.getNavigateWithinSoftTabs = function() { return this.$navigateWithinSoftTabs; }; this.$overwrite = false; /** * Pass in `true` to enable overwrites in your session, or `false` to disable. * * If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emits the `changeOverwrite` event. * * @param {Boolean} overwrite Defines whether or not to set overwrites * * **/ this.setOverwrite = function(overwrite) { this.setOption("overwrite", overwrite); }; /** * Returns `true` if overwrites are enabled; `false` otherwise. **/ this.getOverwrite = function() { return this.$overwrite; }; /** * Sets the value of overwrite to the opposite of whatever it currently is. **/ this.toggleOverwrite = function() { this.setOverwrite(!this.$overwrite); }; /** * Adds `className` to the `row`, to be used for CSS stylings and whatnot. * @param {Number} row The row number * @param {String} className The class to add * **/ this.addGutterDecoration = function(row, className) { if (!this.$decorations[row]) this.$decorations[row] = ""; this.$decorations[row] += " " + className; this._signal("changeBreakpoint", {}); }; /** * Removes `className` from the `row`. * @param {Number} row The row number * @param {String} className The class to add * **/ this.removeGutterDecoration = function(row, className) { this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, ""); this._signal("changeBreakpoint", {}); }; /** * Returns an array of strings, indicating the breakpoint class (if any) applied to each row. * @returns {[String]} **/ this.getBreakpoints = function() { return this.$breakpoints; }; /** * Sets a breakpoint on every row number given by `rows`. This function also emites the `'changeBreakpoint'` event. * @param {Array} rows An array of row indices * **/ this.setBreakpoints = function(rows) { this.$breakpoints = []; for (var i=0; i 0) inToken = !!line.charAt(column - 1).match(this.tokenRe); if (!inToken) inToken = !!line.charAt(column).match(this.tokenRe); if (inToken) var re = this.tokenRe; else if (/^\s+$/.test(line.slice(column-1, column+1))) var re = /\s/; else var re = this.nonTokenRe; var start = column; if (start > 0) { do { start--; } while (start >= 0 && line.charAt(start).match(re)); start++; } var end = column; while (end < line.length && line.charAt(end).match(re)) { end++; } return new Range(row, start, row, end); }; /** * Gets the range of a word, including its right whitespace. * @param {Number} row The row number to start from * @param {Number} column The column number to start from * * @return {Range} **/ this.getAWordRange = function(row, column) { var wordRange = this.getWordRange(row, column); var line = this.getLine(wordRange.end.row); while (line.charAt(wordRange.end.column).match(/[ \t]/)) { wordRange.end.column += 1; } return wordRange; }; /** * {:Document.setNewLineMode.desc} * @param {String} newLineMode {:Document.setNewLineMode.param} * * * @related Document.setNewLineMode **/ this.setNewLineMode = function(newLineMode) { this.doc.setNewLineMode(newLineMode); }; /** * * Returns the current new line mode. * @returns {String} * @related Document.getNewLineMode **/ this.getNewLineMode = function() { return this.doc.getNewLineMode(); }; /** * Identifies if you want to use a worker for the `EditSession`. * @param {Boolean} useWorker Set to `true` to use a worker * **/ this.setUseWorker = function(useWorker) { this.setOption("useWorker", useWorker); }; /** * Returns `true` if workers are being used. **/ this.getUseWorker = function() { return this.$useWorker; }; /** * Reloads all the tokens on the current session. This function calls [[BackgroundTokenizer.start `BackgroundTokenizer.start ()`]] to all the rows; it also emits the `'tokenizerUpdate'` event. **/ this.onReloadTokenizer = function(e) { var rows = e.data; this.bgTokenizer.start(rows.first); this._signal("tokenizerUpdate", e); }; this.$modes = {}; /** * Sets a new text mode for the `EditSession`. This method also emits the `'changeMode'` event. If a [[BackgroundTokenizer `BackgroundTokenizer`]] is set, the `'tokenizerUpdate'` event is also emitted. * @param {TextMode} mode Set a new text mode * @param {cb} optional callback * **/ this.$mode = null; this.$modeId = null; this.setMode = function(mode, cb) { if (mode && typeof mode === "object") { if (mode.getTokenizer) return this.$onChangeMode(mode); var options = mode; var path = options.path; } else { path = mode || "ace/mode/text"; } // this is needed if ace isn't on require path (e.g tests in node) if (!this.$modes["ace/mode/text"]) this.$modes["ace/mode/text"] = new TextMode(); if (this.$modes[path] && !options) { this.$onChangeMode(this.$modes[path]); cb && cb(); return; } // load on demand this.$modeId = path; config.loadModule(["mode", path], function(m) { if (this.$modeId !== path) return cb && cb(); if (this.$modes[path] && !options) { this.$onChangeMode(this.$modes[path]); } else if (m && m.Mode) { m = new m.Mode(options); if (!options) { this.$modes[path] = m; m.$id = path; } this.$onChangeMode(m); } cb && cb(); }.bind(this)); // set mode to text until loading is finished if (!this.$mode) this.$onChangeMode(this.$modes["ace/mode/text"], true); }; this.$onChangeMode = function(mode, $isPlaceholder) { if (!$isPlaceholder) this.$modeId = mode.$id; if (this.$mode === mode) return; this.$mode = mode; this.$stopWorker(); if (this.$useWorker) this.$startWorker(); var tokenizer = mode.getTokenizer(); if(tokenizer.addEventListener !== undefined) { var onReloadTokenizer = this.onReloadTokenizer.bind(this); tokenizer.addEventListener("update", onReloadTokenizer); } if (!this.bgTokenizer) { this.bgTokenizer = new BackgroundTokenizer(tokenizer); var _self = this; this.bgTokenizer.addEventListener("update", function(e) { _self._signal("tokenizerUpdate", e); }); } else { this.bgTokenizer.setTokenizer(tokenizer); } this.bgTokenizer.setDocument(this.getDocument()); this.tokenRe = mode.tokenRe; this.nonTokenRe = mode.nonTokenRe; if (!$isPlaceholder) { // experimental method, used by c9 findiniles if (mode.attachToSession) mode.attachToSession(this); this.$options.wrapMethod.set.call(this, this.$wrapMethod); this.$setFolding(mode.foldingRules); this.bgTokenizer.start(0); this._emit("changeMode"); } }; this.$stopWorker = function() { if (this.$worker) { this.$worker.terminate(); this.$worker = null; } }; this.$startWorker = function() { try { this.$worker = this.$mode.createWorker(this); } catch (e) { config.warn("Could not load worker", e); this.$worker = null; } }; /** * Returns the current text mode. * @returns {TextMode} The current text mode **/ this.getMode = function() { return this.$mode; }; this.$scrollTop = 0; /** * This function sets the scroll top value. It also emits the `'changeScrollTop'` event. * @param {Number} scrollTop The new scroll top value * **/ this.setScrollTop = function(scrollTop) { // TODO: should we force integer lineheight instead? scrollTop = Math.round(scrollTop); if (this.$scrollTop === scrollTop || isNaN(scrollTop)) return; this.$scrollTop = scrollTop; this._signal("changeScrollTop", scrollTop); }; /** * [Returns the value of the distance between the top of the editor and the topmost part of the visible content.]{: #EditSession.getScrollTop} * @returns {Number} **/ this.getScrollTop = function() { return this.$scrollTop; }; this.$scrollLeft = 0; /** * [Sets the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.setScrollLeft} **/ this.setScrollLeft = function(scrollLeft) { // scrollLeft = Math.round(scrollLeft); if (this.$scrollLeft === scrollLeft || isNaN(scrollLeft)) return; this.$scrollLeft = scrollLeft; this._signal("changeScrollLeft", scrollLeft); }; /** * [Returns the value of the distance between the left of the editor and the leftmost part of the visible content.]{: #EditSession.getScrollLeft} * @returns {Number} **/ this.getScrollLeft = function() { return this.$scrollLeft; }; /** * Returns the width of the screen. * @returns {Number} **/ this.getScreenWidth = function() { this.$computeWidth(); if (this.lineWidgets) return Math.max(this.getLineWidgetMaxWidth(), this.screenWidth); return this.screenWidth; }; this.getLineWidgetMaxWidth = function() { if (this.lineWidgetsWidth != null) return this.lineWidgetsWidth; var width = 0; this.lineWidgets.forEach(function(w) { if (w && w.screenWidth > width) width = w.screenWidth; }); return this.lineWidgetWidth = width; }; this.$computeWidth = function(force) { if (this.$modified || force) { this.$modified = false; if (this.$useWrapMode) return this.screenWidth = this.$wrapLimit; var lines = this.doc.getAllLines(); var cache = this.$rowLengthCache; var longestScreenLine = 0; var foldIndex = 0; var foldLine = this.$foldData[foldIndex]; var foldStart = foldLine ? foldLine.start.row : Infinity; var len = lines.length; for (var i = 0; i < len; i++) { if (i > foldStart) { i = foldLine.end.row + 1; if (i >= len) break; foldLine = this.$foldData[foldIndex++]; foldStart = foldLine ? foldLine.start.row : Infinity; } if (cache[i] == null) cache[i] = this.$getStringScreenWidth(lines[i])[0]; if (cache[i] > longestScreenLine) longestScreenLine = cache[i]; } this.screenWidth = longestScreenLine; } }; /** * Returns a verbatim copy of the given line as it is in the document * @param {Number} row The row to retrieve from * * @returns {String} **/ this.getLine = function(row) { return this.doc.getLine(row); }; /** * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`. * @param {Number} firstRow The first row index to retrieve * @param {Number} lastRow The final row index to retrieve * * @returns {[String]} * **/ this.getLines = function(firstRow, lastRow) { return this.doc.getLines(firstRow, lastRow); }; /** * Returns the number of rows in the document. * @returns {Number} **/ this.getLength = function() { return this.doc.getLength(); }; /** * {:Document.getTextRange.desc} * @param {Range} range The range to work with * * @returns {String} **/ this.getTextRange = function(range) { return this.doc.getTextRange(range || this.selection.getRange()); }; /** * Inserts a block of `text` and the indicated `position`. * @param {Object} position The position {row, column} to start inserting at * @param {String} text A chunk of text to insert * @returns {Object} The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`. * * **/ this.insert = function(position, text) { return this.doc.insert(position, text); }; /** * Removes the `range` from the document. * @param {Range} range A specified Range to remove * @returns {Object} The new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`. * * @related Document.remove * **/ this.remove = function(range) { return this.doc.remove(range); }; /** * Removes a range of full lines. This method also triggers the `'change'` event. * @param {Number} firstRow The first row to be removed * @param {Number} lastRow The last row to be removed * @returns {[String]} Returns all the removed lines. * * @related Document.removeFullLines * **/ this.removeFullLines = function(firstRow, lastRow){ return this.doc.removeFullLines(firstRow, lastRow); }; /** * Reverts previous changes to your document. * @param {Array} deltas An array of previous changes * @param {Boolean} dontSelect [If `true`, doesn't select the range of where the change occured]{: #dontSelect} * * @returns {Range} **/ this.undoChanges = function(deltas, dontSelect) { if (!deltas.length) return; this.$fromUndo = true; for (var i = deltas.length - 1; i != -1; i--) { var delta = deltas[i]; if (delta.action == "insert" || delta.action == "remove") { this.doc.revertDelta(delta); } else if (delta.folds) { this.addFolds(delta.folds); } } if (!dontSelect && this.$undoSelect) { // console.log(deltas.selectionBefore + "uuu") if (deltas.selectionBefore) this.selection.fromJSON(deltas.selectionBefore); else this.selection.setRange(this.$getUndoSelection(deltas, true)); } this.$fromUndo = false; }; /** * Re-implements a previously undone change to your document. * @param {Array} deltas An array of previous changes * @param {Boolean} dontSelect {:dontSelect} * * @returns {Range} **/ this.redoChanges = function(deltas, dontSelect) { if (!deltas.length) return; this.$fromUndo = true; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; if (delta.action == "insert" || delta.action == "remove") { this.doc.applyDelta(delta); } } if (!dontSelect && this.$undoSelect) { if (deltas.selectionAfter) this.selection.fromJSON(deltas.selectionAfter); else this.selection.setRange(this.$getUndoSelection(deltas, false)); } this.$fromUndo = false; }; /** * Enables or disables highlighting of the range where an undo occurred. * @param {Boolean} enable If `true`, selects the range of the reinserted change * **/ this.setUndoSelect = function(enable) { this.$undoSelect = enable; }; this.$getUndoSelection = function(deltas, isUndo) { function isInsert(delta) { return isUndo ? delta.action !== "insert" : delta.action === "insert"; } var range, point; var lastDeltaIsInsert; for (var i = 0; i < deltas.length; i++) { var delta = deltas[i]; if (!delta.start) continue; // skip folds if (!range) { if (isInsert(delta)) { range = Range.fromPoints(delta.start, delta.end); lastDeltaIsInsert = true; } else { range = Range.fromPoints(delta.start, delta.start); lastDeltaIsInsert = false; } continue; } if (isInsert(delta)) { point = delta.start; if (range.compare(point.row, point.column) == -1) { range.setStart(point); } point = delta.end; if (range.compare(point.row, point.column) == 1) { range.setEnd(point); } lastDeltaIsInsert = true; } else { point = delta.start; if (range.compare(point.row, point.column) == -1) { range = Range.fromPoints(delta.start, delta.start); } lastDeltaIsInsert = false; } } return range; }; /** * Replaces a range in the document with the new `text`. * * @param {Range} range A specified Range to replace * @param {String} text The new text to use as a replacement * @returns {Object} An object containing the final row and column, like this: * ``` * {row: endRow, column: 0} * ``` * If the text and range are empty, this function returns an object containing the current `range.start` value. * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value. * * @related Document.replace **/ this.replace = function(range, text) { return this.doc.replace(range, text); }; /** * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this: * ```json * { row: newRowLocation, column: newColumnLocation } * ``` * @param {Range} fromRange The range of text you want moved within the document * @param {Object} toPosition The location (row and column) where you want to move the text to * @returns {Range} The new range where the text was moved to. **/ this.moveText = function(fromRange, toPosition, copy) { var text = this.getTextRange(fromRange); var folds = this.getFoldsInRange(fromRange); var toRange = Range.fromPoints(toPosition, toPosition); if (!copy) { this.remove(fromRange); var rowDiff = fromRange.start.row - fromRange.end.row; var collDiff = rowDiff ? -fromRange.end.column : fromRange.start.column - fromRange.end.column; if (collDiff) { if (toRange.start.row == fromRange.end.row && toRange.start.column > fromRange.end.column) toRange.start.column += collDiff; if (toRange.end.row == fromRange.end.row && toRange.end.column > fromRange.end.column) toRange.end.column += collDiff; } if (rowDiff && toRange.start.row >= fromRange.end.row) { toRange.start.row += rowDiff; toRange.end.row += rowDiff; } } toRange.end = this.insert(toRange.start, text); if (folds.length) { var oldStart = fromRange.start; var newStart = toRange.start; var rowDiff = newStart.row - oldStart.row; var collDiff = newStart.column - oldStart.column; this.addFolds(folds.map(function(x) { x = x.clone(); if (x.start.row == oldStart.row) x.start.column += collDiff; if (x.end.row == oldStart.row) x.end.column += collDiff; x.start.row += rowDiff; x.end.row += rowDiff; return x; })); } return toRange; }; /** * Indents all the rows, from `startRow` to `endRow` (inclusive), by prefixing each row with the token in `indentString`. * * If `indentString` contains the `'\t'` character, it's replaced by whatever is defined by [[EditSession.getTabString `getTabString()`]]. * @param {Number} startRow Starting row * @param {Number} endRow Ending row * @param {String} indentString The indent token * * **/ this.indentRows = function(startRow, endRow, indentString) { indentString = indentString.replace(/\t/g, this.getTabString()); for (var row=startRow; row<=endRow; row++) this.doc.insertInLine({row: row, column: 0}, indentString); }; /** * Outdents all the rows defined by the `start` and `end` properties of `range`. * @param {Range} range A range of rows * **/ this.outdentRows = function (range) { var rowRange = range.collapseRows(); var deleteRange = new Range(0, 0, 0, 0); var size = this.getTabSize(); for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) { var line = this.getLine(i); deleteRange.start.row = i; deleteRange.end.row = i; for (var j = 0; j < size; ++j) if (line.charAt(j) != ' ') break; if (j < size && line.charAt(j) == '\t') { deleteRange.start.column = j; deleteRange.end.column = j + 1; } else { deleteRange.start.column = 0; deleteRange.end.column = j; } this.remove(deleteRange); } }; this.$moveLines = function(firstRow, lastRow, dir) { firstRow = this.getRowFoldStart(firstRow); lastRow = this.getRowFoldEnd(lastRow); if (dir < 0) { var row = this.getRowFoldStart(firstRow + dir); if (row < 0) return 0; var diff = row-firstRow; } else if (dir > 0) { var row = this.getRowFoldEnd(lastRow + dir); if (row > this.doc.getLength()-1) return 0; var diff = row-lastRow; } else { firstRow = this.$clipRowToDocument(firstRow); lastRow = this.$clipRowToDocument(lastRow); var diff = lastRow - firstRow + 1; } var range = new Range(firstRow, 0, lastRow, Number.MAX_VALUE); var folds = this.getFoldsInRange(range).map(function(x){ x = x.clone(); x.start.row += diff; x.end.row += diff; return x; }); var lines = dir == 0 ? this.doc.getLines(firstRow, lastRow) : this.doc.removeFullLines(firstRow, lastRow); this.doc.insertFullLines(firstRow+diff, lines); folds.length && this.addFolds(folds); return diff; }; /** * Shifts all the lines in the document up one, starting from `firstRow` and ending at `lastRow`. * @param {Number} firstRow The starting row to move up * @param {Number} lastRow The final row to move up * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1. * **/ this.moveLinesUp = function(firstRow, lastRow) { return this.$moveLines(firstRow, lastRow, -1); }; /** * Shifts all the lines in the document down one, starting from `firstRow` and ending at `lastRow`. * @param {Number} firstRow The starting row to move down * @param {Number} lastRow The final row to move down * @returns {Number} If `firstRow` is less-than or equal to 0, this function returns 0. Otherwise, on success, it returns -1. **/ this.moveLinesDown = function(firstRow, lastRow) { return this.$moveLines(firstRow, lastRow, 1); }; /** * Duplicates all the text between `firstRow` and `lastRow`. * @param {Number} firstRow The starting row to duplicate * @param {Number} lastRow The final row to duplicate * @returns {Number} Returns the number of new rows added; in other words, `lastRow - firstRow + 1`. * * **/ this.duplicateLines = function(firstRow, lastRow) { return this.$moveLines(firstRow, lastRow, 0); }; this.$clipRowToDocument = function(row) { return Math.max(0, Math.min(row, this.doc.getLength()-1)); }; this.$clipColumnToRow = function(row, column) { if (column < 0) return 0; return Math.min(this.doc.getLine(row).length, column); }; this.$clipPositionToDocument = function(row, column) { column = Math.max(0, column); if (row < 0) { row = 0; column = 0; } else { var len = this.doc.getLength(); if (row >= len) { row = len - 1; column = this.doc.getLine(len-1).length; } else { column = Math.min(this.doc.getLine(row).length, column); } } return { row: row, column: column }; }; this.$clipRangeToDocument = function(range) { if (range.start.row < 0) { range.start.row = 0; range.start.column = 0; } else { range.start.column = this.$clipColumnToRow( range.start.row, range.start.column ); } var len = this.doc.getLength() - 1; if (range.end.row > len) { range.end.row = len; range.end.column = this.doc.getLine(len).length; } else { range.end.column = this.$clipColumnToRow( range.end.row, range.end.column ); } return range; }; // WRAPMODE this.$wrapLimit = 80; this.$useWrapMode = false; this.$wrapLimitRange = { min : null, max : null }; /** * Sets whether or not line wrapping is enabled. If `useWrapMode` is different than the current value, the `'changeWrapMode'` event is emitted. * @param {Boolean} useWrapMode Enable (or disable) wrap mode * **/ this.setUseWrapMode = function(useWrapMode) { if (useWrapMode != this.$useWrapMode) { this.$useWrapMode = useWrapMode; this.$modified = true; this.$resetRowCache(0); // If wrapMode is activaed, the wrapData array has to be initialized. if (useWrapMode) { var len = this.getLength(); this.$wrapData = Array(len); this.$updateWrapData(0, len - 1); } this._signal("changeWrapMode"); } }; /** * Returns `true` if wrap mode is being used; `false` otherwise. * @returns {Boolean} **/ this.getUseWrapMode = function() { return this.$useWrapMode; }; // Allow the wrap limit to move freely between min and max. Either // parameter can be null to allow the wrap limit to be unconstrained // in that direction. Or set both parameters to the same number to pin // the limit to that value. /** * Sets the boundaries of wrap. Either value can be `null` to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for `min` or `max` are different, this method also emits the `'changeWrapMode'` event. * @param {Number} min The minimum wrap value (the left side wrap) * @param {Number} max The maximum wrap value (the right side wrap) * **/ this.setWrapLimitRange = function(min, max) { if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) { this.$wrapLimitRange = { min: min, max: max }; this.$modified = true; this.$bidiHandler.markAsDirty(); // This will force a recalculation of the wrap limit if (this.$useWrapMode) this._signal("changeWrapMode"); } }; /** * This should generally only be called by the renderer when a resize is detected. * @param {Number} desiredLimit The new wrap limit * @returns {Boolean} * * @private **/ this.adjustWrapLimit = function(desiredLimit, $printMargin) { var limits = this.$wrapLimitRange; if (limits.max < 0) limits = {min: $printMargin, max: $printMargin}; var wrapLimit = this.$constrainWrapLimit(desiredLimit, limits.min, limits.max); if (wrapLimit != this.$wrapLimit && wrapLimit > 1) { this.$wrapLimit = wrapLimit; this.$modified = true; if (this.$useWrapMode) { this.$updateWrapData(0, this.getLength() - 1); this.$resetRowCache(0); this._signal("changeWrapLimit"); } return true; } return false; }; this.$constrainWrapLimit = function(wrapLimit, min, max) { if (min) wrapLimit = Math.max(min, wrapLimit); if (max) wrapLimit = Math.min(max, wrapLimit); return wrapLimit; }; /** * Returns the value of wrap limit. * @returns {Number} The wrap limit. **/ this.getWrapLimit = function() { return this.$wrapLimit; }; /** * Sets the line length for soft wrap in the editor. Lines will break * at a minimum of the given length minus 20 chars and at a maximum * of the given number of chars. * @param {number} limit The maximum line length in chars, for soft wrapping lines. */ this.setWrapLimit = function (limit) { this.setWrapLimitRange(limit, limit); }; /** * Returns an object that defines the minimum and maximum of the wrap limit; it looks something like this: * * { min: wrapLimitRange_min, max: wrapLimitRange_max } * * @returns {Object} **/ this.getWrapLimitRange = function() { // Avoid unexpected mutation by returning a copy return { min : this.$wrapLimitRange.min, max : this.$wrapLimitRange.max }; }; this.$updateInternalDataOnChange = function(delta) { var useWrapMode = this.$useWrapMode; var action = delta.action; var start = delta.start; var end = delta.end; var firstRow = start.row; var lastRow = end.row; var len = lastRow - firstRow; var removedFolds = null; this.$updating = true; if (len != 0) { if (action === "remove") { this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len); var foldLines = this.$foldData; removedFolds = this.getFoldsInRange(delta); this.removeFolds(removedFolds); var foldLine = this.getFoldLine(end.row); var idx = 0; if (foldLine) { foldLine.addRemoveChars(end.row, end.column, start.column - end.column); foldLine.shiftRow(-len); var foldLineBefore = this.getFoldLine(firstRow); if (foldLineBefore && foldLineBefore !== foldLine) { foldLineBefore.merge(foldLine); foldLine = foldLineBefore; } idx = foldLines.indexOf(foldLine) + 1; } for (idx; idx < foldLines.length; idx++) { var foldLine = foldLines[idx]; if (foldLine.start.row >= end.row) { foldLine.shiftRow(-len); } } lastRow = firstRow; } else { var args = Array(len); args.unshift(firstRow, 0); var arr = useWrapMode ? this.$wrapData : this.$rowLengthCache; arr.splice.apply(arr, args); // If some new line is added inside of a foldLine, then split // the fold line up. var foldLines = this.$foldData; var foldLine = this.getFoldLine(firstRow); var idx = 0; if (foldLine) { var cmp = foldLine.range.compareInside(start.row, start.column); // Inside of the foldLine range. Need to split stuff up. if (cmp == 0) { foldLine = foldLine.split(start.row, start.column); if (foldLine) { foldLine.shiftRow(len); foldLine.addRemoveChars(lastRow, 0, end.column - start.column); } } else // Infront of the foldLine but same row. Need to shift column. if (cmp == -1) { foldLine.addRemoveChars(firstRow, 0, end.column - start.column); foldLine.shiftRow(len); } // Nothing to do if the insert is after the foldLine. idx = foldLines.indexOf(foldLine) + 1; } for (idx; idx < foldLines.length; idx++) { var foldLine = foldLines[idx]; if (foldLine.start.row >= firstRow) { foldLine.shiftRow(len); } } } } else { // Realign folds. E.g. if you add some new chars before a fold, the // fold should "move" to the right. len = Math.abs(delta.start.column - delta.end.column); if (action === "remove") { // Get all the folds in the change range and remove them. removedFolds = this.getFoldsInRange(delta); this.removeFolds(removedFolds); len = -len; } var foldLine = this.getFoldLine(firstRow); if (foldLine) { foldLine.addRemoveChars(firstRow, start.column, len); } } if (useWrapMode && this.$wrapData.length != this.doc.getLength()) { console.error("doc.getLength() and $wrapData.length have to be the same!"); } this.$updating = false; if (useWrapMode) this.$updateWrapData(firstRow, lastRow); else this.$updateRowLengthCache(firstRow, lastRow); return removedFolds; }; this.$updateRowLengthCache = function(firstRow, lastRow, b) { this.$rowLengthCache[firstRow] = null; this.$rowLengthCache[lastRow] = null; }; this.$updateWrapData = function(firstRow, lastRow) { var lines = this.doc.getAllLines(); var tabSize = this.getTabSize(); var wrapData = this.$wrapData; var wrapLimit = this.$wrapLimit; var tokens; var foldLine; var row = firstRow; lastRow = Math.min(lastRow, lines.length - 1); while (row <= lastRow) { foldLine = this.getFoldLine(row, foldLine); if (!foldLine) { tokens = this.$getDisplayTokens(lines[row]); wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize); row ++; } else { tokens = []; foldLine.walk(function(placeholder, row, column, lastColumn) { var walkTokens; if (placeholder != null) { walkTokens = this.$getDisplayTokens( placeholder, tokens.length); walkTokens[0] = PLACEHOLDER_START; for (var i = 1; i < walkTokens.length; i++) { walkTokens[i] = PLACEHOLDER_BODY; } } else { walkTokens = this.$getDisplayTokens( lines[row].substring(lastColumn, column), tokens.length); } tokens = tokens.concat(walkTokens); }.bind(this), foldLine.end.row, lines[foldLine.end.row].length + 1 ); wrapData[foldLine.start.row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize); row = foldLine.end.row + 1; } } }; // "Tokens" var CHAR = 1, CHAR_EXT = 2, PLACEHOLDER_START = 3, PLACEHOLDER_BODY = 4, PUNCTUATION = 9, SPACE = 10, TAB = 11, TAB_SPACE = 12; this.$computeWrapSplits = function(tokens, wrapLimit, tabSize) { if (tokens.length == 0) { return []; } var splits = []; var displayLength = tokens.length; var lastSplit = 0, lastDocSplit = 0; var isCode = this.$wrapAsCode; var indentedSoftWrap = this.$indentedSoftWrap; var maxIndent = wrapLimit <= Math.max(2 * tabSize, 8) || indentedSoftWrap === false ? 0 : Math.floor(wrapLimit / 2); function getWrapIndent() { var indentation = 0; if (maxIndent === 0) return indentation; if (indentedSoftWrap) { for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; if (token == SPACE) indentation += 1; else if (token == TAB) indentation += tabSize; else if (token == TAB_SPACE) continue; else break; } } if (isCode && indentedSoftWrap !== false) indentation += tabSize; return Math.min(indentation, maxIndent); } function addSplit(screenPos) { var displayed = tokens.slice(lastSplit, screenPos); // The document size is the current size - the extra width for tabs // and multipleWidth characters. var len = displayed.length; displayed.join("") // Get all the TAB_SPACEs. .replace(/12/g, function() { len -= 1; }) // Get all the CHAR_EXT/multipleWidth characters. .replace(/2/g, function() { len -= 1; }); if (!splits.length) { indent = getWrapIndent(); splits.indent = indent; } lastDocSplit += len; splits.push(lastDocSplit); lastSplit = screenPos; } var indent = 0; while (displayLength - lastSplit > wrapLimit - indent) { // This is, where the split should be. var split = lastSplit + wrapLimit - indent; // If there is a space or tab at this split position, then making // a split is simple. if (tokens[split - 1] >= SPACE && tokens[split] >= SPACE) { /* disabled see https://github.com/ajaxorg/ace/issues/1186 // Include all following spaces + tabs in this split as well. while (tokens[split] >= SPACE) { split ++; } */ addSplit(split); continue; } // === ELSE === // Check if split is inside of a placeholder. Placeholder are // not splitable. Therefore, seek the beginning of the placeholder // and try to place the split before the placeholder's start. if (tokens[split] == PLACEHOLDER_START || tokens[split] == PLACEHOLDER_BODY) { // Seek the start of the placeholder and do the split // before the placeholder. By definition there always // a PLACEHOLDER_START between split and lastSplit. for (split; split != lastSplit - 1; split--) { if (tokens[split] == PLACEHOLDER_START) { // split++; << No incremental here as we want to // have the position before the Placeholder. break; } } // If the PLACEHOLDER_START is not the index of the // last split, then we can do the split if (split > lastSplit) { addSplit(split); continue; } // If the PLACEHOLDER_START IS the index of the last // split, then we have to place the split after the // placeholder. So, let's seek for the end of the placeholder. split = lastSplit + wrapLimit; for (split; split < tokens.length; split++) { if (tokens[split] != PLACEHOLDER_BODY) { break; } } // If spilt == tokens.length, then the placeholder is the last // thing in the line and adding a new split doesn't make sense. if (split == tokens.length) { break; // Breaks the while-loop. } // Finally, add the split... addSplit(split); continue; } // === ELSE === // Search for the first non space/tab/placeholder/punctuation token backwards. var minSplit = Math.max(split - (wrapLimit -(wrapLimit>>2)), lastSplit - 1); while (split > minSplit && tokens[split] < PLACEHOLDER_START) { split --; } if (isCode) { while (split > minSplit && tokens[split] < PLACEHOLDER_START) { split --; } while (split > minSplit && tokens[split] == PUNCTUATION) { split --; } } else { while (split > minSplit && tokens[split] < SPACE) { split --; } } // If we found one, then add the split. if (split > minSplit) { addSplit(++split); continue; } // === ELSE === split = lastSplit + wrapLimit; // The split is inside of a CHAR or CHAR_EXT token and no space // around -> force a split. if (tokens[split] == CHAR_EXT) split--; addSplit(split - indent); } return splits; }; /** * Given a string, returns an array of the display characters, including tabs and spaces. * @param {String} str The string to check * @param {Number} offset The value to start at * **/ this.$getDisplayTokens = function(str, offset) { var arr = []; var tabSize; offset = offset || 0; for (var i = 0; i < str.length; i++) { var c = str.charCodeAt(i); // Tab if (c == 9) { tabSize = this.getScreenTabSize(arr.length + offset); arr.push(TAB); for (var n = 1; n < tabSize; n++) { arr.push(TAB_SPACE); } } // Space else if (c == 32) { arr.push(SPACE); } else if((c > 39 && c < 48) || (c > 57 && c < 64)) { arr.push(PUNCTUATION); } // full width characters else if (c >= 0x1100 && isFullWidth(c)) { arr.push(CHAR, CHAR_EXT); } else { arr.push(CHAR); } } return arr; }; /** * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen. * @param {String} str The string to calculate the screen width of * @param {Number} maxScreenColumn * @param {Number} screenColumn * @returns {[Number]} Returns an `int[]` array with two elements:
    * The first position indicates the number of columns for `str` on screen.
    * The second value contains the position of the document column that this function read until. * **/ this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) { if (maxScreenColumn == 0) return [0, 0]; if (maxScreenColumn == null) maxScreenColumn = Infinity; screenColumn = screenColumn || 0; var c, column; for (column = 0; column < str.length; column++) { c = str.charCodeAt(column); // tab if (c == 9) { screenColumn += this.getScreenTabSize(screenColumn); } // full width characters else if (c >= 0x1100 && isFullWidth(c)) { screenColumn += 2; } else { screenColumn += 1; } if (screenColumn > maxScreenColumn) { break; } } return [screenColumn, column]; }; this.lineWidgets = null; /** * Returns number of screenrows in a wrapped line. * @param {Number} row The row number to check * * @returns {Number} **/ this.getRowLength = function(row) { if (this.lineWidgets) var h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0; else h = 0; if (!this.$useWrapMode || !this.$wrapData[row]) { return 1 + h; } else { return this.$wrapData[row].length + 1 + h; } }; this.getRowLineCount = function(row) { if (!this.$useWrapMode || !this.$wrapData[row]) { return 1; } else { return this.$wrapData[row].length + 1; } }; this.getRowWrapIndent = function(screenRow) { if (this.$useWrapMode) { var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE); var splits = this.$wrapData[pos.row]; return splits.length && splits[0] < pos.column ? splits.indent : 0; } else { return 0; } }; /** * Returns the position (on screen) for the last character in the provided screen row. * @param {Number} screenRow The screen row to check * @returns {Number} * * @related EditSession.documentToScreenColumn **/ this.getScreenLastRowColumn = function(screenRow) { var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE); return this.documentToScreenColumn(pos.row, pos.column); }; /** * For the given document row and column, this returns the column position of the last screen row. * @param {Number} docRow * * @param {Number} docColumn **/ this.getDocumentLastRowColumn = function(docRow, docColumn) { var screenRow = this.documentToScreenRow(docRow, docColumn); return this.getScreenLastRowColumn(screenRow); }; /** * For the given document row and column, this returns the document position of the last row. * @param {Number} docRow * @param {Number} docColumn * **/ this.getDocumentLastRowColumnPosition = function(docRow, docColumn) { var screenRow = this.documentToScreenRow(docRow, docColumn); return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10); }; /** * For the given row, this returns the split data. * @returns {String} **/ this.getRowSplitData = function(row) { if (!this.$useWrapMode) { return undefined; } else { return this.$wrapData[row]; } }; /** * The distance to the next tab stop at the specified screen column. * @param {Number} screenColumn The screen column to check * * @returns {Number} **/ this.getScreenTabSize = function(screenColumn) { return this.$tabSize - screenColumn % this.$tabSize; }; this.screenToDocumentRow = function(screenRow, screenColumn) { return this.screenToDocumentPosition(screenRow, screenColumn).row; }; this.screenToDocumentColumn = function(screenRow, screenColumn) { return this.screenToDocumentPosition(screenRow, screenColumn).column; }; /** * Converts characters coordinates on the screen to characters coordinates within the document. [This takes into account code folding, word wrap, tab size, and any other visual modifications.]{: #conversionConsiderations} * @param {Number} screenRow The screen row to check * @param {Number} screenColumn The screen column to check * @param {int} screen character x-offset [optional] * * @returns {Object} The object returned has two properties: `row` and `column`. * * @related EditSession.documentToScreenPosition **/ this.screenToDocumentPosition = function(screenRow, screenColumn, offsetX) { if (screenRow < 0) return {row: 0, column: 0}; var line; var docRow = 0; var docColumn = 0; var column; var row = 0; var rowLength = 0; var rowCache = this.$screenRowCache; var i = this.$getRowCacheIndex(rowCache, screenRow); var l = rowCache.length; if (l && i >= 0) { var row = rowCache[i]; var docRow = this.$docRowCache[i]; var doCache = screenRow > rowCache[l - 1]; } else { var doCache = !l; } var maxRow = this.getLength() - 1; var foldLine = this.getNextFoldLine(docRow); var foldStart = foldLine ? foldLine.start.row : Infinity; while (row <= screenRow) { rowLength = this.getRowLength(docRow); if (row + rowLength > screenRow || docRow >= maxRow) { break; } else { row += rowLength; docRow++; if (docRow > foldStart) { docRow = foldLine.end.row+1; foldLine = this.getNextFoldLine(docRow, foldLine); foldStart = foldLine ? foldLine.start.row : Infinity; } } if (doCache) { this.$docRowCache.push(docRow); this.$screenRowCache.push(row); } } if (foldLine && foldLine.start.row <= docRow) { line = this.getFoldDisplayLine(foldLine); docRow = foldLine.start.row; } else if (row + rowLength <= screenRow || docRow > maxRow) { // clip at the end of the document return { row: maxRow, column: this.getLine(maxRow).length }; } else { line = this.getLine(docRow); foldLine = null; } var wrapIndent = 0, splitIndex = Math.floor(screenRow - row); if (this.$useWrapMode) { var splits = this.$wrapData[docRow]; if (splits) { column = splits[splitIndex]; if(splitIndex > 0 && splits.length) { wrapIndent = splits.indent; docColumn = splits[splitIndex - 1] || splits[splits.length - 1]; line = line.substring(docColumn); } } } if (offsetX !== undefined && this.$bidiHandler.isBidiRow(row + splitIndex, docRow, splitIndex)) screenColumn = this.$bidiHandler.offsetToCol(offsetX); docColumn += this.$getStringScreenWidth(line, screenColumn - wrapIndent)[1]; // We remove one character at the end so that the docColumn // position returned is not associated to the next row on the screen. if (this.$useWrapMode && docColumn >= column) docColumn = column - 1; if (foldLine) return foldLine.idxToPosition(docColumn); return {row: docRow, column: docColumn}; }; /** * Converts document coordinates to screen coordinates. {:conversionConsiderations} * @param {Number} docRow The document row to check * @param {Number} docColumn The document column to check * @returns {Object} The object returned by this method has two properties: `row` and `column`. * * @related EditSession.screenToDocumentPosition **/ this.documentToScreenPosition = function(docRow, docColumn) { // Normalize the passed in arguments. if (typeof docColumn === "undefined") var pos = this.$clipPositionToDocument(docRow.row, docRow.column); else pos = this.$clipPositionToDocument(docRow, docColumn); docRow = pos.row; docColumn = pos.column; var screenRow = 0; var foldStartRow = null; var fold = null; // Clamp the docRow position in case it's inside of a folded block. fold = this.getFoldAt(docRow, docColumn, 1); if (fold) { docRow = fold.start.row; docColumn = fold.start.column; } var rowEnd, row = 0; var rowCache = this.$docRowCache; var i = this.$getRowCacheIndex(rowCache, docRow); var l = rowCache.length; if (l && i >= 0) { var row = rowCache[i]; var screenRow = this.$screenRowCache[i]; var doCache = docRow > rowCache[l - 1]; } else { var doCache = !l; } var foldLine = this.getNextFoldLine(row); var foldStart = foldLine ?foldLine.start.row :Infinity; while (row < docRow) { if (row >= foldStart) { rowEnd = foldLine.end.row + 1; if (rowEnd > docRow) break; foldLine = this.getNextFoldLine(rowEnd, foldLine); foldStart = foldLine ?foldLine.start.row :Infinity; } else { rowEnd = row + 1; } screenRow += this.getRowLength(row); row = rowEnd; if (doCache) { this.$docRowCache.push(row); this.$screenRowCache.push(screenRow); } } // Calculate the text line that is displayed in docRow on the screen. var textLine = ""; // Check if the final row we want to reach is inside of a fold. if (foldLine && row >= foldStart) { textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn); foldStartRow = foldLine.start.row; } else { textLine = this.getLine(docRow).substring(0, docColumn); foldStartRow = docRow; } var wrapIndent = 0; // Clamp textLine if in wrapMode. if (this.$useWrapMode) { var wrapRow = this.$wrapData[foldStartRow]; if (wrapRow) { var screenRowOffset = 0; while (textLine.length >= wrapRow[screenRowOffset]) { screenRow ++; screenRowOffset++; } textLine = textLine.substring( wrapRow[screenRowOffset - 1] || 0, textLine.length ); wrapIndent = screenRowOffset > 0 ? wrapRow.indent : 0; } } return { row: screenRow, column: wrapIndent + this.$getStringScreenWidth(textLine)[0] }; }; /** * For the given document row and column, returns the screen column. * @param {Number} row * @param {Number} docColumn * @returns {Number} * **/ this.documentToScreenColumn = function(row, docColumn) { return this.documentToScreenPosition(row, docColumn).column; }; /** * For the given document row and column, returns the screen row. * @param {Number} docRow * @param {Number} docColumn * **/ this.documentToScreenRow = function(docRow, docColumn) { return this.documentToScreenPosition(docRow, docColumn).row; }; /** * Returns the length of the screen. * @returns {Number} **/ this.getScreenLength = function() { var screenRows = 0; var fold = null; if (!this.$useWrapMode) { screenRows = this.getLength(); // Remove the folded lines again. var foldData = this.$foldData; for (var i = 0; i < foldData.length; i++) { fold = foldData[i]; screenRows -= fold.end.row - fold.start.row; } } else { var lastRow = this.$wrapData.length; var row = 0, i = 0; var fold = this.$foldData[i++]; var foldStart = fold ? fold.start.row :Infinity; while (row < lastRow) { var splits = this.$wrapData[row]; screenRows += splits ? splits.length + 1 : 1; row ++; if (row > foldStart) { row = fold.end.row+1; fold = this.$foldData[i++]; foldStart = fold ?fold.start.row :Infinity; } } } // todo if (this.lineWidgets) screenRows += this.$getWidgetScreenLength(); return screenRows; }; /** * @private * */ this.$setFontMetrics = function(fm) { if (!this.$enableVarChar) return; this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) { if (maxScreenColumn === 0) return [0, 0]; if (!maxScreenColumn) maxScreenColumn = Infinity; screenColumn = screenColumn || 0; var c, column; for (column = 0; column < str.length; column++) { c = str.charAt(column); // tab if (c === "\t") { screenColumn += this.getScreenTabSize(screenColumn); } else { screenColumn += fm.getCharacterWidth(c); } if (screenColumn > maxScreenColumn) { break; } } return [screenColumn, column]; }; }; this.destroy = function() { if (this.bgTokenizer) { this.bgTokenizer.setDocument(null); this.bgTokenizer = null; } this.$stopWorker(); }; this.isFullWidth = isFullWidth; // For every keystroke this gets called once per char in the whole doc!! // Wouldn't hurt to make it a bit faster for c >= 0x1100 function isFullWidth(c) { if (c < 0x1100) return false; return c >= 0x1100 && c <= 0x115F || c >= 0x11A3 && c <= 0x11A7 || c >= 0x11FA && c <= 0x11FF || c >= 0x2329 && c <= 0x232A || c >= 0x2E80 && c <= 0x2E99 || c >= 0x2E9B && c <= 0x2EF3 || c >= 0x2F00 && c <= 0x2FD5 || c >= 0x2FF0 && c <= 0x2FFB || c >= 0x3000 && c <= 0x303E || c >= 0x3041 && c <= 0x3096 || c >= 0x3099 && c <= 0x30FF || c >= 0x3105 && c <= 0x312D || c >= 0x3131 && c <= 0x318E || c >= 0x3190 && c <= 0x31BA || c >= 0x31C0 && c <= 0x31E3 || c >= 0x31F0 && c <= 0x321E || c >= 0x3220 && c <= 0x3247 || c >= 0x3250 && c <= 0x32FE || c >= 0x3300 && c <= 0x4DBF || c >= 0x4E00 && c <= 0xA48C || c >= 0xA490 && c <= 0xA4C6 || c >= 0xA960 && c <= 0xA97C || c >= 0xAC00 && c <= 0xD7A3 || c >= 0xD7B0 && c <= 0xD7C6 || c >= 0xD7CB && c <= 0xD7FB || c >= 0xF900 && c <= 0xFAFF || c >= 0xFE10 && c <= 0xFE19 || c >= 0xFE30 && c <= 0xFE52 || c >= 0xFE54 && c <= 0xFE66 || c >= 0xFE68 && c <= 0xFE6B || c >= 0xFF01 && c <= 0xFF60 || c >= 0xFFE0 && c <= 0xFFE6; } }).call(EditSession.prototype); require("./edit_session/folding").Folding.call(EditSession.prototype); require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype); config.defineOptions(EditSession.prototype, "session", { wrap: { set: function(value) { if (!value || value == "off") value = false; else if (value == "free") value = true; else if (value == "printMargin") value = -1; else if (typeof value == "string") value = parseInt(value, 10) || false; if (this.$wrap == value) return; this.$wrap = value; if (!value) { this.setUseWrapMode(false); } else { var col = typeof value == "number" ? value : null; this.setWrapLimitRange(col, col); this.setUseWrapMode(true); } }, get: function() { if (this.getUseWrapMode()) { if (this.$wrap == -1) return "printMargin"; if (!this.getWrapLimitRange().min) return "free"; return this.$wrap; } return "off"; }, handlesSet: true }, wrapMethod: { // code|text|auto set: function(val) { val = val == "auto" ? this.$mode.type != "text" : val != "text"; if (val != this.$wrapAsCode) { this.$wrapAsCode = val; if (this.$useWrapMode) { this.$modified = true; this.$resetRowCache(0); this.$updateWrapData(0, this.getLength() - 1); } } }, initialValue: "auto" }, indentedSoftWrap: { initialValue: true }, firstLineNumber: { set: function() {this._signal("changeBreakpoint");}, initialValue: 1 }, useWorker: { set: function(useWorker) { this.$useWorker = useWorker; this.$stopWorker(); if (useWorker) this.$startWorker(); }, initialValue: true }, useSoftTabs: {initialValue: true}, tabSize: { set: function(tabSize) { if (isNaN(tabSize) || this.$tabSize === tabSize) return; this.$modified = true; this.$rowLengthCache = []; this.$tabSize = tabSize; this._signal("changeTabSize"); }, initialValue: 4, handlesSet: true }, navigateWithinSoftTabs: {initialValue: false}, overwrite: { set: function(val) {this._signal("changeOverwrite");}, initialValue: false }, newLineMode: { set: function(val) {this.doc.setNewLineMode(val);}, get: function() {return this.doc.getNewLineMode();}, handlesSet: true }, mode: { set: function(val) { this.setMode(val); }, get: function() { return this.$modeId; } } }); exports.EditSession = EditSession; }); ================================================ FILE: lib/ace/edit_session_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("./test/mockdom"); } define(function(require, exports, module) { "use strict"; var lang = require("./lib/lang"); var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var UndoManager = require("./undomanager").UndoManager; var MockRenderer = require("./test/mockrenderer").MockRenderer; var Range = require("./range").Range; var assert = require("./test/assertions"); var JavaScriptMode = require("./mode/javascript").Mode; function createFoldTestSession() { var lines = [ "function foo(items) {", " for (var i=0; i>", [1, 2], 1); // Test wrapping for punctuation in EditSession.prototype.$wrapAsCode = false; computeAndAssert("ab cde, Juhu kinners", [3, 8, 13, 19], 6); // test indented wrapping EditSession.prototype.$indentedSoftWrap = true; computeAndAssert("foo bar foo bar foo bara foo", [12, 25]); computeAndAssert("fooooooooooooooooooooooooooo", [12, 24]); computeAndAssert("\t\tfoo bar fooooooooooobooooooo", [6, 10, 16, 22, 28]); computeAndAssert("\t\t\tfoo bar fooooooooooobooooooo", [3, 7, 11, 17, 23, 29]); computeAndAssert("\tfoo \t \t \t \t bar", [6, 12]); // 14 }, "test get longest line" : function() { var session = new EditSession(["12"]); session.setTabSize(4); assert.equal(session.getScreenWidth(), 2); session.doc.insertMergedLines({row: 0, column: Infinity}, ['', '']); session.doc.insertFullLines(1, ["123"]); assert.equal(session.getScreenWidth(), 3); session.doc.insertMergedLines({row: 0, column: Infinity}, ['', '']); session.doc.insertFullLines(1, ["\t\t"]); assert.equal(session.getScreenWidth(), 8); session.setTabSize(2); assert.equal(session.getScreenWidth(), 4); }, "test getDisplayString": function() { var session = new EditSession(["12"]); session.setTabSize(4); assert.equal(session.$getDisplayTokens("\t").length, 4); assert.equal(session.$getDisplayTokens("abc").length, 3); assert.equal(session.$getDisplayTokens("abc\t").length, 4); }, "test issue 83": function() { var session = new EditSession(""); var editor = new Editor(new MockRenderer(), session); var document = session.getDocument(); session.setUseWrapMode(true); document.insertFullLines(0, ["a", "b"]); document.insertFullLines(2, ["c", "d"]); document.removeFullLines(1, 2); }, "test wrapMode init has to create wrapData array": function() { var session = new EditSession("foo bar\nfoo bar"); var editor = new Editor(new MockRenderer(), session); var document = session.getDocument(); session.setUseWrapMode(true); session.setWrapLimitRange(3, 3); session.adjustWrapLimit(80); // Test if wrapData is there and was computed. assert.equal(session.$wrapData.length, 2); assert.equal(session.$wrapData[0].length, 1); assert.equal(session.$wrapData[1].length, 1); }, "test first line blank with wrap": function() { var session = new EditSession("\nfoo"); session.setUseWrapMode(true); assert.equal(session.doc.getValue(), ["", "foo"].join("\n")); }, "test first line blank with wrap 2" : function() { var session = new EditSession(""); session.setUseWrapMode(true); session.setValue("\nfoo"); assert.equal(session.doc.getValue(), ["", "foo"].join("\n")); }, "test fold getFoldDisplayLine": function() { var session = createFoldTestSession(); function assertDisplayLine(foldLine, str) { var line = session.getLine(foldLine.end.row); var displayLine = session.getFoldDisplayLine(foldLine, foldLine.end.row, line.length); assert.equal(displayLine, str); } assertDisplayLine(session.$foldData[0], "function foo(args...) {"); assertDisplayLine(session.$foldData[1], " for (vfoo...ert(items[bar...\"juhu\");"); }, "test foldLine idxToPosition": function() { var session = createFoldTestSession(); function assertIdx2Pos(foldLineIdx, idx, row, column) { var foldLine = session.$foldData[foldLineIdx]; assert.position(foldLine.idxToPosition(idx), row, column); } // "function foo(items) {", // " for (var i=0; iThe cursor in this paragraph text will be offset by 1 row.

    ", "

    Everything after this will be offset as well due to the folds in the row before too.

    " ].join("\n")); session.addFold('...', new Range(0, 8, 0, 42)); session.addFold('...', new Range(1, 8, 1, 42)); session.addFold('...', new Range(3, 7, 3, 51)); session.setOption("wrap", 40); session.remove(new Range(0,0, 2, 5)); // needed because adjustWrapLimit is called async from renderer session.adjustWrapLimit(80); assert.equal(session.$wrapData + "", [[], [], [40, 76]] + ""); }, "test add fold": function() { var session = createFoldTestSession(); var fold; function tryAddFold(placeholder, range, shouldFail) { var fail = false; try { fold = session.addFold(placeholder, range); } catch (e) { fail = true; } if (fail != shouldFail) { throw new Error("Expected to get an exception"); } } tryAddFold("foo", new Range(0, 13, 0, 17), false); tryAddFold("foo", new Range(0, 14, 0, 18), true); tryAddFold("foo", new Range(0, 13, 0, 18), false); assert.equal(session.$foldData[0].folds.length, 1); tryAddFold("f", new Range(0, 13, 0, 18), false); tryAddFold("foo", new Range(0, 18, 0, 21), false); assert.equal(session.$foldData[0].folds.length, 2); session.removeFold(fold); tryAddFold("foo", new Range(0, 18, 0, 22), false); tryAddFold("foo", new Range(0, 18, 0, 19), true); tryAddFold("foo", new Range(0, 22, 1, 10), false); }, "test add subfolds": function() { var session = createFoldTestSession(); var fold, oldFold; var foldData = session.$foldData; oldFold = foldData[0].folds[0]; fold = session.addFold("fold0", new Range(0, 10, 0, 21)); assert.equal(foldData[0].folds.length, 1); assert.equal(fold.subFolds.length, 1); assert.equal(fold.subFolds[0], oldFold); session.expandFold(fold); assert.equal(foldData[0].folds.length, 1); assert.equal(foldData[0].folds[0], oldFold); assert.equal(fold.subFolds.length, 0); fold = session.addFold("fold0", new Range(0, 13, 2, 10)); assert.equal(foldData.length, 1); assert.equal(fold.subFolds.length, 2); assert.equal(fold.subFolds[0], oldFold); session.expandFold(fold); assert.equal(foldData.length, 2); assert.equal(foldData[0].folds.length, 1); assert.equal(foldData[0].folds[0], oldFold); assert.equal(fold.subFolds.length, 0); session.unfold(null, true); fold = session.addFold("fold0", new Range(0, 0, 0, 21)); session.addFold("fold0", new Range(0, 1, 0, 5)); session.addFold("fold0", new Range(0, 6, 0, 8)); assert.equal(fold.subFolds.length, 2); }, "test row cache": function() { var session = createFoldTestSession(); session.screenToDocumentPosition(2,3); assertArray(session.$docRowCache, [1,3]); assertArray(session.$screenRowCache, [1,2]); session.screenToDocumentPosition(5,3); assertArray(session.$docRowCache, [1,3,4]); assertArray(session.$screenRowCache, [1,2,3]); session.screenToDocumentPosition(0,3); assertArray(session.$docRowCache, [1,3,4]); assertArray(session.$screenRowCache, [1,2,3]); var pos = session.screenToDocumentPosition(0,0); assert.equal(pos.row, 0); assertArray(session.$docRowCache, [1,3,4]); assertArray(session.$screenRowCache, [1,2,3]); session.screenToDocumentPosition(1,0); assertArray(session.$docRowCache, [1,3,4]); assertArray(session.$screenRowCache, [1,2,3]); session.$resetRowCache(); assertArray(session.$docRowCache, []); assertArray(session.$screenRowCache, []); session.screenToDocumentPosition(1,3); assertArray(session.$docRowCache, [1]); assertArray(session.$screenRowCache, [1]); session.screenToDocumentPosition(5,3); assertArray(session.$docRowCache, [1,3,4]); assertArray(session.$screenRowCache, [1,2,3]); session = new EditSession(new Array(30).join("\n")); session.documentToScreenPosition(2,0); session.documentToScreenPosition(2,0); assertArray(session.$docRowCache, [1,2]); assertArray(session.$screenRowCache, [1,2]); }, "test annotations": function() { var session = new EditSession([]), annotation = {row: 0, type: 'info', text: "This is a test."}; session.clearAnnotations(); assertArray(session.getAnnotations(), []); session.setAnnotations([annotation]); assertArray(session.getAnnotations(), [annotation]); }, "test: mode loading" : function(next) { if (!require.undef) { console.log("Skipping test: This test only runs in the browser"); next(); return; } var session = new EditSession([]); session.setMode("ace/mode/javascript"); assert.equal(session.$modeid, "ace/mode/javascript"); session.on("changeMode", function() { assert.equal(session.$modeid, "ace/mode/javascript"); }); session.setMode("ace/mode/sh", function(mode) { assert.ok(!mode); }); setTimeout(function() { session.setMode("ace/mode/javascript", function(mode) { session.setMode("ace/mode/javascript"); assert.equal(session.$modeid, "ace/mode/javascript"); next(); }); }, 0); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/editor.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; require("./lib/fixoldbrowsers"); var oop = require("./lib/oop"); var dom = require("./lib/dom"); var lang = require("./lib/lang"); var useragent = require("./lib/useragent"); var TextInput = require("./keyboard/textinput").TextInput; var MouseHandler = require("./mouse/mouse_handler").MouseHandler; var FoldHandler = require("./mouse/fold_handler").FoldHandler; var KeyBinding = require("./keyboard/keybinding").KeyBinding; var EditSession = require("./edit_session").EditSession; var Search = require("./search").Search; var Range = require("./range").Range; var EventEmitter = require("./lib/event_emitter").EventEmitter; var CommandManager = require("./commands/command_manager").CommandManager; var defaultCommands = require("./commands/default_commands").commands; var config = require("./config"); var TokenIterator = require("./token_iterator").TokenIterator; var clipboard = require("./clipboard"); /** * The main entry point into the Ace functionality. * * The `Editor` manages the [[EditSession]] (which manages [[Document]]s), as well as the [[VirtualRenderer]], which draws everything to the screen. * * Event sessions dealing with the mouse and keyboard are bubbled up from `Document` to the `Editor`, which decides what to do with them. * @class Editor **/ /** * Creates a new `Editor` object. * * @param {VirtualRenderer} renderer Associated `VirtualRenderer` that draws everything * @param {EditSession} session The `EditSession` to refer to * * * @constructor **/ var Editor = function(renderer, session) { var container = renderer.getContainerElement(); this.container = container; this.renderer = renderer; this.id = "editor" + (++Editor.$uid); this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands); if (typeof document == "object") { this.textInput = new TextInput(renderer.getTextAreaContainer(), this); this.renderer.textarea = this.textInput.getElement(); // TODO detect touch event support this.$mouseHandler = new MouseHandler(this); new FoldHandler(this); } this.keyBinding = new KeyBinding(this); this.$search = new Search().set({ wrap: true }); this.$historyTracker = this.$historyTracker.bind(this); this.commands.on("exec", this.$historyTracker); this.$initOperationListeners(); this._$emitInputEvent = lang.delayedCall(function() { this._signal("input", {}); if (this.session && this.session.bgTokenizer) this.session.bgTokenizer.scheduleStart(); }.bind(this)); this.on("change", function(_, _self) { _self._$emitInputEvent.schedule(31); }); this.setSession(session || new EditSession("")); config.resetOptions(this); config._signal("editor", this); }; Editor.$uid = 0; (function(){ oop.implement(this, EventEmitter); this.$initOperationListeners = function() { this.commands.on("exec", this.startOperation.bind(this), true); this.commands.on("afterExec", this.endOperation.bind(this), true); this.$opResetTimer = lang.delayedCall(this.endOperation.bind(this)); // todo: add before change events? this.on("change", function() { if (!this.curOp) { this.startOperation(); this.curOp.selectionBefore = this.$lastSel; } this.curOp.docChanged = true; }.bind(this), true); this.on("changeSelection", function() { if (!this.curOp) { this.startOperation(); this.curOp.selectionBefore = this.$lastSel; } this.curOp.selectionChanged = true; }.bind(this), true); }; this.curOp = null; this.prevOp = {}; this.startOperation = function(commadEvent) { if (this.curOp) { if (!commadEvent || this.curOp.command) return; this.prevOp = this.curOp; } if (!commadEvent) { this.previousCommand = null; commadEvent = {}; } this.$opResetTimer.schedule(); this.curOp = this.session.curOp = { command: commadEvent.command || {}, args: commadEvent.args, scrollTop: this.renderer.scrollTop }; this.curOp.selectionBefore = this.selection.toJSON(); }; this.endOperation = function(e) { if (this.curOp) { if (e && e.returnValue === false) return (this.curOp = null); this._signal("beforeEndOperation"); var command = this.curOp.command; var scrollIntoView = command && command.scrollIntoView; if (scrollIntoView) { switch (scrollIntoView) { case "center-animate": scrollIntoView = "animate"; /* fall through */ case "center": this.renderer.scrollCursorIntoView(null, 0.5); break; case "animate": case "cursor": this.renderer.scrollCursorIntoView(); break; case "selectionPart": var range = this.selection.getRange(); var config = this.renderer.layerConfig; if (range.start.row >= config.lastRow || range.end.row <= config.firstRow) { this.renderer.scrollSelectionIntoView(this.selection.anchor, this.selection.lead); } break; default: break; } if (scrollIntoView == "animate") this.renderer.animateScrolling(this.curOp.scrollTop); } var sel = this.selection.toJSON(); this.curOp.selectionAfter = sel; this.$lastSel = this.selection.toJSON(); // console.log(this.$lastSel+" endOP") this.session.getUndoManager().addSelection(sel); this.prevOp = this.curOp; this.curOp = null; } }; // TODO use property on commands instead of this this.$mergeableCommands = ["backspace", "del", "insertstring"]; this.$historyTracker = function(e) { if (!this.$mergeUndoDeltas) return; var prev = this.prevOp; var mergeableCommands = this.$mergeableCommands; // previous command was the same var shouldMerge = prev.command && (e.command.name == prev.command.name); if (e.command.name == "insertstring") { var text = e.args; if (this.mergeNextCommand === undefined) this.mergeNextCommand = true; shouldMerge = shouldMerge && this.mergeNextCommand // previous command allows to coalesce with && (!/\s/.test(text) || /\s/.test(prev.args)); // previous insertion was of same type this.mergeNextCommand = true; } else { shouldMerge = shouldMerge && mergeableCommands.indexOf(e.command.name) !== -1; // the command is mergeable } if ( this.$mergeUndoDeltas != "always" && Date.now() - this.sequenceStartTime > 2000 ) { shouldMerge = false; // the sequence is too long } if (shouldMerge) this.session.mergeUndoDeltas = true; else if (mergeableCommands.indexOf(e.command.name) !== -1) this.sequenceStartTime = Date.now(); }; /** * Sets a new key handler, such as "vim" or "windows". * @param {String} keyboardHandler The new key handler * **/ this.setKeyboardHandler = function(keyboardHandler, cb) { if (keyboardHandler && typeof keyboardHandler === "string") { this.$keybindingId = keyboardHandler; var _self = this; config.loadModule(["keybinding", keyboardHandler], function(module) { if (_self.$keybindingId == keyboardHandler) _self.keyBinding.setKeyboardHandler(module && module.handler); cb && cb(); }); } else { this.$keybindingId = null; this.keyBinding.setKeyboardHandler(keyboardHandler); cb && cb(); } }; /** * Returns the keyboard handler, such as "vim" or "windows". * * @returns {String} * **/ this.getKeyboardHandler = function() { return this.keyBinding.getKeyboardHandler(); }; /** * Emitted whenever the [[EditSession]] changes. * @event changeSession * @param {Object} e An object with two properties, `oldSession` and `session`, that represent the old and new [[EditSession]]s. * **/ /** * Sets a new editsession to use. This method also emits the `'changeSession'` event. * @param {EditSession} session The new session to use * **/ this.setSession = function(session) { if (this.session == session) return; // make sure operationEnd events are not emitted to wrong session if (this.curOp) this.endOperation(); this.curOp = {}; var oldSession = this.session; if (oldSession) { this.session.off("change", this.$onDocumentChange); this.session.off("changeMode", this.$onChangeMode); this.session.off("tokenizerUpdate", this.$onTokenizerUpdate); this.session.off("changeTabSize", this.$onChangeTabSize); this.session.off("changeWrapLimit", this.$onChangeWrapLimit); this.session.off("changeWrapMode", this.$onChangeWrapMode); this.session.off("changeFold", this.$onChangeFold); this.session.off("changeFrontMarker", this.$onChangeFrontMarker); this.session.off("changeBackMarker", this.$onChangeBackMarker); this.session.off("changeBreakpoint", this.$onChangeBreakpoint); this.session.off("changeAnnotation", this.$onChangeAnnotation); this.session.off("changeOverwrite", this.$onCursorChange); this.session.off("changeScrollTop", this.$onScrollTopChange); this.session.off("changeScrollLeft", this.$onScrollLeftChange); var selection = this.session.getSelection(); selection.off("changeCursor", this.$onCursorChange); selection.off("changeSelection", this.$onSelectionChange); } this.session = session; if (session) { this.$onDocumentChange = this.onDocumentChange.bind(this); session.on("change", this.$onDocumentChange); this.renderer.setSession(session); this.$onChangeMode = this.onChangeMode.bind(this); session.on("changeMode", this.$onChangeMode); this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this); session.on("tokenizerUpdate", this.$onTokenizerUpdate); this.$onChangeTabSize = this.renderer.onChangeTabSize.bind(this.renderer); session.on("changeTabSize", this.$onChangeTabSize); this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this); session.on("changeWrapLimit", this.$onChangeWrapLimit); this.$onChangeWrapMode = this.onChangeWrapMode.bind(this); session.on("changeWrapMode", this.$onChangeWrapMode); this.$onChangeFold = this.onChangeFold.bind(this); session.on("changeFold", this.$onChangeFold); this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this); this.session.on("changeFrontMarker", this.$onChangeFrontMarker); this.$onChangeBackMarker = this.onChangeBackMarker.bind(this); this.session.on("changeBackMarker", this.$onChangeBackMarker); this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this); this.session.on("changeBreakpoint", this.$onChangeBreakpoint); this.$onChangeAnnotation = this.onChangeAnnotation.bind(this); this.session.on("changeAnnotation", this.$onChangeAnnotation); this.$onCursorChange = this.onCursorChange.bind(this); this.session.on("changeOverwrite", this.$onCursorChange); this.$onScrollTopChange = this.onScrollTopChange.bind(this); this.session.on("changeScrollTop", this.$onScrollTopChange); this.$onScrollLeftChange = this.onScrollLeftChange.bind(this); this.session.on("changeScrollLeft", this.$onScrollLeftChange); this.selection = session.getSelection(); this.selection.on("changeCursor", this.$onCursorChange); this.$onSelectionChange = this.onSelectionChange.bind(this); this.selection.on("changeSelection", this.$onSelectionChange); this.onChangeMode(); this.onCursorChange(); this.onScrollTopChange(); this.onScrollLeftChange(); this.onSelectionChange(); this.onChangeFrontMarker(); this.onChangeBackMarker(); this.onChangeBreakpoint(); this.onChangeAnnotation(); this.session.getUseWrapMode() && this.renderer.adjustWrapLimit(); this.renderer.updateFull(); } else { this.selection = null; this.renderer.setSession(session); } this._signal("changeSession", { session: session, oldSession: oldSession }); this.curOp = null; oldSession && oldSession._signal("changeEditor", {oldEditor: this}); session && session._signal("changeEditor", {editor: this}); if (session && session.bgTokenizer) session.bgTokenizer.scheduleStart(); }; /** * Returns the current session being used. * @returns {EditSession} **/ this.getSession = function() { return this.session; }; /** * Sets the current document to `val`. * @param {String} val The new value to set for the document * @param {Number} cursorPos Where to set the new value. `undefined` or 0 is selectAll, -1 is at the document start, and 1 is at the end * * @returns {String} The current document value * @related Document.setValue **/ this.setValue = function(val, cursorPos) { this.session.doc.setValue(val); if (!cursorPos) this.selectAll(); else if (cursorPos == 1) this.navigateFileEnd(); else if (cursorPos == -1) this.navigateFileStart(); return val; }; /** * Returns the current session's content. * * @returns {String} * @related EditSession.getValue **/ this.getValue = function() { return this.session.getValue(); }; /** * * Returns the currently highlighted selection. * @returns {Selection} The selection object **/ this.getSelection = function() { return this.selection; }; /** * {:VirtualRenderer.onResize} * @param {Boolean} force If `true`, recomputes the size, even if the height and width haven't changed * * * @related VirtualRenderer.onResize **/ this.resize = function(force) { this.renderer.onResize(force); }; /** * {:VirtualRenderer.setTheme} * @param {String} theme The path to a theme * @param {Function} cb optional callback called when theme is loaded **/ this.setTheme = function(theme, cb) { this.renderer.setTheme(theme, cb); }; /** * {:VirtualRenderer.getTheme} * * @returns {String} The set theme * @related VirtualRenderer.getTheme **/ this.getTheme = function() { return this.renderer.getTheme(); }; /** * {:VirtualRenderer.setStyle} * @param {String} style A class name * * * @related VirtualRenderer.setStyle **/ this.setStyle = function(style) { this.renderer.setStyle(style); }; /** * {:VirtualRenderer.unsetStyle} * @related VirtualRenderer.unsetStyle **/ this.unsetStyle = function(style) { this.renderer.unsetStyle(style); }; /** * Gets the current font size of the editor text. */ this.getFontSize = function () { return this.getOption("fontSize") || dom.computedStyle(this.container, "fontSize"); }; /** * Set a new font size (in pixels) for the editor text. * @param {String} size A font size ( _e.g._ "12px") * * **/ this.setFontSize = function(size) { this.setOption("fontSize", size); }; this.$highlightBrackets = function() { if (this.session.$bracketHighlight) { this.session.removeMarker(this.session.$bracketHighlight); this.session.$bracketHighlight = null; } if (this.$highlightPending) { return; } // perform highlight async to not block the browser during navigation var self = this; this.$highlightPending = true; setTimeout(function() { self.$highlightPending = false; var session = self.session; if (!session || !session.bgTokenizer) return; var pos = session.findMatchingBracket(self.getCursorPosition()); if (pos) { var range = new Range(pos.row, pos.column, pos.row, pos.column + 1); } else if (session.$mode.getMatching) { var range = session.$mode.getMatching(self.session); } if (range) session.$bracketHighlight = session.addMarker(range, "ace_bracket", "text"); }, 50); }; // todo: move to mode.getMatching this.$highlightTags = function() { if (this.$highlightTagPending) return; // perform highlight async to not block the browser during navigation var self = this; this.$highlightTagPending = true; setTimeout(function() { self.$highlightTagPending = false; var session = self.session; if (!session || !session.bgTokenizer) return; var pos = self.getCursorPosition(); var iterator = new TokenIterator(self.session, pos.row, pos.column); var token = iterator.getCurrentToken(); if (!token || !/\b(?:tag-open|tag-name)/.test(token.type)) { session.removeMarker(session.$tagHighlight); session.$tagHighlight = null; return; } if (token.type.indexOf("tag-open") != -1) { token = iterator.stepForward(); if (!token) return; } var tag = token.value; var depth = 0; var prevToken = iterator.stepBackward(); if (prevToken.value == '<'){ //find closing tag do { prevToken = token; token = iterator.stepForward(); if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { if (prevToken.value === '<'){ depth++; } else if (prevToken.value === '= 0); } else { //find opening tag do { token = prevToken; prevToken = iterator.stepBackward(); if (token && token.value === tag && token.type.indexOf('tag-name') !== -1) { if (prevToken.value === '<') { depth++; } else if (prevToken.value === ' 1)) highlight = false; } if (session.$highlightLineMarker && !highlight) { session.removeMarker(session.$highlightLineMarker.id); session.$highlightLineMarker = null; } else if (!session.$highlightLineMarker && highlight) { var range = new Range(highlight.row, highlight.column, highlight.row, Infinity); range.id = session.addMarker(range, "ace_active-line", "screenLine"); session.$highlightLineMarker = range; } else if (highlight) { session.$highlightLineMarker.start.row = highlight.row; session.$highlightLineMarker.end.row = highlight.row; session.$highlightLineMarker.start.column = highlight.column; session._signal("changeBackMarker"); } }; this.onSelectionChange = function(e) { var session = this.session; if (session.$selectionMarker) { session.removeMarker(session.$selectionMarker); } session.$selectionMarker = null; if (!this.selection.isEmpty()) { var range = this.selection.getRange(); var style = this.getSelectionStyle(); session.$selectionMarker = session.addMarker(range, "ace_selection", style); } else { this.$updateHighlightActiveLine(); } var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp(); this.session.highlight(re); this._signal("changeSelection"); }; this.$getSelectionHighLightRegexp = function() { var session = this.session; var selection = this.getSelectionRange(); if (selection.isEmpty() || selection.isMultiLine()) return; var startColumn = selection.start.column; var endColumn = selection.end.column; var line = session.getLine(selection.start.row); var needle = line.substring(startColumn, endColumn); if (!/[\w\d]/.test(needle)) return; var re = this.$search.$assembleRegExp({ wholeWord: true, caseSensitive: true, needle: needle }); var wordWithBoundary = line.substring(startColumn - 1, endColumn + 1); if (!re.test(wordWithBoundary)) return; return re; }; this.onChangeFrontMarker = function() { this.renderer.updateFrontMarkers(); }; this.onChangeBackMarker = function() { this.renderer.updateBackMarkers(); }; this.onChangeBreakpoint = function() { this.renderer.updateBreakpoints(); }; this.onChangeAnnotation = function() { this.renderer.setAnnotations(this.session.getAnnotations()); }; this.onChangeMode = function(e) { this.renderer.updateText(); this._emit("changeMode", e); }; this.onChangeWrapLimit = function() { this.renderer.updateFull(); }; this.onChangeWrapMode = function() { this.renderer.onResize(true); }; this.onChangeFold = function() { // Update the active line marker as due to folding changes the current // line range on the screen might have changed. this.$updateHighlightActiveLine(); // TODO: This might be too much updating. Okay for now. this.renderer.updateFull(); }; /** * Returns the string of text currently highlighted. * @returns {String} **/ this.getSelectedText = function() { return this.session.getTextRange(this.getSelectionRange()); }; /** * Emitted when text is copied. * @event copy * @param {String} text The copied text * **/ /** * Returns the string of text currently highlighted. * @returns {String} **/ this.getCopyText = function() { var text = this.getSelectedText(); var nl = this.session.doc.getNewLineCharacter(); var copyLine= false; if (!text && this.$copyWithEmptySelection) { copyLine = true; var ranges = this.selection.getAllRanges(); for (var i = 0; i < ranges.length; i++) { var range = ranges[i]; if (i && ranges[i - 1].start.row == range.start.row) continue; text += this.session.getLine(range.start.row) + nl; } } var e = {text: text}; this._signal("copy", e); clipboard.lineMode = copyLine ? e.text : ""; return e.text; }; /** * Called whenever a text "copy" happens. **/ this.onCopy = function() { this.commands.exec("copy", this); }; /** * Called whenever a text "cut" happens. **/ this.onCut = function() { this.commands.exec("cut", this); }; /** * Emitted when text is pasted. * @event paste * @param {Object} an object which contains one property, `text`, that represents the text to be pasted. Editing this property will alter the text that is pasted. * * **/ /** * Called whenever a text "paste" happens. * @param {String} text The pasted text * * **/ this.onPaste = function(text, event) { var e = {text: text, event: event}; this.commands.exec("paste", this, e); }; this.$handlePaste = function(e) { if (typeof e == "string") e = {text: e}; this._signal("paste", e); var text = e.text; var lineMode = text == clipboard.lineMode; var session = this.session; if (!this.inMultiSelectMode || this.inVirtualSelectionMode) { if (lineMode) session.insert({ row: this.selection.lead.row, column: 0 }, text); else this.insert(text); } else if (lineMode) { this.selection.rangeList.ranges.forEach(function(range) { session.insert({ row: range.start.row, column: 0 }, text); }); } else { var lines = text.split(/\r\n|\r|\n/); var ranges = this.selection.rangeList.ranges; if (lines.length > ranges.length || lines.length < 2 || !lines[1]) return this.commands.exec("insertstring", this, text); for (var i = ranges.length; i--;) { var range = ranges[i]; if (!range.isEmpty()) session.remove(range); session.insert(range.start, lines[i]); } } }; this.execCommand = function(command, args) { return this.commands.exec(command, this, args); }; /** * Inserts `text` into wherever the cursor is pointing. * @param {String} text The new text to add * **/ this.insert = function(text, pasted) { var session = this.session; var mode = session.getMode(); var cursor = this.getCursorPosition(); if (this.getBehavioursEnabled() && !pasted) { // Get a transform if the current mode wants one. var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text); if (transform) { if (text !== transform.text) { // keep automatic insertion in a separate delta, unless it is in multiselect mode if (!this.inVirtualSelectionMode) { this.session.mergeUndoDeltas = false; this.mergeNextCommand = false; } } text = transform.text; } } if (text == "\t") text = this.session.getTabString(); // remove selected text if (!this.selection.isEmpty()) { var range = this.getSelectionRange(); cursor = this.session.remove(range); this.clearSelection(); } else if (this.session.getOverwrite() && text.indexOf("\n") == -1) { var range = new Range.fromPoints(cursor, cursor); range.end.column += text.length; this.session.remove(range); } if (text == "\n" || text == "\r\n") { var line = session.getLine(cursor.row); if (cursor.column > line.search(/\S|$/)) { var d = line.substr(cursor.column).search(/\S|$/); session.doc.removeInLine(cursor.row, cursor.column, cursor.column + d); } } this.clearSelection(); var start = cursor.column; var lineState = session.getState(cursor.row); var line = session.getLine(cursor.row); var shouldOutdent = mode.checkOutdent(lineState, line, text); var end = session.insert(cursor, text); if (transform && transform.selection) { if (transform.selection.length == 2) { // Transform relative to the current column this.selection.setSelectionRange( new Range(cursor.row, start + transform.selection[0], cursor.row, start + transform.selection[1])); } else { // Transform relative to the current row. this.selection.setSelectionRange( new Range(cursor.row + transform.selection[0], transform.selection[1], cursor.row + transform.selection[2], transform.selection[3])); } } if (session.getDocument().isNewLine(text)) { var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString()); session.insert({row: cursor.row+1, column: 0}, lineIndent); } if (shouldOutdent) mode.autoOutdent(lineState, session, cursor.row); }; this.onTextInput = function(text) { this.keyBinding.onTextInput(text); }; this.onCommandKey = function(e, hashId, keyCode) { this.keyBinding.onCommandKey(e, hashId, keyCode); }; /** * Pass in `true` to enable overwrites in your session, or `false` to disable. If overwrites is enabled, any text you enter will type over any text after it. If the value of `overwrite` changes, this function also emits the `changeOverwrite` event. * @param {Boolean} overwrite Defines whether or not to set overwrites * * * @related EditSession.setOverwrite **/ this.setOverwrite = function(overwrite) { this.session.setOverwrite(overwrite); }; /** * Returns `true` if overwrites are enabled; `false` otherwise. * @returns {Boolean} * @related EditSession.getOverwrite **/ this.getOverwrite = function() { return this.session.getOverwrite(); }; /** * Sets the value of overwrite to the opposite of whatever it currently is. * @related EditSession.toggleOverwrite **/ this.toggleOverwrite = function() { this.session.toggleOverwrite(); }; /** * Sets how fast the mouse scrolling should do. * @param {Number} speed A value indicating the new speed (in milliseconds) **/ this.setScrollSpeed = function(speed) { this.setOption("scrollSpeed", speed); }; /** * Returns the value indicating how fast the mouse scroll speed is (in milliseconds). * @returns {Number} **/ this.getScrollSpeed = function() { return this.getOption("scrollSpeed"); }; /** * Sets the delay (in milliseconds) of the mouse drag. * @param {Number} dragDelay A value indicating the new delay **/ this.setDragDelay = function(dragDelay) { this.setOption("dragDelay", dragDelay); }; /** * Returns the current mouse drag delay. * @returns {Number} **/ this.getDragDelay = function() { return this.getOption("dragDelay"); }; /** * Emitted when the selection style changes, via [[Editor.setSelectionStyle]]. * @event changeSelectionStyle * @param {Object} data Contains one property, `data`, which indicates the new selection style **/ /** * Draw selection markers spanning whole line, or only over selected text. Default value is "line" * @param {String} style The new selection style "line"|"text" * **/ this.setSelectionStyle = function(val) { this.setOption("selectionStyle", val); }; /** * Returns the current selection style. * @returns {String} **/ this.getSelectionStyle = function() { return this.getOption("selectionStyle"); }; /** * Determines whether or not the current line should be highlighted. * @param {Boolean} shouldHighlight Set to `true` to highlight the current line **/ this.setHighlightActiveLine = function(shouldHighlight) { this.setOption("highlightActiveLine", shouldHighlight); }; /** * Returns `true` if current lines are always highlighted. * @return {Boolean} **/ this.getHighlightActiveLine = function() { return this.getOption("highlightActiveLine"); }; this.setHighlightGutterLine = function(shouldHighlight) { this.setOption("highlightGutterLine", shouldHighlight); }; this.getHighlightGutterLine = function() { return this.getOption("highlightGutterLine"); }; /** * Determines if the currently selected word should be highlighted. * @param {Boolean} shouldHighlight Set to `true` to highlight the currently selected word * **/ this.setHighlightSelectedWord = function(shouldHighlight) { this.setOption("highlightSelectedWord", shouldHighlight); }; /** * Returns `true` if currently highlighted words are to be highlighted. * @returns {Boolean} **/ this.getHighlightSelectedWord = function() { return this.$highlightSelectedWord; }; this.setAnimatedScroll = function(shouldAnimate){ this.renderer.setAnimatedScroll(shouldAnimate); }; this.getAnimatedScroll = function(){ return this.renderer.getAnimatedScroll(); }; /** * If `showInvisibles` is set to `true`, invisible characters—like spaces or new lines—are show in the editor. * @param {Boolean} showInvisibles Specifies whether or not to show invisible characters * **/ this.setShowInvisibles = function(showInvisibles) { this.renderer.setShowInvisibles(showInvisibles); }; /** * Returns `true` if invisible characters are being shown. * @returns {Boolean} **/ this.getShowInvisibles = function() { return this.renderer.getShowInvisibles(); }; this.setDisplayIndentGuides = function(display) { this.renderer.setDisplayIndentGuides(display); }; this.getDisplayIndentGuides = function() { return this.renderer.getDisplayIndentGuides(); }; /** * If `showPrintMargin` is set to `true`, the print margin is shown in the editor. * @param {Boolean} showPrintMargin Specifies whether or not to show the print margin * **/ this.setShowPrintMargin = function(showPrintMargin) { this.renderer.setShowPrintMargin(showPrintMargin); }; /** * Returns `true` if the print margin is being shown. * @returns {Boolean} **/ this.getShowPrintMargin = function() { return this.renderer.getShowPrintMargin(); }; /** * Sets the column defining where the print margin should be. * @param {Number} showPrintMargin Specifies the new print margin * **/ this.setPrintMarginColumn = function(showPrintMargin) { this.renderer.setPrintMarginColumn(showPrintMargin); }; /** * Returns the column number of where the print margin is. * @returns {Number} **/ this.getPrintMarginColumn = function() { return this.renderer.getPrintMarginColumn(); }; /** * If `readOnly` is true, then the editor is set to read-only mode, and none of the content can change. * @param {Boolean} readOnly Specifies whether the editor can be modified or not * **/ this.setReadOnly = function(readOnly) { this.setOption("readOnly", readOnly); }; /** * Returns `true` if the editor is set to read-only mode. * @returns {Boolean} **/ this.getReadOnly = function() { return this.getOption("readOnly"); }; /** * Specifies whether to use behaviors or not. ["Behaviors" in this case is the auto-pairing of special characters, like quotation marks, parenthesis, or brackets.]{: #BehaviorsDef} * @param {Boolean} enabled Enables or disables behaviors * **/ this.setBehavioursEnabled = function (enabled) { this.setOption("behavioursEnabled", enabled); }; /** * Returns `true` if the behaviors are currently enabled. {:BehaviorsDef} * * @returns {Boolean} **/ this.getBehavioursEnabled = function () { return this.getOption("behavioursEnabled"); }; /** * Specifies whether to use wrapping behaviors or not, i.e. automatically wrapping the selection with characters such as brackets * when such a character is typed in. * @param {Boolean} enabled Enables or disables wrapping behaviors * **/ this.setWrapBehavioursEnabled = function (enabled) { this.setOption("wrapBehavioursEnabled", enabled); }; /** * Returns `true` if the wrapping behaviors are currently enabled. **/ this.getWrapBehavioursEnabled = function () { return this.getOption("wrapBehavioursEnabled"); }; /** * Indicates whether the fold widgets should be shown or not. * @param {Boolean} show Specifies whether the fold widgets are shown **/ this.setShowFoldWidgets = function(show) { this.setOption("showFoldWidgets", show); }; /** * Returns `true` if the fold widgets are shown. * @return {Boolean} **/ this.getShowFoldWidgets = function() { return this.getOption("showFoldWidgets"); }; this.setFadeFoldWidgets = function(fade) { this.setOption("fadeFoldWidgets", fade); }; this.getFadeFoldWidgets = function() { return this.getOption("fadeFoldWidgets"); }; /** * Removes the current selection or one character. * @param {String} dir The direction of the deletion to occur, either "left" or "right" * **/ this.remove = function(dir) { if (this.selection.isEmpty()){ if (dir == "left") this.selection.selectLeft(); else this.selection.selectRight(); } var range = this.getSelectionRange(); if (this.getBehavioursEnabled()) { var session = this.session; var state = session.getState(range.start.row); var new_range = session.getMode().transformAction(state, 'deletion', this, session, range); if (range.end.column === 0) { var text = session.getTextRange(range); if (text[text.length - 1] == "\n") { var line = session.getLine(range.end.row); if (/^\s+$/.test(line)) { range.end.column = line.length; } } } if (new_range) range = new_range; } this.session.remove(range); this.clearSelection(); }; /** * Removes the word directly to the right of the current selection. **/ this.removeWordRight = function() { if (this.selection.isEmpty()) this.selection.selectWordRight(); this.session.remove(this.getSelectionRange()); this.clearSelection(); }; /** * Removes the word directly to the left of the current selection. **/ this.removeWordLeft = function() { if (this.selection.isEmpty()) this.selection.selectWordLeft(); this.session.remove(this.getSelectionRange()); this.clearSelection(); }; /** * Removes all the words to the left of the current selection, until the start of the line. **/ this.removeToLineStart = function() { if (this.selection.isEmpty()) this.selection.selectLineStart(); this.session.remove(this.getSelectionRange()); this.clearSelection(); }; /** * Removes all the words to the right of the current selection, until the end of the line. **/ this.removeToLineEnd = function() { if (this.selection.isEmpty()) this.selection.selectLineEnd(); var range = this.getSelectionRange(); if (range.start.column == range.end.column && range.start.row == range.end.row) { range.end.column = 0; range.end.row++; } this.session.remove(range); this.clearSelection(); }; /** * Splits the line at the current selection (by inserting an `'\n'`). **/ this.splitLine = function() { if (!this.selection.isEmpty()) { this.session.remove(this.getSelectionRange()); this.clearSelection(); } var cursor = this.getCursorPosition(); this.insert("\n"); this.moveCursorToPosition(cursor); }; /** * Transposes current line. **/ this.transposeLetters = function() { if (!this.selection.isEmpty()) { return; } var cursor = this.getCursorPosition(); var column = cursor.column; if (column === 0) return; var line = this.session.getLine(cursor.row); var swap, range; if (column < line.length) { swap = line.charAt(column) + line.charAt(column-1); range = new Range(cursor.row, column-1, cursor.row, column+1); } else { swap = line.charAt(column-1) + line.charAt(column-2); range = new Range(cursor.row, column-2, cursor.row, column); } this.session.replace(range, swap); this.session.selection.moveToPosition(range.end); }; /** * Converts the current selection entirely into lowercase. **/ this.toLowerCase = function() { var originalRange = this.getSelectionRange(); if (this.selection.isEmpty()) { this.selection.selectWord(); } var range = this.getSelectionRange(); var text = this.session.getTextRange(range); this.session.replace(range, text.toLowerCase()); this.selection.setSelectionRange(originalRange); }; /** * Converts the current selection entirely into uppercase. **/ this.toUpperCase = function() { var originalRange = this.getSelectionRange(); if (this.selection.isEmpty()) { this.selection.selectWord(); } var range = this.getSelectionRange(); var text = this.session.getTextRange(range); this.session.replace(range, text.toUpperCase()); this.selection.setSelectionRange(originalRange); }; /** * Inserts an indentation into the current cursor position or indents the selected lines. * * @related EditSession.indentRows **/ this.indent = function() { var session = this.session; var range = this.getSelectionRange(); if (range.start.row < range.end.row) { var rows = this.$getSelectedRows(); session.indentRows(rows.first, rows.last, "\t"); return; } else if (range.start.column < range.end.column) { var text = session.getTextRange(range); if (!/^\s+$/.test(text)) { var rows = this.$getSelectedRows(); session.indentRows(rows.first, rows.last, "\t"); return; } } var line = session.getLine(range.start.row); var position = range.start; var size = session.getTabSize(); var column = session.documentToScreenColumn(position.row, position.column); if (this.session.getUseSoftTabs()) { var count = (size - column % size); var indentString = lang.stringRepeat(" ", count); } else { var count = column % size; while (line[range.start.column - 1] == " " && count) { range.start.column--; count--; } this.selection.setSelectionRange(range); indentString = "\t"; } return this.insert(indentString); }; /** * Indents the current line. * @related EditSession.indentRows **/ this.blockIndent = function() { var rows = this.$getSelectedRows(); this.session.indentRows(rows.first, rows.last, "\t"); }; /** * Outdents the current line. * @related EditSession.outdentRows **/ this.blockOutdent = function() { var selection = this.session.getSelection(); this.session.outdentRows(selection.getRange()); }; // TODO: move out of core when we have good mechanism for managing extensions this.sortLines = function() { var rows = this.$getSelectedRows(); var session = this.session; var lines = []; for (var i = rows.first; i <= rows.last; i++) lines.push(session.getLine(i)); lines.sort(function(a, b) { if (a.toLowerCase() < b.toLowerCase()) return -1; if (a.toLowerCase() > b.toLowerCase()) return 1; return 0; }); var deleteRange = new Range(0, 0, 0, 0); for (var i = rows.first; i <= rows.last; i++) { var line = session.getLine(i); deleteRange.start.row = i; deleteRange.end.row = i; deleteRange.end.column = line.length; session.replace(deleteRange, lines[i-rows.first]); } }; /** * Given the currently selected range, this function either comments all the lines, or uncomments all of them. **/ this.toggleCommentLines = function() { var state = this.session.getState(this.getCursorPosition().row); var rows = this.$getSelectedRows(); this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last); }; this.toggleBlockComment = function() { var cursor = this.getCursorPosition(); var state = this.session.getState(cursor.row); var range = this.getSelectionRange(); this.session.getMode().toggleBlockComment(state, this.session, range, cursor); }; /** * Works like [[EditSession.getTokenAt]], except it returns a number. * @returns {Number} **/ this.getNumberAt = function(row, column) { var _numberRx = /[\-]?[0-9]+(?:\.[0-9]+)?/g; _numberRx.lastIndex = 0; var s = this.session.getLine(row); while (_numberRx.lastIndex < column) { var m = _numberRx.exec(s); if(m.index <= column && m.index+m[0].length >= column){ var number = { value: m[0], start: m.index, end: m.index+m[0].length }; return number; } } return null; }; /** * If the character before the cursor is a number, this functions changes its value by `amount`. * @param {Number} amount The value to change the numeral by (can be negative to decrease value) * **/ this.modifyNumber = function(amount) { var row = this.selection.getCursor().row; var column = this.selection.getCursor().column; // get the char before the cursor var charRange = new Range(row, column-1, row, column); var c = this.session.getTextRange(charRange); // if the char is a digit if (!isNaN(parseFloat(c)) && isFinite(c)) { // get the whole number the digit is part of var nr = this.getNumberAt(row, column); // if number found if (nr) { var fp = nr.value.indexOf(".") >= 0 ? nr.start + nr.value.indexOf(".") + 1 : nr.end; var decimals = nr.start + nr.value.length - fp; var t = parseFloat(nr.value); t *= Math.pow(10, decimals); if(fp !== nr.end && column < fp){ amount *= Math.pow(10, nr.end - column - 1); } else { amount *= Math.pow(10, nr.end - column); } t += amount; t /= Math.pow(10, decimals); var nnr = t.toFixed(decimals); //update number var replaceRange = new Range(row, nr.start, row, nr.end); this.session.replace(replaceRange, nnr); //reposition the cursor this.moveCursorTo(row, Math.max(nr.start +1, column + nnr.length - nr.value.length)); } } }; /** * Removes all the lines in the current selection * @related EditSession.remove **/ this.removeLines = function() { var rows = this.$getSelectedRows(); this.session.removeFullLines(rows.first, rows.last); this.clearSelection(); }; this.duplicateSelection = function() { var sel = this.selection; var doc = this.session; var range = sel.getRange(); var reverse = sel.isBackwards(); if (range.isEmpty()) { var row = range.start.row; doc.duplicateLines(row, row); } else { var point = reverse ? range.start : range.end; var endPoint = doc.insert(point, doc.getTextRange(range), false); range.start = point; range.end = endPoint; sel.setSelectionRange(range, reverse); } }; /** * Shifts all the selected lines down one row. * * @returns {Number} On success, it returns -1. * @related EditSession.moveLinesUp **/ this.moveLinesDown = function() { this.$moveLines(1, false); }; /** * Shifts all the selected lines up one row. * @returns {Number} On success, it returns -1. * @related EditSession.moveLinesDown **/ this.moveLinesUp = function() { this.$moveLines(-1, false); }; /** * Moves a range of text from the given range to the given position. `toPosition` is an object that looks like this: * ```json * { row: newRowLocation, column: newColumnLocation } * ``` * @param {Range} fromRange The range of text you want moved within the document * @param {Object} toPosition The location (row and column) where you want to move the text to * * @returns {Range} The new range where the text was moved to. * @related EditSession.moveText **/ this.moveText = function(range, toPosition, copy) { return this.session.moveText(range, toPosition, copy); }; /** * Copies all the selected lines up one row. * @returns {Number} On success, returns 0. * **/ this.copyLinesUp = function() { this.$moveLines(-1, true); }; /** * Copies all the selected lines down one row. * @returns {Number} On success, returns the number of new rows added; in other words, `lastRow - firstRow + 1`. * @related EditSession.duplicateLines * **/ this.copyLinesDown = function() { this.$moveLines(1, true); }; /** * for internal use * @ignore * **/ this.$moveLines = function(dir, copy) { var rows, moved; var selection = this.selection; if (!selection.inMultiSelectMode || this.inVirtualSelectionMode) { var range = selection.toOrientedRange(); rows = this.$getSelectedRows(range); moved = this.session.$moveLines(rows.first, rows.last, copy ? 0 : dir); if (copy && dir == -1) moved = 0; range.moveBy(moved, 0); selection.fromOrientedRange(range); } else { var ranges = selection.rangeList.ranges; selection.rangeList.detach(this.session); this.inVirtualSelectionMode = true; var diff = 0; var totalDiff = 0; var l = ranges.length; for (var i = 0; i < l; i++) { var rangeIndex = i; ranges[i].moveBy(diff, 0); rows = this.$getSelectedRows(ranges[i]); var first = rows.first; var last = rows.last; while (++i < l) { if (totalDiff) ranges[i].moveBy(totalDiff, 0); var subRows = this.$getSelectedRows(ranges[i]); if (copy && subRows.first != last) break; else if (!copy && subRows.first > last + 1) break; last = subRows.last; } i--; diff = this.session.$moveLines(first, last, copy ? 0 : dir); if (copy && dir == -1) rangeIndex = i + 1; while (rangeIndex <= i) { ranges[rangeIndex].moveBy(diff, 0); rangeIndex++; } if (!copy) diff = 0; totalDiff += diff; } selection.fromOrientedRange(selection.ranges[0]); selection.rangeList.attach(this.session); this.inVirtualSelectionMode = false; } }; /** * Returns an object indicating the currently selected rows. The object looks like this: * * ```json * { first: range.start.row, last: range.end.row } * ``` * * @returns {Object} **/ this.$getSelectedRows = function(range) { range = (range || this.getSelectionRange()).collapseRows(); return { first: this.session.getRowFoldStart(range.start.row), last: this.session.getRowFoldEnd(range.end.row) }; }; this.onCompositionStart = function(text) { this.renderer.showComposition(this.getCursorPosition()); }; this.onCompositionUpdate = function(text) { this.renderer.setCompositionText(text); }; this.onCompositionEnd = function() { this.renderer.hideComposition(); }; /** * {:VirtualRenderer.getFirstVisibleRow} * * @returns {Number} * @related VirtualRenderer.getFirstVisibleRow **/ this.getFirstVisibleRow = function() { return this.renderer.getFirstVisibleRow(); }; /** * {:VirtualRenderer.getLastVisibleRow} * * @returns {Number} * @related VirtualRenderer.getLastVisibleRow **/ this.getLastVisibleRow = function() { return this.renderer.getLastVisibleRow(); }; /** * Indicates if the row is currently visible on the screen. * @param {Number} row The row to check * * @returns {Boolean} **/ this.isRowVisible = function(row) { return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow()); }; /** * Indicates if the entire row is currently visible on the screen. * @param {Number} row The row to check * * * @returns {Boolean} **/ this.isRowFullyVisible = function(row) { return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow()); }; /** * Returns the number of currently visible rows. * @returns {Number} **/ this.$getVisibleRowCount = function() { return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1; }; this.$moveByPage = function(dir, select) { var renderer = this.renderer; var config = this.renderer.layerConfig; var rows = dir * Math.floor(config.height / config.lineHeight); if (select === true) { this.selection.$moveSelection(function(){ this.moveCursorBy(rows, 0); }); } else if (select === false) { this.selection.moveCursorBy(rows, 0); this.selection.clearSelection(); } var scrollTop = renderer.scrollTop; renderer.scrollBy(0, rows * config.lineHeight); if (select != null) renderer.scrollCursorIntoView(null, 0.5); renderer.animateScrolling(scrollTop); }; /** * Selects the text from the current position of the document until where a "page down" finishes. **/ this.selectPageDown = function() { this.$moveByPage(1, true); }; /** * Selects the text from the current position of the document until where a "page up" finishes. **/ this.selectPageUp = function() { this.$moveByPage(-1, true); }; /** * Shifts the document to wherever "page down" is, as well as moving the cursor position. **/ this.gotoPageDown = function() { this.$moveByPage(1, false); }; /** * Shifts the document to wherever "page up" is, as well as moving the cursor position. **/ this.gotoPageUp = function() { this.$moveByPage(-1, false); }; /** * Scrolls the document to wherever "page down" is, without changing the cursor position. **/ this.scrollPageDown = function() { this.$moveByPage(1); }; /** * Scrolls the document to wherever "page up" is, without changing the cursor position. **/ this.scrollPageUp = function() { this.$moveByPage(-1); }; /** * Moves the editor to the specified row. * @related VirtualRenderer.scrollToRow **/ this.scrollToRow = function(row) { this.renderer.scrollToRow(row); }; /** * Scrolls to a line. If `center` is `true`, it puts the line in middle of screen (or attempts to). * @param {Number} line The line to scroll to * @param {Boolean} center If `true` * @param {Boolean} animate If `true` animates scrolling * @param {Function} callback Function to be called when the animation has finished * * * @related VirtualRenderer.scrollToLine **/ this.scrollToLine = function(line, center, animate, callback) { this.renderer.scrollToLine(line, center, animate, callback); }; /** * Attempts to center the current selection on the screen. **/ this.centerSelection = function() { var range = this.getSelectionRange(); var pos = { row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2), column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2) }; this.renderer.alignCursor(pos, 0.5); }; /** * Gets the current position of the cursor. * @returns {Object} An object that looks something like this: * * ```json * { row: currRow, column: currCol } * ``` * * @related Selection.getCursor **/ this.getCursorPosition = function() { return this.selection.getCursor(); }; /** * Returns the screen position of the cursor. * @returns {Number} * @related EditSession.documentToScreenPosition **/ this.getCursorPositionScreen = function() { return this.session.documentToScreenPosition(this.getCursorPosition()); }; /** * {:Selection.getRange} * @returns {Range} * @related Selection.getRange **/ this.getSelectionRange = function() { return this.selection.getRange(); }; /** * Selects all the text in editor. * @related Selection.selectAll **/ this.selectAll = function() { this.selection.selectAll(); }; /** * {:Selection.clearSelection} * @related Selection.clearSelection **/ this.clearSelection = function() { this.selection.clearSelection(); }; /** * Moves the cursor to the specified row and column. Note that this does not de-select the current selection. * @param {Number} row The new row number * @param {Number} column The new column number * * * @related Selection.moveCursorTo **/ this.moveCursorTo = function(row, column) { this.selection.moveCursorTo(row, column); }; /** * Moves the cursor to the position indicated by `pos.row` and `pos.column`. * @param {Object} pos An object with two properties, row and column * * * @related Selection.moveCursorToPosition **/ this.moveCursorToPosition = function(pos) { this.selection.moveCursorToPosition(pos); }; /** * Moves the cursor's row and column to the next matching bracket or HTML tag. * **/ this.jumpToMatching = function(select, expand) { var cursor = this.getCursorPosition(); var iterator = new TokenIterator(this.session, cursor.row, cursor.column); var prevToken = iterator.getCurrentToken(); var token = prevToken || iterator.stepForward(); if (!token) return; //get next closing tag or bracket var matchType; var found = false; var depth = {}; var i = cursor.column - token.start; var bracketType; var brackets = { ")": "(", "(": "(", "]": "[", "[": "[", "{": "{", "}": "{" }; do { if (token.value.match(/[{}()\[\]]/g)) { for (; i < token.value.length && !found; i++) { if (!brackets[token.value[i]]) { continue; } bracketType = brackets[token.value[i]] + '.' + token.type.replace("rparen", "lparen"); if (isNaN(depth[bracketType])) { depth[bracketType] = 0; } switch (token.value[i]) { case '(': case '[': case '{': depth[bracketType]++; break; case ')': case ']': case '}': depth[bracketType]--; if (depth[bracketType] === -1) { matchType = 'bracket'; found = true; } break; } } } else if (token.type.indexOf('tag-name') !== -1) { if (isNaN(depth[token.value])) { depth[token.value] = 0; } if (prevToken.value === '<') { depth[token.value]++; } else if (prevToken.value === '= 0; --i) { if(this.$tryReplace(ranges[i], replacement)) { replaced++; } } this.selection.setSelectionRange(selection); return replaced; }; this.$tryReplace = function(range, replacement) { var input = this.session.getTextRange(range); replacement = this.$search.replace(input, replacement); if (replacement !== null) { range.end = this.session.replace(range, replacement); return range; } else { return null; } }; /** * {:Search.getOptions} For more information on `options`, see [[Search `Search`]]. * @related Search.getOptions * @returns {Object} **/ this.getLastSearchOptions = function() { return this.$search.getOptions(); }; /** * Attempts to find `needle` within the document. For more information on `options`, see [[Search `Search`]]. * @param {String} needle The text to search for (optional) * @param {Object} options An object defining various search properties * @param {Boolean} animate If `true` animate scrolling * * * @related Search.find **/ this.find = function(needle, options, animate) { if (!options) options = {}; if (typeof needle == "string" || needle instanceof RegExp) options.needle = needle; else if (typeof needle == "object") oop.mixin(options, needle); var range = this.selection.getRange(); if (options.needle == null) { needle = this.session.getTextRange(range) || this.$search.$options.needle; if (!needle) { range = this.session.getWordRange(range.start.row, range.start.column); needle = this.session.getTextRange(range); } this.$search.set({needle: needle}); } this.$search.set(options); if (!options.start) this.$search.set({start: range}); var newRange = this.$search.find(this.session); if (options.preventScroll) return newRange; if (newRange) { this.revealRange(newRange, animate); return newRange; } // clear selection if nothing is found if (options.backwards) range.start = range.end; else range.end = range.start; this.selection.setRange(range); }; /** * Performs another search for `needle` in the document. For more information on `options`, see [[Search `Search`]]. * @param {Object} options search options * @param {Boolean} animate If `true` animate scrolling * * * @related Editor.find **/ this.findNext = function(options, animate) { this.find({skipCurrent: true, backwards: false}, options, animate); }; /** * Performs a search for `needle` backwards. For more information on `options`, see [[Search `Search`]]. * @param {Object} options search options * @param {Boolean} animate If `true` animate scrolling * * * @related Editor.find **/ this.findPrevious = function(options, animate) { this.find(options, {skipCurrent: true, backwards: true}, animate); }; this.revealRange = function(range, animate) { this.session.unfold(range); this.selection.setSelectionRange(range); var scrollTop = this.renderer.scrollTop; this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5); if (animate !== false) this.renderer.animateScrolling(scrollTop); }; /** * {:UndoManager.undo} * @related UndoManager.undo **/ this.undo = function() { this.session.getUndoManager().undo(this.session); this.renderer.scrollCursorIntoView(null, 0.5); }; /** * {:UndoManager.redo} * @related UndoManager.redo **/ this.redo = function() { this.session.getUndoManager().redo(this.session); this.renderer.scrollCursorIntoView(null, 0.5); }; /** * * Cleans up the entire editor. **/ this.destroy = function() { this.renderer.destroy(); this._signal("destroy", this); if (this.session) { this.session.destroy(); } }; /** * Enables automatic scrolling of the cursor into view when editor itself is inside scrollable element * @param {Boolean} enable default true **/ this.setAutoScrollEditorIntoView = function(enable) { if (!enable) return; var rect; var self = this; var shouldScroll = false; if (!this.$scrollAnchor) this.$scrollAnchor = document.createElement("div"); var scrollAnchor = this.$scrollAnchor; scrollAnchor.style.cssText = "position:absolute"; this.container.insertBefore(scrollAnchor, this.container.firstChild); var onChangeSelection = this.on("changeSelection", function() { shouldScroll = true; }); // needed to not trigger sync reflow var onBeforeRender = this.renderer.on("beforeRender", function() { if (shouldScroll) rect = self.renderer.container.getBoundingClientRect(); }); var onAfterRender = this.renderer.on("afterRender", function() { if (shouldScroll && rect && (self.isFocused() || self.searchBox && self.searchBox.isFocused()) ) { var renderer = self.renderer; var pos = renderer.$cursorLayer.$pixelPos; var config = renderer.layerConfig; var top = pos.top - config.offset; if (pos.top >= 0 && top + rect.top < 0) { shouldScroll = true; } else if (pos.top < config.height && pos.top + rect.top + config.lineHeight > window.innerHeight) { shouldScroll = false; } else { shouldScroll = null; } if (shouldScroll != null) { scrollAnchor.style.top = top + "px"; scrollAnchor.style.left = pos.left + "px"; scrollAnchor.style.height = config.lineHeight + "px"; scrollAnchor.scrollIntoView(shouldScroll); } shouldScroll = rect = null; } }); this.setAutoScrollEditorIntoView = function(enable) { if (enable) return; delete this.setAutoScrollEditorIntoView; this.off("changeSelection", onChangeSelection); this.renderer.off("afterRender", onAfterRender); this.renderer.off("beforeRender", onBeforeRender); }; }; this.$resetCursorStyle = function() { var style = this.$cursorStyle || "ace"; var cursorLayer = this.renderer.$cursorLayer; if (!cursorLayer) return; cursorLayer.setSmoothBlinking(/smooth/.test(style)); cursorLayer.isBlinking = !this.$readOnly && style != "wide"; dom.setCssClass(cursorLayer.element, "ace_slim-cursors", /slim/.test(style)); }; }).call(Editor.prototype); config.defineOptions(Editor.prototype, "editor", { selectionStyle: { set: function(style) { this.onSelectionChange(); this._signal("changeSelectionStyle", {data: style}); }, initialValue: "line" }, highlightActiveLine: { set: function() {this.$updateHighlightActiveLine();}, initialValue: true }, highlightSelectedWord: { set: function(shouldHighlight) {this.$onSelectionChange();}, initialValue: true }, readOnly: { set: function(readOnly) { // disabled to not break vim mode! // this.textInput.setReadOnly(readOnly); this.$resetCursorStyle(); }, initialValue: false }, copyWithEmptySelection: { set: function(value) { this.textInput.setCopyWithEmptySelection(value); }, initialValue: false }, cursorStyle: { set: function(val) { this.$resetCursorStyle(); }, values: ["ace", "slim", "smooth", "wide"], initialValue: "ace" }, mergeUndoDeltas: { values: [false, true, "always"], initialValue: true }, behavioursEnabled: {initialValue: true}, wrapBehavioursEnabled: {initialValue: true}, autoScrollEditorIntoView: { set: function(val) {this.setAutoScrollEditorIntoView(val);} }, keyboardHandler: { set: function(val) { this.setKeyboardHandler(val); }, get: function() { return this.keybindingId; }, handlesSet: true }, hScrollBarAlwaysVisible: "renderer", vScrollBarAlwaysVisible: "renderer", highlightGutterLine: "renderer", animatedScroll: "renderer", showInvisibles: "renderer", showPrintMargin: "renderer", printMarginColumn: "renderer", printMargin: "renderer", fadeFoldWidgets: "renderer", showFoldWidgets: "renderer", showLineNumbers: "renderer", showGutter: "renderer", displayIndentGuides: "renderer", fontSize: "renderer", fontFamily: "renderer", maxLines: "renderer", minLines: "renderer", scrollPastEnd: "renderer", fixedWidthGutter: "renderer", theme: "renderer", scrollSpeed: "$mouseHandler", dragDelay: "$mouseHandler", dragEnabled: "$mouseHandler", focusTimout: "$mouseHandler", tooltipFollowsMouse: "$mouseHandler", firstLineNumber: "session", overwrite: "session", newLineMode: "session", useWorker: "session", useSoftTabs: "session", tabSize: "session", wrap: "session", indentedSoftWrap: "session", foldStyle: "session", mode: "session" }); exports.Editor = Editor; }); ================================================ FILE: lib/ace/editor_change_document_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("./test/mockdom"); } define(function(require, exports, module) { "use strict"; var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var Text = require("./mode/text").Mode; var JavaScriptMode = require("./mode/javascript").Mode; var CssMode = require("./mode/css").Mode; var HtmlMode = require("./mode/html").Mode; var MockRenderer = require("./test/mockrenderer").MockRenderer; var assert = require("./test/assertions"); module.exports = { setUp : function(next) { this.session1 = new EditSession(["abc", "def"]); this.session2 = new EditSession(["ghi", "jkl"]); this.editor = new Editor(new MockRenderer()); next(); }, "test: change document" : function() { this.editor.setSession(this.session1); assert.equal(this.editor.getSession(), this.session1); this.editor.setSession(this.session2); assert.equal(this.editor.getSession(), this.session2); }, "test: only changes to the new document should have effect" : function() { var called = false; this.editor.onDocumentChange = function() { called = true; }; this.editor.setSession(this.session1); this.editor.setSession(this.session2); this.session1.duplicateLines(0, 0); assert.notOk(called); this.session2.duplicateLines(0, 0); assert.ok(called); }, "test: should use cursor of new document" : function() { this.session1.getSelection().moveCursorTo(0, 1); this.session2.getSelection().moveCursorTo(1, 0); this.editor.setSession(this.session1); assert.position(this.editor.getCursorPosition(), 0, 1); this.editor.setSession(this.session2); assert.position(this.editor.getCursorPosition(), 1, 0); }, "test: only changing the cursor of the new doc should not have an effect" : function() { this.editor.onCursorChange = function() { called = true; }; this.editor.setSession(this.session1); this.editor.setSession(this.session2); assert.position(this.editor.getCursorPosition(), 0, 0); var called = false; this.session1.getSelection().moveCursorTo(0, 1); assert.position(this.editor.getCursorPosition(), 0, 0); assert.notOk(called); this.session2.getSelection().moveCursorTo(1, 1); assert.position(this.editor.getCursorPosition(), 1, 1); assert.ok(called); }, "test: should use selection of new document" : function() { this.session1.getSelection().selectTo(0, 1); this.session2.getSelection().selectTo(1, 0); this.editor.setSession(this.session1); assert.position(this.editor.getSelection().getSelectionLead(), 0, 1); this.editor.setSession(this.session2); assert.position(this.editor.getSelection().getSelectionLead(), 1, 0); }, "test: only changing the selection of the new doc should not have an effect" : function() { this.editor.onSelectionChange = function() { called = true; }; this.editor.setSession(this.session1); this.editor.setSession(this.session2); assert.position(this.editor.getSelection().getSelectionLead(), 0, 0); var called = false; this.session1.getSelection().selectTo(0, 1); assert.position(this.editor.getSelection().getSelectionLead(), 0, 0); assert.notOk(called); this.session2.getSelection().selectTo(1, 1); assert.position(this.editor.getSelection().getSelectionLead(), 1, 1); assert.ok(called); }, "test: should use mode of new document" : function() { this.editor.onChangeMode = function() { called = true; }; this.editor.setSession(this.session1); this.editor.setSession(this.session2); var called = false; this.session1.setMode(new Text()); assert.notOk(called); this.session2.setMode(new JavaScriptMode()); assert.ok(called); }, "test: should use stop worker of old document" : function(next) { var self = this; // 1. Open an editor and set the session to CssMode self.editor.setSession(self.session1); self.session1.setMode(new CssMode()); // 2. Add a line or two of valid CSS. self.session1.setValue("DIV { color: red; }"); // 3. Clear the session value. self.session1.setValue(""); // 4. Set the session to HtmlMode self.session1.setMode(new HtmlMode()); // 5. Try to type valid HTML self.session1.insert({row: 0, column: 0}, ""); setTimeout(function() { assert.equal(Object.keys(self.session1.getAnnotations()).length, 0); next(); }, 600); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/editor_highlight_selected_word_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("./test/mockdom"); } define(function(require, exports, module) { "use strict"; var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var MockRenderer = require("./test/mockrenderer").MockRenderer; var assert = require("./test/assertions"); var lipsum = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. " + "Mauris at arcu mi, eu lobortis mauris. Quisque ut libero eget " + "diam congue vehicula. Quisque ut odio ut mi aliquam tincidunt. " + "Duis lacinia aliquam lorem eget eleifend. Morbi eget felis mi. " + "Duis quam ligula, consequat vitae convallis volutpat, blandit " + "nec neque. Nulla facilisi. Etiam suscipit lorem ac justo " + "sollicitudin tristique. Phasellus ut posuere nunc. Aliquam " + "scelerisque mollis felis non gravida. Vestibulum lacus sem, " + "posuere non bibendum id, luctus non dolor. Aenean id metus " + "lorem, vel dapibus est. Donec gravida feugiat augue nec " + "accumsan.Lorem ipsum dolor sit amet, consectetur adipiscing " + "elit. Nulla vulputate, velit vitae tincidunt congue, nunc " + "augue accumsan velit, eu consequat turpis lectus ac orci. " + "Pellentesque ornare dolor feugiat dui auctor eu varius nulla " + "fermentum. Sed aliquam odio at velit lacinia vel fermentum " + "felis sodales. In dignissim magna eget nunc lobortis non " + "fringilla nibh ullamcorper. Donec facilisis malesuada elit " + "at egestas. Etiam bibendum, diam vitae tempor aliquet, dui " + "libero vehicula odio, eget bibendum mauris velit eu lorem.\n" + "consectetur"; function callHighlighterUpdate(session, firstRow, lastRow) { var rangeCount = 0; var mockMarkerLayer = { drawSingleLineMarker: function() {rangeCount++;} }; session.$searchHighlight.update([], mockMarkerLayer, session, { firstRow: firstRow, lastRow: lastRow }); return rangeCount; } module.exports = { setUp: function(next) { this.session = new EditSession(lipsum); this.editor = new Editor(new MockRenderer(), this.session); this.selection = this.session.getSelection(); this.search = this.editor.$search; next(); }, "test: highlight selected words by default": function() { assert.equal(this.editor.getHighlightSelectedWord(), true); }, "test: highlight a word": function() { this.editor.moveCursorTo(0, 9); this.selection.selectWord(); var highlighter = this.editor.session.$searchHighlight; assert.ok(highlighter != null); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "ipsum"); assert.equal(highlighter.cache.length, 0); assert.equal(callHighlighterUpdate(this.session, 0, 0), 2); }, "test: highlight a word and clear highlight": function() { this.editor.moveCursorTo(0, 8); this.selection.selectWord(); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "ipsum"); assert.equal(callHighlighterUpdate(this.session, 0, 0), 2); this.session.highlight(""); assert.equal(this.session.$searchHighlight.cache.length, 0); assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); }, "test: highlight another word": function() { this.selection.moveCursorTo(0, 14); this.selection.selectWord(); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "dolor"); assert.equal(callHighlighterUpdate(this.session, 0, 0), 4); }, "test: no selection, no highlight": function() { this.selection.clearSelection(); assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); }, "test: select a word, no highlight": function() { this.selection.moveCursorTo(0, 14); this.selection.selectWord(); this.editor.setHighlightSelectedWord(false); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "dolor"); assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); }, "test: select a word with no matches": function() { this.editor.setHighlightSelectedWord(true); var currentOptions = this.search.getOptions(); var newOptions = { wrap: true, wholeWord: true, caseSensitive: true, needle: "Mauris" }; this.search.set(newOptions); var match = this.search.find(this.session); assert.notEqual(match, null, "found a match for 'Mauris'"); this.search.set(currentOptions); this.selection.setSelectionRange(match); assert.equal(this.session.getTextRange(match), "Mauris"); assert.equal(callHighlighterUpdate(this.session, 0, 0), 1); }, "test: partial word selection 1": function() { this.selection.moveCursorTo(0, 14); this.selection.selectWord(); this.selection.selectLeft(); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "dolo"); assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); }, "test: partial word selection 2": function() { this.selection.moveCursorTo(0, 13); this.selection.selectWord(); this.selection.selectRight(); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "dolor "); assert.equal(callHighlighterUpdate(this.session, 0, 0), 3); }, "test: partial word selection 3": function() { this.selection.moveCursorTo(0, 14); this.selection.selectWord(); this.selection.selectLeft(); this.selection.shiftSelection(1); var range = this.selection.getRange(); assert.equal(this.session.getTextRange(range), "olor"); assert.equal(callHighlighterUpdate(this.session, 0, 0), 0); }, "test: select last word": function() { this.selection.moveCursorTo(0, 1); var currentOptions = this.search.getOptions(); var newOptions = { wrap: true, wholeWord: true, caseSensitive: true, backwards: true, needle: "consectetur" }; this.search.set(newOptions); var match = this.search.find(this.session); assert.notEqual(match, null, "found a match for 'consectetur'"); assert.position(match.start, 1, 0); this.search.set(currentOptions); this.selection.setSelectionRange(match); assert.equal(this.session.getTextRange(match), "consectetur"); assert.equal(callHighlighterUpdate(this.session, 0, 1), 3); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/editor_navigation_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("./test/mockdom"); } define(function(require, exports, module) { "use strict"; var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var MockRenderer = require("./test/mockrenderer").MockRenderer; var assert = require("./test/assertions"); module.exports = { createEditSession : function(rows, cols) { var line = new Array(cols + 1).join("a"); var text = new Array(rows).join(line + "\n") + line; return new EditSession(text); }, "test: navigate to end of file should scroll the last line into view" : function() { var doc = this.createEditSession(200, 10); var editor = new Editor(new MockRenderer(), doc); editor.execCommand("gotoend"); var cursor = editor.getCursorPosition(); assert.ok(editor.getFirstVisibleRow() <= cursor.row); assert.ok(editor.getLastVisibleRow() >= cursor.row); }, "test: navigate to start of file should scroll the first row into view" : function() { var doc = this.createEditSession(200, 10); var editor = new Editor(new MockRenderer(), doc); editor.moveCursorTo(editor.getLastVisibleRow() + 20); editor.execCommand("gotostart"); assert.equal(editor.getFirstVisibleRow(), 0); }, "test: goto hidden line should scroll the line into the middle of the viewport" : function() { var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5)); editor.navigateTo(0, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(101); assert.position(editor.getCursorPosition(), 100, 0); assert.equal(editor.getFirstVisibleRow(), 89); editor.navigateTo(100, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(11); assert.position(editor.getCursorPosition(), 10, 0); assert.equal(editor.getFirstVisibleRow(), 0); editor.navigateTo(100, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(6); assert.position(editor.getCursorPosition(), 5, 0); assert.equal(0, editor.getFirstVisibleRow(), 0); editor.navigateTo(100, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(1); assert.position(editor.getCursorPosition(), 0, 0); assert.equal(editor.getFirstVisibleRow(), 0); editor.navigateTo(0, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(191); assert.position(editor.getCursorPosition(), 190, 0); assert.equal(editor.getFirstVisibleRow(), 179); editor.navigateTo(0, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(196); assert.position(editor.getCursorPosition(), 195, 0); assert.equal(editor.getFirstVisibleRow(), 180); }, "test: goto visible line should only move the cursor and not scroll": function() { var editor = new Editor(new MockRenderer(), this.createEditSession(200, 5)); editor.navigateTo(0, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(12); assert.position(editor.getCursorPosition(), 11, 0); assert.equal(editor.getFirstVisibleRow(), 0); editor.navigateTo(30, 0); editor.renderer.scrollCursorIntoView(); editor.gotoLine(33); assert.position(editor.getCursorPosition(), 32, 0); assert.equal(editor.getFirstVisibleRow(), 30); }, "test: navigate from the end of a long line down to a short line and back should maintain the curser column": function() { var editor = new Editor(new MockRenderer(), new EditSession(["123456", "1"])); editor.navigateTo(0, 6); assert.position(editor.getCursorPosition(), 0, 6); editor.navigateDown(); assert.position(editor.getCursorPosition(), 1, 1); editor.navigateUp(); assert.position(editor.getCursorPosition(), 0, 6); }, "test: reset desired column on navigate left or right": function() { var editor = new Editor(new MockRenderer(), new EditSession(["123456", "12"])); editor.navigateTo(0, 6); assert.position(editor.getCursorPosition(), 0, 6); editor.navigateDown(); assert.position(editor.getCursorPosition(), 1, 2); editor.navigateLeft(); assert.position(editor.getCursorPosition(), 1, 1); editor.navigateUp(); assert.position(editor.getCursorPosition(), 0, 1); }, "test: navigate within soft tabs based on setting": function() { var editor = new Editor(new MockRenderer(), new EditSession([" "])); editor.getSession().setUseSoftTabs(true); editor.getSession().setTabSize(4); editor.navigateTo(0, 0); editor.navigateRight(); assert.position(editor.getCursorPosition(), 0, 4); editor.navigateLeft(); assert.position(editor.getCursorPosition(), 0, 0); editor.getSession().setNavigateWithinSoftTabs(true); editor.navigateRight(); assert.position(editor.getCursorPosition(), 0, 1); editor.navigateTo(0, 4); editor.navigateLeft(); assert.position(editor.getCursorPosition(), 0, 3); }, "test: typing text should update the desired column": function() { var editor = new Editor(new MockRenderer(), new EditSession(["1234", "1234567890"])); editor.navigateTo(0, 3); editor.insert("juhu"); editor.navigateDown(); assert.position(editor.getCursorPosition(), 1, 7); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/editor_text_edit_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("./test/mockdom"); } define(function(require, exports, module) { "use strict"; var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var JavaScriptMode = require("./mode/javascript").Mode; var UndoManager = require("./undomanager").UndoManager; var MockRenderer = require("./test/mockrenderer").MockRenderer; var assert = require("./test/assertions"); var whitespace = require("./ext/whitespace"); module.exports = { "test: delete line from the middle" : function() { var session = new EditSession(["a", "b", "c", "d"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.removeLines(); assert.equal(session.toString(), "a\nc\nd"); assert.position(editor.getCursorPosition(), 1, 0); editor.removeLines(); assert.equal(session.toString(), "a\nd"); assert.position(editor.getCursorPosition(), 1, 0); editor.removeLines(); assert.equal(session.toString(), "a"); assert.position(editor.getCursorPosition(), 0, 1); editor.removeLines(); assert.equal(session.toString(), ""); assert.position(editor.getCursorPosition(), 0, 0); }, "test: delete multiple selected lines" : function() { var session = new EditSession(["a", "b", "c", "d"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.getSelection().selectDown(); editor.removeLines(); assert.equal(session.toString(), "a\nd"); assert.position(editor.getCursorPosition(), 1, 0); }, "test: delete first line" : function() { var session = new EditSession(["a", "b", "c"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.removeLines(); assert.equal(session.toString(), "b\nc"); assert.position(editor.getCursorPosition(), 0, 0); }, "test: delete last should also delete the new line of the previous line" : function() { var session = new EditSession(["a", "b", "c", ""].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(3, 0); editor.removeLines(); assert.equal(session.toString(), "a\nb\nc"); assert.position(editor.getCursorPosition(), 2, 1); editor.removeLines(); assert.equal(session.toString(), "a\nb"); assert.position(editor.getCursorPosition(), 1, 1); }, "test: indent block" : function() { var session = new EditSession(["a12345", "b12345", "c12345"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 3); editor.getSelection().selectDown(); editor.indent(); assert.equal(["a12345", " b12345", " c12345"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 2, 7); var range = editor.getSelectionRange(); assert.position(range.start, 1, 7); assert.position(range.end, 2, 7); session.setValue(" x"); session.setOption("useSoftTabs", false); editor.selection.moveTo(0, 3); editor.indent(); assert.equal("\tx", session.toString()); }, "test: indent selected lines" : function() { var session = new EditSession(["a12345", "b12345", "c12345"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.getSelection().selectDown(); editor.indent(); assert.equal(["a12345", " b12345", "c12345"].join("\n"), session.toString()); }, "test: no auto indent if cursor is before the {" : function() { var session = new EditSession("{", new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(0, 0); editor.onTextInput("\n"); assert.equal(["", "{"].join("\n"), session.toString()); }, "test: outdent block" : function() { var session = new EditSession([" a12345", " b12345", " c12345"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(0, 5); editor.getSelection().selectDown(); editor.getSelection().selectDown(); editor.blockOutdent(); assert.equal(session.toString(), [" a12345", "b12345", " c12345"].join("\n")); assert.position(editor.getCursorPosition(), 2, 1); var range = editor.getSelectionRange(); assert.position(range.start, 0, 1); assert.position(range.end, 2, 1); editor.blockOutdent(); assert.equal(session.toString(), ["a12345", "b12345", "c12345"].join("\n")); var range = editor.getSelectionRange(); assert.position(range.start, 0, 0); assert.position(range.end, 2, 0); }, "test: outent without a selection should update cursor" : function() { var session = new EditSession(" 12"); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(0, 3); editor.blockOutdent(" "); assert.equal(session.toString(), " 12"); assert.position(editor.getCursorPosition(), 0, 0); }, "test: comment lines should perserve selection" : function() { var session = new EditSession([" abc", "cde"].join("\n"), new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); whitespace.detectIndentation(session); editor.moveCursorTo(0, 2); editor.getSelection().selectDown(); editor.toggleCommentLines(); assert.equal(["// abc", "// cde"].join("\n"), session.toString()); var selection = editor.getSelectionRange(); assert.position(selection.start, 0, 5); assert.position(selection.end, 1, 5); }, "test: uncomment lines should perserve selection" : function() { var session = new EditSession(["// abc", "//cde"].join("\n"), new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); session.setTabSize(2); editor.moveCursorTo(0, 1); editor.getSelection().selectDown(); editor.getSelection().selectRight(); editor.getSelection().selectRight(); editor.toggleCommentLines(); assert.equal([" abc", "cde"].join("\n"), session.toString()); assert.range(editor.getSelectionRange(), 0, 0, 1, 1); }, "test: toggle comment lines twice should return the original text" : function() { var session = new EditSession([" abc", "cde", "fg"], new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(0, 0); editor.getSelection().selectDown(); editor.getSelection().selectDown(); editor.toggleCommentLines(); editor.toggleCommentLines(); assert.equal([" abc", "cde", "fg"].join("\n"), session.toString()); }, "test: comment lines - if the selection end is at the line start it should stay there": function() { //select down var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(0, 0); editor.getSelection().selectDown(); editor.toggleCommentLines(); assert.range(editor.getSelectionRange(), 0, 3, 1, 0); // select up var session = new EditSession(["abc", "cde"].join("\n"), new JavaScriptMode()); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.getSelection().selectUp(); editor.toggleCommentLines(); assert.range(editor.getSelectionRange(), 0, 3, 1, 0); }, "test: move lines down should keep selection on moved lines" : function() { var session = new EditSession(["11", "22", "33", "44"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(0, 1); editor.getSelection().selectDown(); editor.moveLinesDown(); assert.equal(["33", "11", "22", "44"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 2, 1); assert.position(editor.getSelection().getSelectionAnchor(), 1, 1); assert.position(editor.getSelection().getSelectionLead(), 2, 1); editor.moveLinesDown(); assert.equal(["33", "44", "11", "22"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 3, 1); assert.position(editor.getSelection().getSelectionAnchor(), 2, 1); assert.position(editor.getSelection().getSelectionLead(), 3, 1); // moving again should have no effect editor.moveLinesDown(); assert.equal(["33", "44", "11", "22"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 3, 1); assert.position(editor.getSelection().getSelectionAnchor(), 2, 1); assert.position(editor.getSelection().getSelectionLead(), 3, 1); }, "test: move lines up should keep selection on moved lines" : function() { var session = new EditSession(["11", "22", "33", "44"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(2, 1); editor.getSelection().selectDown(); editor.moveLinesUp(); assert.equal(session.toString(), ["11", "33", "44", "22"].join("\n")); assert.position(editor.getCursorPosition(), 2, 1); assert.position(editor.getSelection().getSelectionAnchor(), 1, 1); assert.position(editor.getSelection().getSelectionLead(), 2, 1); editor.moveLinesUp(); assert.equal(session.toString(), ["33", "44", "11", "22"].join("\n")); assert.position(editor.getCursorPosition(), 1, 1); assert.position(editor.getSelection().getSelectionAnchor(), 0, 1); assert.position(editor.getSelection().getSelectionLead(), 1, 1); }, "test: move line without active selection should not move cursor relative to the moved line" : function() { var session = new EditSession(["11", "22", "33", "44"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.clearSelection(); editor.moveLinesDown(); assert.equal(["11", "33", "22", "44"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 2, 1); editor.clearSelection(); editor.moveLinesUp(); assert.equal(["11", "22", "33", "44"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 1, 1); }, "test: copy lines down should keep selection" : function() { var session = new EditSession(["11", "22", "33", "44"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.getSelection().selectDown(); editor.copyLinesDown(); assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 4, 1); assert.position(editor.getSelection().getSelectionAnchor(), 3, 1); assert.position(editor.getSelection().getSelectionLead(), 4, 1); }, "test: copy lines up should keep selection" : function() { var session = new EditSession(["11", "22", "33", "44"].join("\n")); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.getSelection().selectDown(); editor.copyLinesUp(); assert.equal(["11", "22", "33", "22", "33", "44"].join("\n"), session.toString()); assert.position(editor.getCursorPosition(), 2, 1); assert.position(editor.getSelection().getSelectionAnchor(), 1, 1); assert.position(editor.getSelection().getSelectionLead(), 2, 1); }, "test: input a tab with soft tab should convert it to spaces" : function() { var session = new EditSession(""); var editor = new Editor(new MockRenderer(), session); session.setTabSize(2); session.setUseSoftTabs(true); editor.onTextInput("\t"); assert.equal(session.toString(), " "); session.setTabSize(5); editor.onTextInput("\t"); assert.equal(session.toString(), " "); }, "test: input tab without soft tabs should keep the tab character" : function() { var session = new EditSession(""); var editor = new Editor(new MockRenderer(), session); session.setUseSoftTabs(false); editor.onTextInput("\t"); assert.equal(session.toString(), "\t"); }, "test: undo/redo for delete line" : function() { var session = new EditSession(["111", "222", "333"]); var undoManager = new UndoManager(); session.setUndoManager(undoManager); var initialText = session.toString(); var editor = new Editor(new MockRenderer(), session); editor.removeLines(); var step1 = session.toString(); assert.equal(step1, "222\n333"); session.$syncInformUndoManager(); editor.removeLines(); var step2 = session.toString(); assert.equal(step2, "333"); session.$syncInformUndoManager(); editor.removeLines(); var step3 = session.toString(); assert.equal(step3, ""); session.$syncInformUndoManager(); undoManager.undo(); session.$syncInformUndoManager(); assert.equal(session.toString(), step2); undoManager.undo(); session.$syncInformUndoManager(); assert.equal(session.toString(), step1); undoManager.undo(); session.$syncInformUndoManager(); assert.equal(session.toString(), initialText); undoManager.undo(); session.$syncInformUndoManager(); assert.equal(session.toString(), initialText); }, "test: remove left should remove character left of the cursor" : function() { var session = new EditSession(["123", "456"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.remove("left"); assert.equal(session.toString(), "123\n56"); }, "test: remove left should remove line break if cursor is at line start" : function() { var session = new EditSession(["123", "456"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.remove("left"); assert.equal(session.toString(), "123456"); }, "test: remove left should remove tabsize spaces if cursor is on a tab stop and preceeded by spaces" : function() { var session = new EditSession(["123", " 456"]); session.setUseSoftTabs(true); session.setTabSize(4); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 8); editor.remove("left"); assert.equal(session.toString(), "123\n 456"); }, "test: transpose at line start should be a noop": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.transposeLetters(); assert.equal(session.getValue(), ["123", "4567", "89"].join("\n")); }, "test: transpose in line should swap the charaters before and after the cursor": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 2); editor.transposeLetters(); assert.equal(session.getValue(), ["123", "4657", "89"].join("\n")); }, "test: transpose at line end should swap the last two characters": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 4); editor.transposeLetters(); assert.equal(session.getValue(), ["123", "4576", "89"].join("\n")); }, "test: transpose with non empty selection should be a noop": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 1); editor.getSelection().selectRight(); editor.transposeLetters(); assert.equal(session.getValue(), ["123", "4567", "89"].join("\n")); }, "test: transpose should move the cursor behind the last swapped character": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 2); editor.transposeLetters(); assert.position(editor.getCursorPosition(), 1, 3); }, "test: remove to line end": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 2); editor.removeToLineEnd(); assert.equal(session.getValue(), ["123", "45", "89"].join("\n")); }, "test: remove to line end at line end should remove the new line": function() { var session = new EditSession(["123", "4567", "89"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 4); editor.removeToLineEnd(); assert.position(editor.getCursorPosition(), 1, 4); assert.equal(session.getValue(), ["123", "456789"].join("\n")); }, "test: transform selection to uppercase": function() { var session = new EditSession(["ajax", "dot", "org"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.getSelection().selectLineEnd(); editor.toUpperCase(); assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n")); }, "test: transform word to uppercase": function() { var session = new EditSession(["ajax", "dot", "org"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.toUpperCase(); assert.equal(session.getValue(), ["ajax", "DOT", "org"].join("\n")); assert.position(editor.getCursorPosition(), 1, 0); }, "test: transform selection to lowercase": function() { var session = new EditSession(["AJAX", "DOT", "ORG"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.getSelection().selectLineEnd(); editor.toLowerCase(); assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n")); }, "test: transform word to lowercase": function() { var session = new EditSession(["AJAX", "DOT", "ORG"]); var editor = new Editor(new MockRenderer(), session); editor.moveCursorTo(1, 0); editor.toLowerCase(); assert.equal(session.getValue(), ["AJAX", "dot", "ORG"].join("\n")); assert.position(editor.getCursorPosition(), 1, 0); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/ext/beautify/php_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var TokenIterator = require("ace/token_iterator").TokenIterator; exports.newLines = [{ type: 'support.php_tag', value: '' }, { type: 'paren.lparen', value: '{', indent: true }, { type: 'paren.rparen', breakBefore: true, value: '}', indent: false }, { type: 'paren.rparen', breakBefore: true, value: '})', indent: false, dontBreak: true }, { type: 'comment' }, { type: 'text', value: ';' }, { type: 'text', value: ':', context: 'php' }, { type: 'keyword', value: 'case', indent: true, dontBreak: true }, { type: 'keyword', value: 'default', indent: true, dontBreak: true }, { type: 'keyword', value: 'break', indent: false, dontBreak: true }, { type: 'punctuation.doctype.end', value: '>' }, { type: 'meta.tag.punctuation.end', value: '>' }, { type: 'meta.tag.punctuation.begin', value: '<', blockTag: true, indent: true, dontBreak: true }, { type: 'meta.tag.punctuation.begin', value: '' ){ context = 'php'; } else if( token.type == 'support.php_tag' && token.value == '?>' ){ context = 'html'; } //css else if( token.type == 'meta.tag.name.style' && context != 'css' ){ context = 'css'; } else if( token.type == 'meta.tag.name.style' && context == 'css' ){ context = 'html'; } //js else if( token.type == 'meta.tag.name.script' && context != 'js' ){ context = 'js'; } else if( token.type == 'meta.tag.name.script' && context == 'js' ){ context = 'html'; } nextToken = iterator.stepForward(); //tag name if (nextToken && nextToken.type.indexOf('meta.tag.name') == 0) { nextTag = nextToken.value; } //don't linebreak if ( lastToken.type == 'support.php_tag' && lastToken.value == '' ) { dontBreak = false; } //next token lastTag = tag; lastToken = token; token = nextToken; if (token===null) { break; } } return code; }; }); ================================================ FILE: lib/ace/ext/beautify.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ // [WIP] define(function(require, exports, module) { "use strict"; var TokenIterator = require("ace/token_iterator").TokenIterator; var phpTransform = require("./beautify/php_rules").transform; exports.beautify = function(session) { var iterator = new TokenIterator(session, 0, 0); var token = iterator.getCurrentToken(); var context = session.$modeId.split("/").pop(); var code = phpTransform(iterator, context); session.doc.setValue(code); }; exports.commands = [{ name: "beautify", exec: function(editor) { exports.beautify(editor.session); }, bindKey: "Ctrl-Shift-B" }]; }); ================================================ FILE: lib/ace/ext/elastic_tabstops_lite.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var ElasticTabstopsLite = function(editor) { this.$editor = editor; var self = this; var changedRows = []; var recordChanges = false; this.onAfterExec = function() { recordChanges = false; self.processRows(changedRows); changedRows = []; }; this.onExec = function() { recordChanges = true; }; this.onChange = function(delta) { if (recordChanges) { if (changedRows.indexOf(delta.start.row) == -1) changedRows.push(delta.start.row); if (delta.end.row != delta.start.row) changedRows.push(delta.end.row); } }; }; (function() { this.processRows = function(rows) { this.$inChange = true; var checkedRows = []; for (var r = 0, rowCount = rows.length; r < rowCount; r++) { var row = rows[r]; if (checkedRows.indexOf(row) > -1) continue; var cellWidthObj = this.$findCellWidthsForBlock(row); var cellWidths = this.$setBlockCellWidthsToMax(cellWidthObj.cellWidths); var rowIndex = cellWidthObj.firstRow; for (var w = 0, l = cellWidths.length; w < l; w++) { var widths = cellWidths[w]; checkedRows.push(rowIndex); this.$adjustRow(rowIndex, widths); rowIndex++; } } this.$inChange = false; }; this.$findCellWidthsForBlock = function(row) { var cellWidths = [], widths; // starting row and backward var rowIter = row; while (rowIter >= 0) { widths = this.$cellWidthsForRow(rowIter); if (widths.length == 0) break; cellWidths.unshift(widths); rowIter--; } var firstRow = rowIter + 1; // forward (not including starting row) rowIter = row; var numRows = this.$editor.session.getLength(); while (rowIter < numRows - 1) { rowIter++; widths = this.$cellWidthsForRow(rowIter); if (widths.length == 0) break; cellWidths.push(widths); } return { cellWidths: cellWidths, firstRow: firstRow }; }; this.$cellWidthsForRow = function(row) { var selectionColumns = this.$selectionColumnsForRow(row); // todo: support multicursor var tabs = [-1].concat(this.$tabsForRow(row)); var widths = tabs.map(function(el) { return 0; } ).slice(1); var line = this.$editor.session.getLine(row); for (var i = 0, len = tabs.length - 1; i < len; i++) { var leftEdge = tabs[i]+1; var rightEdge = tabs[i+1]; var rightmostSelection = this.$rightmostSelectionInCell(selectionColumns, rightEdge); var cell = line.substring(leftEdge, rightEdge); widths[i] = Math.max(cell.replace(/\s+$/g,'').length, rightmostSelection - leftEdge); } return widths; }; this.$selectionColumnsForRow = function(row) { var selections = [], cursor = this.$editor.getCursorPosition(); if (this.$editor.session.getSelection().isEmpty()) { // todo: support multicursor if (row == cursor.row) selections.push(cursor.column); } return selections; }; this.$setBlockCellWidthsToMax = function(cellWidths) { var startingNewBlock = true, blockStartRow, blockEndRow, maxWidth; var columnInfo = this.$izip_longest(cellWidths); for (var c = 0, l = columnInfo.length; c < l; c++) { var column = columnInfo[c]; if (!column.push) { console.error(column); continue; } // add an extra None to the end so that the end of the column automatically // finishes a block column.push(NaN); for (var r = 0, s = column.length; r < s; r++) { var width = column[r]; if (startingNewBlock) { blockStartRow = r; maxWidth = 0; startingNewBlock = false; } if (isNaN(width)) { // block ended blockEndRow = r; for (var j = blockStartRow; j < blockEndRow; j++) { cellWidths[j][c] = maxWidth; } startingNewBlock = true; } maxWidth = Math.max(maxWidth, width); } } return cellWidths; }; this.$rightmostSelectionInCell = function(selectionColumns, cellRightEdge) { var rightmost = 0; if (selectionColumns.length) { var lengths = []; for (var s = 0, length = selectionColumns.length; s < length; s++) { if (selectionColumns[s] <= cellRightEdge) lengths.push(s); else lengths.push(0); } rightmost = Math.max.apply(Math, lengths); } return rightmost; }; this.$tabsForRow = function(row) { var rowTabs = [], line = this.$editor.session.getLine(row), re = /\t/g, match; while ((match = re.exec(line)) != null) { rowTabs.push(match.index); } return rowTabs; }; this.$adjustRow = function(row, widths) { var rowTabs = this.$tabsForRow(row); if (rowTabs.length == 0) return; var bias = 0, location = -1; // this always only contains two elements, so we're safe in the loop below var expandedSet = this.$izip(widths, rowTabs); for (var i = 0, l = expandedSet.length; i < l; i++) { var w = expandedSet[i][0], it = expandedSet[i][1]; location += 1 + w; it += bias; var difference = location - it; if (difference == 0) continue; var partialLine = this.$editor.session.getLine(row).substr(0, it ); var strippedPartialLine = partialLine.replace(/\s*$/g, ""); var ispaces = partialLine.length - strippedPartialLine.length; if (difference > 0) { // put the spaces after the tab and then delete the tab, so any insertion // points behave as expected this.$editor.session.getDocument().insertInLine({row: row, column: it + 1}, Array(difference + 1).join(" ") + "\t"); this.$editor.session.getDocument().removeInLine(row, it, it + 1); bias += difference; } if (difference < 0 && ispaces >= -difference) { this.$editor.session.getDocument().removeInLine(row, it + difference, it); bias += difference; } } }; // the is a (naive) Python port--but works for these purposes this.$izip_longest = function(iterables) { if (!iterables[0]) return []; var longest = iterables[0].length; var iterablesLength = iterables.length; for (var i = 1; i < iterablesLength; i++) { var iLength = iterables[i].length; if (iLength > longest) longest = iLength; } var expandedSet = []; for (var l = 0; l < longest; l++) { var set = []; for (var i = 0; i < iterablesLength; i++) { if (iterables[i][l] === "") set.push(NaN); else set.push(iterables[i][l]); } expandedSet.push(set); } return expandedSet; }; // an even more (naive) Python port this.$izip = function(widths, tabs) { // grab the shorter size var size = widths.length >= tabs.length ? tabs.length : widths.length; var expandedSet = []; for (var i = 0; i < size; i++) { var set = [ widths[i], tabs[i] ]; expandedSet.push(set); } return expandedSet; }; }).call(ElasticTabstopsLite.prototype); exports.ElasticTabstopsLite = ElasticTabstopsLite; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { useElasticTabstops: { set: function(val) { if (val) { if (!this.elasticTabstops) this.elasticTabstops = new ElasticTabstopsLite(this); this.commands.on("afterExec", this.elasticTabstops.onAfterExec); this.commands.on("exec", this.elasticTabstops.onExec); this.on("change", this.elasticTabstops.onChange); } else if (this.elasticTabstops) { this.commands.removeListener("afterExec", this.elasticTabstops.onAfterExec); this.commands.removeListener("exec", this.elasticTabstops.onExec); this.removeListener("change", this.elasticTabstops.onChange); } } } }); }); ================================================ FILE: lib/ace/ext/emmet.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var HashHandler = require("ace/keyboard/hash_handler").HashHandler; var Editor = require("ace/editor").Editor; var snippetManager = require("ace/snippets").snippetManager; var Range = require("ace/range").Range; var emmet, emmetPath; /** * Implementation of {@link IEmmetEditor} interface for Ace */ function AceEmmetEditor() {} AceEmmetEditor.prototype = { setupContext: function(editor) { this.ace = editor; this.indentation = editor.session.getTabString(); if (!emmet) emmet = window.emmet; var resources = emmet.resources || emmet.require("resources"); resources.setVariable("indentation", this.indentation); this.$syntax = null; this.$syntax = this.getSyntax(); }, /** * Returns character indexes of selected text: object with start * and end properties. If there's no selection, should return * object with start and end properties referring * to current caret position * @return {Object} * @example * var selection = editor.getSelectionRange(); * alert(selection.start + ', ' + selection.end); */ getSelectionRange: function() { // TODO should start be caret position instead? var range = this.ace.getSelectionRange(); var doc = this.ace.session.doc; return { start: doc.positionToIndex(range.start), end: doc.positionToIndex(range.end) }; }, /** * Creates selection from start to end character * indexes. If end is ommited, this method should place caret * and start index * @param {Number} start * @param {Number} [end] * @example * editor.createSelection(10, 40); * * //move caret to 15th character * editor.createSelection(15); */ createSelection: function(start, end) { var doc = this.ace.session.doc; this.ace.selection.setRange({ start: doc.indexToPosition(start), end: doc.indexToPosition(end) }); }, /** * Returns current line's start and end indexes as object with start * and end properties * @return {Object} * @example * var range = editor.getCurrentLineRange(); * alert(range.start + ', ' + range.end); */ getCurrentLineRange: function() { var ace = this.ace; var row = ace.getCursorPosition().row; var lineLength = ace.session.getLine(row).length; var index = ace.session.doc.positionToIndex({row: row, column: 0}); return { start: index, end: index + lineLength }; }, /** * Returns current caret position * @return {Number|null} */ getCaretPos: function(){ var pos = this.ace.getCursorPosition(); return this.ace.session.doc.positionToIndex(pos); }, /** * Set new caret position * @param {Number} index Caret position */ setCaretPos: function(index){ var pos = this.ace.session.doc.indexToPosition(index); this.ace.selection.moveToPosition(pos); }, /** * Returns content of current line * @return {String} */ getCurrentLine: function() { var row = this.ace.getCursorPosition().row; return this.ace.session.getLine(row); }, /** * Replace editor's content or it's part (from start to * end index). If value contains * caret_placeholder, the editor will put caret into * this position. If you skip start and end * arguments, the whole target's content will be replaced with * value. * * If you pass start argument only, * the value will be placed at start string * index of current content. * * If you pass start and end arguments, * the corresponding substring of current target's content will be * replaced with value. * @param {String} value Content you want to paste * @param {Number} [start] Start index of editor's content * @param {Number} [end] End index of editor's content * @param {Boolean} [noIndent] Do not auto indent value */ replaceContent: function(value, start, end, noIndent) { if (end == null) end = start == null ? this.getContent().length : start; if (start == null) start = 0; var editor = this.ace; var doc = editor.session.doc; var range = Range.fromPoints(doc.indexToPosition(start), doc.indexToPosition(end)); editor.session.remove(range); range.end = range.start; //editor.selection.setRange(range); value = this.$updateTabstops(value); snippetManager.insertSnippet(editor, value); }, /** * Returns editor's content * @return {String} */ getContent: function(){ return this.ace.getValue(); }, /** * Returns current editor's syntax mode * @return {String} */ getSyntax: function() { if (this.$syntax) return this.$syntax; var syntax = this.ace.session.$modeId.split("/").pop(); if (syntax == "html" || syntax == "php") { var cursor = this.ace.getCursorPosition(); var state = this.ace.session.getState(cursor.row); if (typeof state != "string") state = state[0]; if (state) { state = state.split("-"); if (state.length > 1) syntax = state[0]; else if (syntax == "php") syntax = "html"; } } return syntax; }, /** * Returns current output profile name (@see emmet#setupProfile) * @return {String} */ getProfileName: function() { var resources = emmet.resources || emmet.require("resources"); switch (this.getSyntax()) { case "css": return "css"; case "xml": case "xsl": return "xml"; case "html": var profile = resources.getVariable("profile"); // no forced profile, guess from content html or xhtml? if (!profile) profile = this.ace.session.getLines(0,2).join("").search(/]+XHTML/i) != -1 ? "xhtml": "html"; return profile; default: var mode = this.ace.session.$mode; return mode.emmetConfig && mode.emmetConfig.profile || "xhtml"; } }, /** * Ask user to enter something * @param {String} title Dialog title * @return {String} Entered data * @since 0.65 */ prompt: function(title) { return prompt(title); }, /** * Returns current selection * @return {String} * @since 0.65 */ getSelection: function() { return this.ace.session.getTextRange(); }, /** * Returns current editor's file path * @return {String} * @since 0.65 */ getFilePath: function() { return ""; }, // update tabstops: make sure all caret placeholders are unique // by default, abbreviation parser generates all unlinked (un-mirrored) // tabstops as ${0}, so we have upgrade all caret tabstops with unique // positions but make sure that all other tabstops are not linked accidentally // based on https://github.com/sergeche/emmet-sublime/blob/master/editor.js#L119-L171 $updateTabstops: function(value) { var base = 1000; var zeroBase = 0; var lastZero = null; var ts = emmet.tabStops || emmet.require('tabStops'); var resources = emmet.resources || emmet.require("resources"); var settings = resources.getVocabulary("user"); var tabstopOptions = { tabstop: function(data) { var group = parseInt(data.group, 10); var isZero = group === 0; if (isZero) group = ++zeroBase; else group += base; var placeholder = data.placeholder; if (placeholder) { // recursively update nested tabstops placeholder = ts.processText(placeholder, tabstopOptions); } var result = '${' + group + (placeholder ? ':' + placeholder : '') + '}'; if (isZero) { lastZero = [data.start, result]; } return result; }, escape: function(ch) { if (ch == '$') return '\\$'; if (ch == '\\') return '\\\\'; return ch; } }; value = ts.processText(value, tabstopOptions); if (settings.variables['insert_final_tabstop'] && !/\$\{0\}$/.test(value)) { value += '${0}'; } else if (lastZero) { var common = emmet.utils ? emmet.utils.common : emmet.require('utils'); value = common.replaceSubstring(value, '${0}', lastZero[0], lastZero[1]); } return value; } }; var keymap = { expand_abbreviation: {"mac": "ctrl+alt+e", "win": "alt+e"}, match_pair_outward: {"mac": "ctrl+d", "win": "ctrl+,"}, match_pair_inward: {"mac": "ctrl+j", "win": "ctrl+shift+0"}, matching_pair: {"mac": "ctrl+alt+j", "win": "alt+j"}, next_edit_point: "alt+right", prev_edit_point: "alt+left", toggle_comment: {"mac": "command+/", "win": "ctrl+/"}, split_join_tag: {"mac": "shift+command+'", "win": "shift+ctrl+`"}, remove_tag: {"mac": "command+'", "win": "shift+ctrl+;"}, evaluate_math_expression: {"mac": "shift+command+y", "win": "shift+ctrl+y"}, increment_number_by_1: "ctrl+up", decrement_number_by_1: "ctrl+down", increment_number_by_01: "alt+up", decrement_number_by_01: "alt+down", increment_number_by_10: {"mac": "alt+command+up", "win": "shift+alt+up"}, decrement_number_by_10: {"mac": "alt+command+down", "win": "shift+alt+down"}, select_next_item: {"mac": "shift+command+.", "win": "shift+ctrl+."}, select_previous_item: {"mac": "shift+command+,", "win": "shift+ctrl+,"}, reflect_css_value: {"mac": "shift+command+r", "win": "shift+ctrl+r"}, encode_decode_data_url: {"mac": "shift+ctrl+d", "win": "ctrl+'"}, // update_image_size: {"mac": "shift+ctrl+i", "win": "ctrl+u"}, // expand_as_you_type: "ctrl+alt+enter", // wrap_as_you_type: {"mac": "shift+ctrl+g", "win": "shift+ctrl+g"}, expand_abbreviation_with_tab: "Tab", wrap_with_abbreviation: {"mac": "shift+ctrl+a", "win": "shift+ctrl+a"} }; var editorProxy = new AceEmmetEditor(); exports.commands = new HashHandler(); exports.runEmmetCommand = function runEmmetCommand(editor) { try { editorProxy.setupContext(editor); var actions = emmet.actions || emmet.require("actions"); if (this.action == "expand_abbreviation_with_tab") { if (!editor.selection.isEmpty()) return false; var pos = editor.selection.lead; var token = editor.session.getTokenAt(pos.row, pos.column); if (token && /\btag\b/.test(token.type)) return false; } if (this.action == "wrap_with_abbreviation") { // without setTimeout prompt doesn't work on firefox return setTimeout(function() { actions.run("wrap_with_abbreviation", editorProxy); }, 0); } var result = actions.run(this.action, editorProxy); } catch(e) { if (!emmet) { load(runEmmetCommand.bind(this, editor)); return true; } editor._signal("changeStatus", typeof e == "string" ? e : e.message); console.log(e); result = false; } return result; }; for (var command in keymap) { exports.commands.addCommand({ name: "emmet:" + command, action: command, bindKey: keymap[command], exec: exports.runEmmetCommand, multiSelectAction: "forEach" }); } exports.updateCommands = function(editor, enabled) { if (enabled) { editor.keyBinding.addKeyboardHandler(exports.commands); } else { editor.keyBinding.removeKeyboardHandler(exports.commands); } }; exports.isSupportedMode = function(mode) { if (!mode) return false; if (mode.emmetConfig) return true; var id = mode.$id || mode; return /css|less|scss|sass|stylus|html|php|twig|ejs|handlebars/.test(id); }; exports.isAvailable = function(editor, command) { if (/(evaluate_math_expression|expand_abbreviation)$/.test(command)) return true; var mode = editor.session.$mode; var isSupported = exports.isSupportedMode(mode); if (isSupported && mode.$modes) { // TODO refactor mode delegates to make this simpler try { editorProxy.setupContext(editor); if (/js|php/.test(editorProxy.getSyntax())) isSupported = false; } catch(e) {} } return isSupported; }; var onChangeMode = function(e, target) { var editor = target; if (!editor) return; var enabled = exports.isSupportedMode(editor.session.$mode); if (e.enableEmmet === false) enabled = false; if (enabled) load(); exports.updateCommands(editor, enabled); }; var load = function(cb) { if (typeof emmetPath == "string") { require("ace/config").loadModule(emmetPath, function() { emmetPath = null; cb && cb(); }); } }; exports.AceEmmetEditor = AceEmmetEditor; require("ace/config").defineOptions(Editor.prototype, "editor", { enableEmmet: { set: function(val) { this[val ? "on" : "removeListener"]("changeMode", onChangeMode); onChangeMode({enableEmmet: !!val}, this); }, value: true } }); exports.setCore = function(e) { if (typeof e == "string") emmetPath = e; else emmet = e; }; }); ================================================ FILE: lib/ace/ext/error_marker.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var LineWidgets = require("../line_widgets").LineWidgets; var dom = require("../lib/dom"); var Range = require("../range").Range; function binarySearch(array, needle, comparator) { var first = 0; var last = array.length - 1; while (first <= last) { var mid = (first + last) >> 1; var c = comparator(needle, array[mid]); if (c > 0) first = mid + 1; else if (c < 0) last = mid - 1; else return mid; } // Return the nearest lesser index, "-1" means "0, "-2" means "1", etc. return -(first + 1); } function findAnnotations(session, row, dir) { var annotations = session.getAnnotations().sort(Range.comparePoints); if (!annotations.length) return; var i = binarySearch(annotations, {row: row, column: -1}, Range.comparePoints); if (i < 0) i = -i - 1; if (i >= annotations.length) i = dir > 0 ? 0 : annotations.length - 1; else if (i === 0 && dir < 0) i = annotations.length - 1; var annotation = annotations[i]; if (!annotation || !dir) return; if (annotation.row === row) { do { annotation = annotations[i += dir]; } while (annotation && annotation.row === row); if (!annotation) return annotations.slice(); } var matched = []; row = annotation.row; do { matched[dir < 0 ? "unshift" : "push"](annotation); annotation = annotations[i += dir]; } while (annotation && annotation.row == row); return matched.length && matched; } exports.showErrorMarker = function(editor, dir) { var session = editor.session; if (!session.widgetManager) { session.widgetManager = new LineWidgets(session); session.widgetManager.attach(editor); } var pos = editor.getCursorPosition(); var row = pos.row; var oldWidget = session.widgetManager.getWidgetsAtRow(row).filter(function(w) { return w.type == "errorMarker"; })[0]; if (oldWidget) { oldWidget.destroy(); } else { row -= dir; } var annotations = findAnnotations(session, row, dir); var gutterAnno; if (annotations) { var annotation = annotations[0]; pos.column = (annotation.pos && typeof annotation.column != "number" ? annotation.pos.sc : annotation.column) || 0; pos.row = annotation.row; gutterAnno = editor.renderer.$gutterLayer.$annotations[pos.row]; } else if (oldWidget) { return; } else { gutterAnno = { text: ["Looks good!"], className: "ace_ok" }; } editor.session.unfold(pos.row); editor.selection.moveToPosition(pos); var w = { row: pos.row, fixedWidth: true, coverGutter: true, el: dom.createElement("div"), type: "errorMarker" }; var el = w.el.appendChild(dom.createElement("div")); var arrow = w.el.appendChild(dom.createElement("div")); arrow.className = "error_widget_arrow " + gutterAnno.className; var left = editor.renderer.$cursorLayer .getPixelPosition(pos).left; arrow.style.left = left + editor.renderer.gutterWidth - 5 + "px"; w.el.className = "error_widget_wrapper"; el.className = "error_widget " + gutterAnno.className; el.innerHTML = gutterAnno.text.join("
    "); el.appendChild(dom.createElement("div")); var kb = function(_, hashId, keyString) { if (hashId === 0 && (keyString === "esc" || keyString === "return")) { w.destroy(); return {command: "null"}; } }; w.destroy = function() { if (editor.$mouseHandler.isMousePressed) return; editor.keyBinding.removeKeyboardHandler(kb); session.widgetManager.removeLineWidget(w); editor.off("changeSelection", w.destroy); editor.off("changeSession", w.destroy); editor.off("mouseup", w.destroy); editor.off("change", w.destroy); }; editor.keyBinding.addKeyboardHandler(kb); editor.on("changeSelection", w.destroy); editor.on("changeSession", w.destroy); editor.on("mouseup", w.destroy); editor.on("change", w.destroy); editor.session.widgetManager.addLineWidget(w); w.el.onmousedown = editor.focus.bind(editor); editor.renderer.scrollCursorIntoView(null, 0.5, {bottom: w.el.offsetHeight}); }; dom.importCssString("\ .error_widget_wrapper {\ background: inherit;\ color: inherit;\ border:none\ }\ .error_widget {\ border-top: solid 2px;\ border-bottom: solid 2px;\ margin: 5px 0;\ padding: 10px 40px;\ white-space: pre-wrap;\ }\ .error_widget.ace_error, .error_widget_arrow.ace_error{\ border-color: #ff5a5a\ }\ .error_widget.ace_warning, .error_widget_arrow.ace_warning{\ border-color: #F1D817\ }\ .error_widget.ace_info, .error_widget_arrow.ace_info{\ border-color: #5a5a5a\ }\ .error_widget.ace_ok, .error_widget_arrow.ace_ok{\ border-color: #5aaa5a\ }\ .error_widget_arrow {\ position: absolute;\ border: solid 5px;\ border-top-color: transparent!important;\ border-right-color: transparent!important;\ border-left-color: transparent!important;\ top: -5px;\ }\ ", ""); }); ================================================ FILE: lib/ace/ext/keybinding_menu.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ /** * Show Keyboard Shortcuts * @fileOverview Show Keyboard Shortcuts
    * Generates a menu which displays the keyboard shortcuts. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { "use strict"; var Editor = require("ace/editor").Editor; /** * Generates a menu which displays the keyboard shortcuts. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {ace.Editor} editor An instance of the ace editor. */ function showKeyboardShortcuts (editor) { // make sure the menu isn't open already. if(!document.getElementById('kbshortcutmenu')) { var overlayPage = require('./menu_tools/overlay_page').overlayPage; var getEditorKeybordShortcuts = require('./menu_tools/get_editor_keyboard_shortcuts').getEditorKeybordShortcuts; var kb = getEditorKeybordShortcuts(editor); var el = document.createElement('div'); var commands = kb.reduce(function(previous, current) { return previous + '
    ' + current.command + ' : ' + '' + current.key + '
    '; }, ''); el.id = 'kbshortcutmenu'; el.innerHTML = '

    Keyboard Shortcuts

    ' + commands + ''; overlayPage(editor, el, '0', '0', '0', null); } } module.exports.init = function(editor) { Editor.prototype.showKeyboardShortcuts = function() { showKeyboardShortcuts(this); }; editor.commands.addCommands([{ name: "showKeyboardShortcuts", bindKey: {win: "Ctrl-Alt-h", mac: "Command-Alt-h"}, exec: function(editor, line) { editor.showKeyboardShortcuts(); } }]); }; }); ================================================ FILE: lib/ace/ext/language_tools.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var snippetManager = require("../snippets").snippetManager; var Autocomplete = require("../autocomplete").Autocomplete; var config = require("../config"); var lang = require("../lib/lang"); var util = require("../autocomplete/util"); var textCompleter = require("../autocomplete/text_completer"); var keyWordCompleter = { getCompletions: function(editor, session, pos, prefix, callback) { if (session.$mode.completer) { return session.$mode.completer.getCompletions(editor, session, pos, prefix, callback); } var state = editor.session.getState(pos.row); var completions = session.$mode.getCompletions(state, session, pos, prefix); callback(null, completions); } }; var snippetCompleter = { getCompletions: function(editor, session, pos, prefix, callback) { var snippetMap = snippetManager.snippetMap; var completions = []; snippetManager.getActiveScopes(editor).forEach(function(scope) { var snippets = snippetMap[scope] || []; for (var i = snippets.length; i--;) { var s = snippets[i]; var caption = s.name || s.tabTrigger; if (!caption) continue; completions.push({ caption: caption, snippet: s.content, meta: s.tabTrigger && !s.name ? s.tabTrigger + "\u21E5 " : "snippet", type: "snippet" }); } }, this); callback(null, completions); }, getDocTooltip: function(item) { if (item.type == "snippet" && !item.docHTML) { item.docHTML = [ "", lang.escapeHTML(item.caption), "", "
    ", lang.escapeHTML(item.snippet) ].join(""); } } }; var completers = [snippetCompleter, textCompleter, keyWordCompleter]; // Modifies list of default completers exports.setCompleters = function(val) { completers.length = 0; if (val) completers.push.apply(completers, val); }; exports.addCompleter = function(completer) { completers.push(completer); }; // Exports existing completer so that user can construct his own set of completers. exports.textCompleter = textCompleter; exports.keyWordCompleter = keyWordCompleter; exports.snippetCompleter = snippetCompleter; var expandSnippet = { name: "expandSnippet", exec: function(editor) { return snippetManager.expandWithTab(editor); }, bindKey: "Tab" }; var onChangeMode = function(e, editor) { loadSnippetsForMode(editor.session.$mode); }; var loadSnippetsForMode = function(mode) { var id = mode.$id; if (!snippetManager.files) snippetManager.files = {}; loadSnippetFile(id); if (mode.modes) mode.modes.forEach(loadSnippetsForMode); }; var loadSnippetFile = function(id) { if (!id || snippetManager.files[id]) return; var snippetFilePath = id.replace("mode", "snippets"); snippetManager.files[id] = {}; config.loadModule(snippetFilePath, function(m) { if (m) { snippetManager.files[id] = m; if (!m.snippets && m.snippetText) m.snippets = snippetManager.parseSnippetFile(m.snippetText); snippetManager.register(m.snippets || [], m.scope); if (m.includeScopes) { snippetManager.snippetMap[m.scope].includeScopes = m.includeScopes; m.includeScopes.forEach(function(x) { loadSnippetFile("ace/mode/" + x); }); } } }); }; var doLiveAutocomplete = function(e) { var editor = e.editor; var hasCompleter = editor.completer && editor.completer.activated; // We don't want to autocomplete with no prefix if (e.command.name === "backspace") { if (hasCompleter && !util.getCompletionPrefix(editor)) editor.completer.detach(); } else if (e.command.name === "insertstring") { var prefix = util.getCompletionPrefix(editor); // Only autocomplete if there's a prefix that can be matched if (prefix && !hasCompleter) { if (!editor.completer) { // Create new autocompleter editor.completer = new Autocomplete(); } // Disable autoInsert editor.completer.autoInsert = false; editor.completer.showPopup(editor); } } }; var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { enableBasicAutocompletion: { set: function(val) { if (val) { if (!this.completers) this.completers = Array.isArray(val)? val: completers; this.commands.addCommand(Autocomplete.startCommand); } else { this.commands.removeCommand(Autocomplete.startCommand); } }, value: false }, /** * Enable live autocomplete. If the value is an array, it is assumed to be an array of completers * and will use them instead of the default completers. */ enableLiveAutocompletion: { set: function(val) { if (val) { if (!this.completers) this.completers = Array.isArray(val)? val: completers; // On each change automatically trigger the autocomplete this.commands.on('afterExec', doLiveAutocomplete); } else { this.commands.removeListener('afterExec', doLiveAutocomplete); } }, value: false }, enableSnippets: { set: function(val) { if (val) { this.commands.addCommand(expandSnippet); this.on("changeMode", onChangeMode); onChangeMode(null, this); } else { this.commands.removeCommand(expandSnippet); this.off("changeMode", onChangeMode); } }, value: false } }); }); ================================================ FILE: lib/ace/ext/linking.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { var Editor = require("ace/editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { enableLinking: { set: function(val) { if (val) { this.on("click", onClick); this.on("mousemove", onMouseMove); } else { this.off("click", onClick); this.off("mousemove", onMouseMove); } }, value: false } }); exports.previousLinkingHover = false; function onMouseMove(e) { var editor = e.editor; var ctrl = e.getAccelKey(); if (ctrl) { var editor = e.editor; var docPos = e.getDocumentPosition(); var session = editor.session; var token = session.getTokenAt(docPos.row, docPos.column); if (exports.previousLinkingHover && exports.previousLinkingHover != token) { editor._emit("linkHoverOut"); } editor._emit("linkHover", {position: docPos, token: token}); exports.previousLinkingHover = token; } else if (exports.previousLinkingHover) { editor._emit("linkHoverOut"); exports.previousLinkingHover = false; } } function onClick(e) { var ctrl = e.getAccelKey(); var button = e.getButton(); if (button == 0 && ctrl) { var editor = e.editor; var docPos = e.getDocumentPosition(); var session = editor.session; var token = session.getTokenAt(docPos.row, docPos.column); editor._emit("linkClick", {position: docPos, token: token}); } } }); ================================================ FILE: lib/ace/ext/menu_tools/add_editor_menu_options.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ /** * Add Editor Menu Options * @fileOverview Add Editor Menu Options
    * The menu options property needs to be added to the editor * so that the settings menu can know about options for * selection elements and track which option is selected. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { 'use strict'; /** * The menu options property needs to be added to the editor * so that the settings menu can know about options for * selection elements and track which option is selected. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {ace.Editor} editor An instance of the ace editor. */ module.exports.addEditorMenuOptions = function addEditorMenuOptions (editor) { var modelist = require('../modelist'); var themelist = require('../themelist'); editor.menuOptions = { setNewLineMode: [{ textContent: "unix", value: "unix" }, { textContent: "windows", value: "windows" }, { textContent: "auto", value: "auto" }], setTheme: [], setMode: [], setKeyboardHandler: [{ textContent: "ace", value: "" }, { textContent: "vim", value: "ace/keyboard/vim" }, { textContent: "emacs", value: "ace/keyboard/emacs" }, { textContent: "textarea", value: "ace/keyboard/textarea" }, { textContent: "sublime", value: "ace/keyboard/sublime" }] }; editor.menuOptions.setTheme = themelist.themes.map(function(theme) { return { textContent: theme.caption, value: theme.theme }; }); editor.menuOptions.setMode = modelist.modes.map(function(mode) { return { textContent: mode.name, value: mode.mode }; }); }; }); ================================================ FILE: lib/ace/ext/menu_tools/element_generator.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ /** * Element Generator * @fileOverview Element Generator
    * Contains methods for generating elements. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { 'use strict'; /** * Creates a DOM option element * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {object} obj An object containing properties to add to the dom * element. If one of those properties is named `selected` then it will be * added as an attribute on the element instead. */ module.exports.createOption = function createOption (obj) { var attribute; var el = document.createElement('option'); for(attribute in obj) { if(obj.hasOwnProperty(attribute)) { if(attribute === 'selected') { el.setAttribute(attribute, obj[attribute]); } else { el[attribute] = obj[attribute]; } } } return el; }; /** * Creates a DOM checkbox element. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {string} id The id of the element. * @param {boolean} checked Whether or not the element is checked. * @param {string} clss The class of the element. * @returns {DOMElement} Returns a checkbox element reference. */ module.exports.createCheckbox = function createCheckbox (id, checked, clss) { var el = document.createElement('input'); el.setAttribute('type', 'checkbox'); el.setAttribute('id', id); el.setAttribute('name', id); el.setAttribute('value', checked); el.setAttribute('class', clss); if(checked) { el.setAttribute('checked', 'checked'); } return el; }; /** * Creates a DOM text input element. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {string} id The id of the element. * @param {string} value The default value of the input element. * @param {string} clss The class of the element. * @returns {DOMElement} Returns an input element reference. */ module.exports.createInput = function createInput (id, value, clss) { var el = document.createElement('input'); el.setAttribute('type', 'text'); el.setAttribute('id', id); el.setAttribute('name', id); el.setAttribute('value', value); el.setAttribute('class', clss); return el; }; /** * Creates a DOM label element. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {string} text The label text. * @param {string} labelFor The id of the element being labeled. * @returns {DOMElement} Returns a label element reference. */ module.exports.createLabel = function createLabel (text, labelFor) { var el = document.createElement('label'); el.setAttribute('for', labelFor); el.textContent = text; return el; }; /** * Creates a DOM selection element. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {string} id The id of the element. * @param {string} values An array of objects suitable for `createOption` * @param {string} clss The class of the element. * @returns {DOMElement} Returns a selection element reference. * @see ace/ext/element_generator.createOption */ module.exports.createSelection = function createSelection (id, values, clss) { var el = document.createElement('select'); el.setAttribute('id', id); el.setAttribute('name', id); el.setAttribute('class', clss); values.forEach(function(item) { el.appendChild(module.exports.createOption(item)); }); return el; }; }); ================================================ FILE: lib/ace/ext/menu_tools/generate_settings_menu.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define*/ /** * Generates the settings menu * @fileOverview Generates the settings menu. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { 'use strict'; var egen = require('./element_generator'); var addEditorMenuOptions = require('./add_editor_menu_options').addEditorMenuOptions; var getSetFunctions = require('./get_set_functions').getSetFunctions; /** * Generates an interactive menu with settings useful to end users. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {ace.Editor} editor An instance of the ace editor. */ module.exports.generateSettingsMenu = function generateSettingsMenu (editor) { /** * container for dom elements that will go in the menu. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ var elements = []; /** * Sorts the menu entries (elements var) so they'll appear in alphabetical order * the sort is performed based on the value of the contains property * of each element. Since this is an `array.sort` the array is sorted * in place. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ function cleanupElementsList() { elements.sort(function(a, b) { var x = a.getAttribute('contains'); var y = b.getAttribute('contains'); return x.localeCompare(y); }); } /** * Wraps all dom elements contained in the elements var with a single * div. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ function wrapElements() { var topmenu = document.createElement('div'); topmenu.setAttribute('id', 'ace_settingsmenu'); elements.forEach(function(element) { topmenu.appendChild(element); }); var el = topmenu.appendChild(document.createElement('div')); var version = require("../../ace").version; el.style.padding = "1em"; el.textContent = "Ace version " + version; return topmenu; } /** * Creates a new menu entry. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {object} obj This is a reference to the object containing the * set function. It is used to set up event listeners for when the * menu options change. * @param {string} clss Maps to the class of the dom element. This is * the name of the object containing the set function e.g. `editor`, * `session`, `renderer`. * @param {string} item This is the set function name. It maps to the * id of the dom element (check, select, input) and to the "contains" * attribute of the div holding both the element and its label. * @param {mixed} val This is the value of the setting. It is mapped to * the dom element's value, checked, or selected option accordingly. */ function createNewEntry(obj, clss, item, val) { var el; var div = document.createElement('div'); div.setAttribute('contains', item); div.setAttribute('class', 'ace_optionsMenuEntry'); div.setAttribute('style', 'clear: both;'); div.appendChild(egen.createLabel( item.replace(/^set/, '').replace(/([A-Z])/g, ' $1').trim(), item )); if (Array.isArray(val)) { el = egen.createSelection(item, val, clss); el.addEventListener('change', function(e) { try{ editor.menuOptions[e.target.id].forEach(function(x) { if(x.textContent !== e.target.textContent) { delete x.selected; } }); obj[e.target.id](e.target.value); } catch (err) { throw new Error(err); } }); } else if(typeof val === 'boolean') { el = egen.createCheckbox(item, val, clss); el.addEventListener('change', function(e) { try{ // renderer['setHighlightGutterLine'](true); obj[e.target.id](!!e.target.checked); } catch (err) { throw new Error(err); } }); } else { // this aids in giving the ability to specify settings through // post and get requests. // /ace_editor.html?setMode=ace/mode/html&setOverwrite=true el = egen.createInput(item, val, clss); el.addEventListener('change', function(e) { try{ if(e.target.value === 'true') { obj[e.target.id](true); } else if(e.target.value === 'false') { obj[e.target.id](false); } else { obj[e.target.id](e.target.value); } } catch (err) { throw new Error(err); } }); } el.style.cssText = 'float:right;'; div.appendChild(el); return div; } /** * Generates selection fields for the menu and populates their options * using information from `editor.menuOptions` * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {string} item The set function name. * @param {object} esr A reference to the object having the set function. * @param {string} clss The name of the object containing the set function. * @param {string} fn The matching get function's function name. * @returns {DOMElement} Returns a dom element containing a selection * element populated with options. The option whose value matches that * returned from `esr[fn]()` will be selected. */ function makeDropdown(item, esr, clss, fn) { var val = editor.menuOptions[item]; var currentVal = esr[fn](); if (typeof currentVal == 'object') currentVal = currentVal.$id; val.forEach(function(valuex) { if (valuex.value === currentVal) valuex.selected = 'selected'; }); return createNewEntry(esr, clss, item, val); } /** * Processes the set functions returned from `getSetFunctions`. First it * checks for menu options defined in `editor.menuOptions`. If no * options are specified then it checks whether there is a get function * (replace set with get) for the setting. When either of those * conditions are met it will attempt to create a new entry for the * settings menu and push it into the elements array defined above. * It can only do so for get functions which return * strings, numbers, and booleans. A special case is written in for * `getMode` where it looks at the returned objects `$id` property and * forwards that through instead. Other special cases could be written * in but that would get a bit ridiculous. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {object} setObj An item from the array returned by * `getSetFunctions`. */ function handleSet(setObj) { var item = setObj.functionName; var esr = setObj.parentObj; var clss = setObj.parentName; var val; var fn = item.replace(/^set/, 'get'); if(editor.menuOptions[item] !== undefined) { // has options for select element elements.push(makeDropdown(item, esr, clss, fn)); } else if(typeof esr[fn] === 'function') { // has get function try { val = esr[fn](); if(typeof val === 'object') { // setMode takes a string, getMode returns an object // the $id property of that object is the string // which may be given to setMode... val = val.$id; } // the rest of the get functions return strings, // booleans, or numbers. elements.push( createNewEntry(esr, clss, item, val) ); } catch (e) { // if there are errors it is because the element // does not belong in the settings menu } } } addEditorMenuOptions(editor); // gather the set functions getSetFunctions(editor).forEach(function(setObj) { // populate the elements array with good stuff. handleSet(setObj); }); // sort the menu entries in the elements list so people can find // the settings in alphabetical order. cleanupElementsList(); // dump the entries from the elements list and wrap them up in a div return wrapElements(); }; }); ================================================ FILE: lib/ace/ext/menu_tools/get_editor_keyboard_shortcuts.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ /** * Get Editor Keyboard Shortcuts * @fileOverview Get Editor Keyboard Shortcuts
    * Gets a map of keyboard shortcuts to command names for the current platform. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { "use strict"; var keys = require("../../lib/keys"); /** * Gets a map of keyboard shortcuts to command names for the current platform. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {ace.Editor} editor An editor instance. * @returns {Array} Returns an array of objects representing the keyboard * shortcuts for the given editor. * @example * var getKbShortcuts = require('./get_keyboard_shortcuts'); * console.log(getKbShortcuts(editor)); * // [ * // {'command' : aCommand, 'key' : 'Control-d'}, * // {'command' : aCommand, 'key' : 'Control-d'} * // ] */ module.exports.getEditorKeybordShortcuts = function(editor) { var KEY_MODS = keys.KEY_MODS; var keybindings = []; var commandMap = {}; editor.keyBinding.$handlers.forEach(function(handler) { var ckb = handler.commandKeyBinding; for (var i in ckb) { var key = i.replace(/(^|-)\w/g, function(x) { return x.toUpperCase(); }); var commands = ckb[i]; if (!Array.isArray(commands)) commands = [commands]; commands.forEach(function(command) { if (typeof command != "string") command = command.name; if (commandMap[command]) { commandMap[command].key += "|" + key; } else { commandMap[command] = {key: key, command: command}; keybindings.push(commandMap[command]); } }); } }); return keybindings; }; }); ================================================ FILE: lib/ace/ext/menu_tools/get_set_functions.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true */ /*global define*/ /** * Get Set Functions * @fileOverview Get Set Functions
    * Gets various functions for setting settings. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { 'use strict'; /** * Generates a list of set functions for the settings menu. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {object} editor The editor instance * @return {array} Returns an array of objects. Each object contains the * following properties: functionName, parentObj, and parentName. The * function name will be the name of a method beginning with the string * `set` which was found. The parent object will be a reference to the * object having the method matching the function name. The parent name * will be a string representing the identifier of the parent object e.g. * `editor`, `session`, or `renderer`. */ module.exports.getSetFunctions = function getSetFunctions (editor) { /** * Output array. Will hold the objects described above. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ var out = []; /** * This object provides a map between the objects which will be * traversed and the parent name which will appear in the output. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ var my = { 'editor' : editor, 'session' : editor.session, 'renderer' : editor.renderer }; /** * This array will hold the set function names which have already been * found so that they are not added to the output multiple times. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ var opts = []; /** * This is a list of set functions which will not appear in the settings * menu. I don't know what to do with setKeyboardHandler. When I tried * to use it, it didn't appear to be working. Someone who knows better * could remove it from this list and add it's options to * add_editor_menu_options.js * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ var skip = [ 'setOption', 'setUndoManager', 'setDocument', 'setValue', 'setBreakpoints', 'setScrollTop', 'setScrollLeft', 'setSelectionStyle', 'setWrapLimitRange' ]; /** * This will search the objects mapped to the `my` variable above. When * it finds a set function in the object that is not listed in the * `skip` list or the `opts` list it will push a new object to the * output array. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ ['renderer', 'session', 'editor'].forEach(function(esra) { var esr = my[esra]; var clss = esra; for(var fn in esr) { if(skip.indexOf(fn) === -1) { if(/^set/.test(fn) && opts.indexOf(fn) === -1) { // found set function opts.push(fn); out.push({ 'functionName' : fn, 'parentObj' : esr, 'parentName' : clss }); } } } }); return out; }; }); ================================================ FILE: lib/ace/ext/menu_tools/overlay_page.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ /** * Overlay Page * @fileOverview Overlay Page
    * Generates an overlay for displaying menus. The overlay is an absolutely * positioned div. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { 'use strict'; var dom = require("../../lib/dom"); var cssText = require("../../requirejs/text!./settings_menu.css"); dom.importCssString(cssText); /** * Generates an overlay for displaying menus. The overlay is an absolutely * positioned div. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {DOMElement} contentElement Any element which may be presented inside * a div. * @param {string|number} top absolute position value. * @param {string|number} right absolute position value. * @param {string|number} bottom absolute position value. * @param {string|number} left absolute position value. */ module.exports.overlayPage = function overlayPage(editor, contentElement, top, right, bottom, left) { top = top ? 'top: ' + top + ';' : ''; bottom = bottom ? 'bottom: ' + bottom + ';' : ''; right = right ? 'right: ' + right + ';' : ''; left = left ? 'left: ' + left + ';' : ''; var closer = document.createElement('div'); var contentContainer = document.createElement('div'); function documentEscListener(e) { if (e.keyCode === 27) { closer.click(); } } closer.style.cssText = 'margin: 0; padding: 0; ' + 'position: fixed; top:0; bottom:0; left:0; right:0;' + 'z-index: 9990; ' + 'background-color: rgba(0, 0, 0, 0.3);'; closer.addEventListener('click', function() { document.removeEventListener('keydown', documentEscListener); closer.parentNode.removeChild(closer); editor.focus(); closer = null; }); // click closer if esc key is pressed document.addEventListener('keydown', documentEscListener); contentContainer.style.cssText = top + right + bottom + left; contentContainer.addEventListener('click', function(e) { e.stopPropagation(); }); var wrapper = dom.createElement("div"); wrapper.style.position = "relative"; var closeButton = dom.createElement("div"); closeButton.className = "ace_closeButton"; closeButton.addEventListener('click', function() { closer.click(); }); wrapper.appendChild(closeButton); contentContainer.appendChild(wrapper); contentContainer.appendChild(contentElement); closer.appendChild(contentContainer); document.body.appendChild(closer); editor.blur(); }; }); ================================================ FILE: lib/ace/ext/menu_tools/settings_menu.css ================================================ #ace_settingsmenu, #kbshortcutmenu { background-color: #F7F7F7; color: black; box-shadow: -5px 4px 5px rgba(126, 126, 126, 0.55); padding: 1em 0.5em 2em 1em; overflow: auto; position: absolute; margin: 0; bottom: 0; right: 0; top: 0; z-index: 9991; cursor: default; } .ace_dark #ace_settingsmenu, .ace_dark #kbshortcutmenu { box-shadow: -20px 10px 25px rgba(126, 126, 126, 0.25); background-color: rgba(255, 255, 255, 0.6); color: black; } .ace_optionsMenuEntry:hover { background-color: rgba(100, 100, 100, 0.1); -webkit-transition: all 0.5s; transition: all 0.3s } .ace_closeButton { background: rgba(245, 146, 146, 0.5); border: 1px solid #F48A8A; border-radius: 50%; padding: 7px; position: absolute; right: -8px; top: -8px; z-index: 1000; } .ace_closeButton{ background: rgba(245, 146, 146, 0.9); } .ace_optionsMenuKey { color: darkslateblue; font-weight: bold; } .ace_optionsMenuCommand { color: darkcyan; font-weight: normal; } ================================================ FILE: lib/ace/ext/modelist.js ================================================ define(function(require, exports, module) { "use strict"; var modes = []; /** * Suggests a mode based on the file extension present in the given path * @param {string} path The path to the file * @returns {object} Returns an object containing information about the * suggested mode. */ function getModeForPath(path) { var mode = modesByName.text; var fileName = path.split(/[\/\\]/).pop(); for (var i = 0; i < modes.length; i++) { if (modes[i].supportsFile(fileName)) { mode = modes[i]; break; } } return mode; } var Mode = function(name, caption, extensions) { this.name = name; this.caption = caption; this.mode = "ace/mode/" + name; this.extensions = extensions; var re; if (/\^/.test(extensions)) { re = extensions.replace(/\|(\^)?/g, function(a, b){ return "$|" + (b ? "^" : "^.*\\."); }) + "$"; } else { re = "^.*\\.(" + extensions + ")$"; } this.extRe = new RegExp(re, "gi"); }; Mode.prototype.supportsFile = function(filename) { return filename.match(this.extRe); }; // todo firstlinematch var supportedModes = { ABAP: ["abap"], ABC: ["abc"], ActionScript:["as"], ADA: ["ada|adb"], Apache_Conf: ["^htaccess|^htgroups|^htpasswd|^conf|htaccess|htgroups|htpasswd"], AsciiDoc: ["asciidoc|adoc"], Assembly_x86:["asm|a"], AutoHotKey: ["ahk"], BatchFile: ["bat|cmd"], Bro: ["bro"], C_Cpp: ["cpp|c|cc|cxx|h|hh|hpp|ino"], C9Search: ["c9search_results"], Cirru: ["cirru|cr"], Clojure: ["clj|cljs"], Cobol: ["CBL|COB"], coffee: ["coffee|cf|cson|^Cakefile"], ColdFusion: ["cfm"], CSharp: ["cs"], Csound_Document: ["csd"], Csound_Orchestra: ["orc"], Csound_Score: ["sco"], CSS: ["css"], Curly: ["curly"], D: ["d|di"], Dart: ["dart"], Diff: ["diff|patch"], Dockerfile: ["^Dockerfile"], Dot: ["dot"], Drools: ["drl"], Eiffel: ["e|ge"], EJS: ["ejs"], Elixir: ["ex|exs"], Elm: ["elm"], Erlang: ["erl|hrl"], Forth: ["frt|fs|ldr|fth|4th"], Fortran: ["f|f90"], FTL: ["ftl"], Gcode: ["gcode"], Gherkin: ["feature"], Gitignore: ["^.gitignore"], Glsl: ["glsl|frag|vert"], Gobstones: ["gbs"], golang: ["go"], GraphQLSchema: ["gql"], Groovy: ["groovy"], HAML: ["haml"], Handlebars: ["hbs|handlebars|tpl|mustache"], Haskell: ["hs"], Haskell_Cabal: ["cabal"], haXe: ["hx"], Hjson: ["hjson"], HTML: ["html|htm|xhtml|vue|we|wpy"], HTML_Elixir: ["eex|html.eex"], HTML_Ruby: ["erb|rhtml|html.erb"], INI: ["ini|conf|cfg|prefs"], Io: ["io"], Jack: ["jack"], Jade: ["jade|pug"], Java: ["java"], JavaScript: ["js|jsm|jsx"], JSON: ["json"], JSONiq: ["jq"], JSP: ["jsp"], JSSM: ["jssm|jssm_state"], JSX: ["jsx"], Julia: ["jl"], Kotlin: ["kt|kts"], LaTeX: ["tex|latex|ltx|bib"], LESS: ["less"], Liquid: ["liquid"], Lisp: ["lisp"], LiveScript: ["ls"], LogiQL: ["logic|lql"], LSL: ["lsl"], Lua: ["lua"], LuaPage: ["lp"], Lucene: ["lucene"], Makefile: ["^Makefile|^GNUmakefile|^makefile|^OCamlMakefile|make"], Markdown: ["md|markdown"], Mask: ["mask"], MATLAB: ["matlab"], Maze: ["mz"], MEL: ["mel"], MIXAL: ["mixal"], MUSHCode: ["mc|mush"], MySQL: ["mysql"], Nix: ["nix"], NSIS: ["nsi|nsh"], ObjectiveC: ["m|mm"], OCaml: ["ml|mli"], Pascal: ["pas|p"], Perl: ["pl|pm"], pgSQL: ["pgsql"], PHP: ["php|phtml|shtml|php3|php4|php5|phps|phpt|aw|ctp|module"], Pig: ["pig"], Powershell: ["ps1"], Praat: ["praat|praatscript|psc|proc"], Prolog: ["plg|prolog"], Properties: ["properties"], Protobuf: ["proto"], Python: ["py"], R: ["r"], Razor: ["cshtml|asp"], RDoc: ["Rd"], Red: ["red|reds"], RHTML: ["Rhtml"], RST: ["rst"], Ruby: ["rb|ru|gemspec|rake|^Guardfile|^Rakefile|^Gemfile"], Rust: ["rs"], SASS: ["sass"], SCAD: ["scad"], Scala: ["scala"], Scheme: ["scm|sm|rkt|oak|scheme"], SCSS: ["scss"], SH: ["sh|bash|^.bashrc"], SJS: ["sjs"], Smarty: ["smarty|tpl"], snippets: ["snippets"], Soy_Template:["soy"], Space: ["space"], SQL: ["sql"], SQLServer: ["sqlserver"], Stylus: ["styl|stylus"], SVG: ["svg"], Swift: ["swift"], Tcl: ["tcl"], Tex: ["tex"], Text: ["txt"], Textile: ["textile"], Toml: ["toml"], TSX: ["tsx"], Twig: ["twig|swig"], Typescript: ["ts|typescript|str"], Vala: ["vala"], VBScript: ["vbs|vb"], Velocity: ["vm"], Verilog: ["v|vh|sv|svh"], VHDL: ["vhd|vhdl"], Wollok: ["wlk|wpgm|wtest"], XML: ["xml|rdf|rss|wsdl|xslt|atom|mathml|mml|xul|xbl|xaml"], XQuery: ["xq"], YAML: ["yaml|yml"], // Add the missing mode "Django" to ext-modelist Django: ["html"] }; var nameOverrides = { ObjectiveC: "Objective-C", CSharp: "C#", golang: "Go", C_Cpp: "C and C++", Csound_Document: "Csound Document", Csound_Orchestra: "Csound", Csound_Score: "Csound Score", coffee: "CoffeeScript", HTML_Ruby: "HTML (Ruby)", HTML_Elixir: "HTML (Elixir)", FTL: "FreeMarker" }; var modesByName = {}; for (var name in supportedModes) { var data = supportedModes[name]; var displayName = (nameOverrides[name] || name).replace(/_/g, " "); var filename = name.toLowerCase(); var mode = new Mode(filename, displayName, data[0]); modesByName[filename] = mode; modes.push(mode); } module.exports = { getModeForPath: getModeForPath, modes: modes, modesByName: modesByName }; }); ================================================ FILE: lib/ace/ext/searchbox.css ================================================ /* ------------------------------------------------------------------------------------------ * Editor Search Form * --------------------------------------------------------------------------------------- */ .ace_search { background-color: #ddd; color: #666; border: 1px solid #cbcbcb; border-top: 0 none; overflow: hidden; margin: 0; padding: 4px 6px 0 4px; position: absolute; top: 0; z-index: 99; white-space: normal; } .ace_search.left { border-left: 0 none; border-radius: 0px 0px 5px 0px; left: 0; } .ace_search.right { border-radius: 0px 0px 0px 5px; border-right: 0 none; right: 0; } .ace_search_form, .ace_replace_form { margin: 0 20px 4px 0; overflow: hidden; line-height: 1.9; } .ace_replace_form { margin-right: 0; } .ace_search_form.ace_nomatch { outline: 1px solid red; } .ace_search_field { border-radius: 3px 0 0 3px; background-color: white; color: black; border: 1px solid #cbcbcb; border-right: 0 none; box-sizing: border-box!important; outline: 0; padding: 0; font-size: inherit; margin: 0; line-height: inherit; padding: 0 6px; min-width: 17em; vertical-align: top; } .ace_searchbtn { border: 1px solid #cbcbcb; line-height: inherit; display: inline-block; padding: 0 6px; background: #fff; border-right: 0 none; border-left: 1px solid #dcdcdc; cursor: pointer; margin: 0; position: relative; box-sizing: content-box!important; color: #666; } .ace_searchbtn:last-child { border-radius: 0 3px 3px 0; border-right: 1px solid #cbcbcb; } .ace_searchbtn:disabled { background: none; cursor: default; } .ace_searchbtn:hover { background-color: #eef1f6; } .ace_searchbtn.prev, .ace_searchbtn.next { padding: 0px 0.7em } .ace_searchbtn.prev:after, .ace_searchbtn.next:after { content: ""; border: solid 2px #888; width: 0.5em; height: 0.5em; border-width: 2px 0 0 2px; display:inline-block; transform: rotate(-45deg); } .ace_searchbtn.next:after { border-width: 0 2px 2px 0 ; } .ace_searchbtn_close { background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA4AAAAcCAYAAABRVo5BAAAAZ0lEQVR42u2SUQrAMAhDvazn8OjZBilCkYVVxiis8H4CT0VrAJb4WHT3C5xU2a2IQZXJjiQIRMdkEoJ5Q2yMqpfDIo+XY4k6h+YXOyKqTIj5REaxloNAd0xiKmAtsTHqW8sR2W5f7gCu5nWFUpVjZwAAAABJRU5ErkJggg==) no-repeat 50% 0; border-radius: 50%; border: 0 none; color: #656565; cursor: pointer; font: 16px/16px Arial; padding: 0; height: 14px; width: 14px; top: 9px; right: 7px; position: absolute; } .ace_searchbtn_close:hover { background-color: #656565; background-position: 50% 100%; color: white; } .ace_button { margin-left: 2px; cursor: pointer; -webkit-user-select: none; -moz-user-select: none; -o-user-select: none; -ms-user-select: none; user-select: none; overflow: hidden; opacity: 0.7; border: 1px solid rgba(100,100,100,0.23); padding: 1px; box-sizing: border-box!important; color: black; } .ace_button:hover { background-color: #eee; opacity:1; } .ace_button:active { background-color: #ddd; } .ace_button.checked { border-color: #3399ff; opacity:1; } .ace_search_options{ margin-bottom: 3px; text-align: right; -webkit-user-select: none; -moz-user-select: none; -o-user-select: none; -ms-user-select: none; user-select: none; clear: both; } .ace_search_counter { float: left; font-family: arial; padding: 0 8px; } ================================================ FILE: lib/ace/ext/searchbox.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("../lib/dom"); var lang = require("../lib/lang"); var event = require("../lib/event"); var searchboxCss = require("../requirejs/text!./searchbox.css"); var HashHandler = require("../keyboard/hash_handler").HashHandler; var keyUtil = require("../lib/keys"); var MAX_COUNT = 999; dom.importCssString(searchboxCss, "ace_searchbox"); var html = ''.replace(/> +/g, ">"); var SearchBox = function(editor, range, showReplaceForm) { var div = dom.createElement("div"); div.innerHTML = html; this.element = div.firstChild; this.setSession = this.setSession.bind(this); this.$init(); this.setEditor(editor); }; (function() { this.setEditor = function(editor) { editor.searchBox = this; editor.renderer.scroller.appendChild(this.element); this.editor = editor; }; this.setSession = function(e) { this.searchRange = null; this.$syncOptions(true); }; this.$initElements = function(sb) { this.searchBox = sb.querySelector(".ace_search_form"); this.replaceBox = sb.querySelector(".ace_replace_form"); this.searchOption = sb.querySelector("[action=searchInSelection]"); this.replaceOption = sb.querySelector("[action=toggleReplace]"); this.regExpOption = sb.querySelector("[action=toggleRegexpMode]"); this.caseSensitiveOption = sb.querySelector("[action=toggleCaseSensitive]"); this.wholeWordOption = sb.querySelector("[action=toggleWholeWords]"); this.searchInput = this.searchBox.querySelector(".ace_search_field"); this.replaceInput = this.replaceBox.querySelector(".ace_search_field"); this.searchCounter = sb.querySelector(".ace_search_counter"); }; this.$init = function() { var sb = this.element; this.$initElements(sb); var _this = this; event.addListener(sb, "mousedown", function(e) { setTimeout(function(){ _this.activeInput.focus(); }, 0); event.stopPropagation(e); }); event.addListener(sb, "click", function(e) { var t = e.target || e.srcElement; var action = t.getAttribute("action"); if (action && _this[action]) _this[action](); else if (_this.$searchBarKb.commands[action]) _this.$searchBarKb.commands[action].exec(_this); event.stopPropagation(e); }); event.addCommandKeyListener(sb, function(e, hashId, keyCode) { var keyString = keyUtil.keyCodeToString(keyCode); var command = _this.$searchBarKb.findKeyCommand(hashId, keyString); if (command && command.exec) { command.exec(_this); event.stopEvent(e); } }); this.$onChange = lang.delayedCall(function() { _this.find(false, false); }); event.addListener(this.searchInput, "input", function() { _this.$onChange.schedule(20); }); event.addListener(this.searchInput, "focus", function() { _this.activeInput = _this.searchInput; _this.searchInput.value && _this.highlight(); }); event.addListener(this.replaceInput, "focus", function() { _this.activeInput = _this.replaceInput; _this.searchInput.value && _this.highlight(); }); }; //keybinding outside of the searchbox this.$closeSearchBarKb = new HashHandler([{ bindKey: "Esc", name: "closeSearchBar", exec: function(editor) { editor.searchBox.hide(); } }]); //keybinding outside of the searchbox this.$searchBarKb = new HashHandler(); this.$searchBarKb.bindKeys({ "Ctrl-f|Command-f": function(sb) { var isReplace = sb.isReplace = !sb.isReplace; sb.replaceBox.style.display = isReplace ? "" : "none"; sb.replaceOption.checked = false; sb.$syncOptions(); sb.searchInput.focus(); }, "Ctrl-H|Command-Option-F": function(sb) { sb.replaceOption.checked = true; sb.$syncOptions(); sb.replaceInput.focus(); }, "Ctrl-G|Command-G": function(sb) { sb.findNext(); }, "Ctrl-Shift-G|Command-Shift-G": function(sb) { sb.findPrev(); }, "esc": function(sb) { setTimeout(function() { sb.hide();}); }, "Return": function(sb) { if (sb.activeInput == sb.replaceInput) sb.replace(); sb.findNext(); }, "Shift-Return": function(sb) { if (sb.activeInput == sb.replaceInput) sb.replace(); sb.findPrev(); }, "Alt-Return": function(sb) { if (sb.activeInput == sb.replaceInput) sb.replaceAll(); sb.findAll(); }, "Tab": function(sb) { (sb.activeInput == sb.replaceInput ? sb.searchInput : sb.replaceInput).focus(); } }); this.$searchBarKb.addCommands([{ name: "toggleRegexpMode", bindKey: {win: "Alt-R|Alt-/", mac: "Ctrl-Alt-R|Ctrl-Alt-/"}, exec: function(sb) { sb.regExpOption.checked = !sb.regExpOption.checked; sb.$syncOptions(); } }, { name: "toggleCaseSensitive", bindKey: {win: "Alt-C|Alt-I", mac: "Ctrl-Alt-R|Ctrl-Alt-I"}, exec: function(sb) { sb.caseSensitiveOption.checked = !sb.caseSensitiveOption.checked; sb.$syncOptions(); } }, { name: "toggleWholeWords", bindKey: {win: "Alt-B|Alt-W", mac: "Ctrl-Alt-B|Ctrl-Alt-W"}, exec: function(sb) { sb.wholeWordOption.checked = !sb.wholeWordOption.checked; sb.$syncOptions(); } }, { name: "toggleReplace", exec: function(sb) { sb.replaceOption.checked = !sb.replaceOption.checked; sb.$syncOptions(); } }, { name: "searchInSelection", exec: function(sb) { sb.searchOption.checked = !sb.searchRange; sb.setSearchRange(sb.searchOption.checked && sb.editor.getSelectionRange()); sb.$syncOptions(); } }]); this.setSearchRange = function(range) { this.searchRange = range; if (range) { this.searchRangeMarker = this.editor.session.addMarker(range, "ace_active-line"); } else if (this.searchRangeMarker) { this.editor.session.removeMarker(this.searchRangeMarker); this.searchRangeMarker = null; } }; this.$syncOptions = function(preventScroll) { dom.setCssClass(this.replaceOption, "checked", this.searchRange); dom.setCssClass(this.searchOption, "checked", this.searchOption.checked); this.replaceOption.textContent = this.replaceOption.checked ? "-" : "+"; dom.setCssClass(this.regExpOption, "checked", this.regExpOption.checked); dom.setCssClass(this.wholeWordOption, "checked", this.wholeWordOption.checked); dom.setCssClass(this.caseSensitiveOption, "checked", this.caseSensitiveOption.checked); this.replaceBox.style.display = this.replaceOption.checked ? "" : "none"; this.find(false, false, preventScroll); }; this.highlight = function(re) { this.editor.session.highlight(re || this.editor.$search.$options.re); this.editor.renderer.updateBackMarkers(); }; this.find = function(skipCurrent, backwards, preventScroll) { var range = this.editor.find(this.searchInput.value, { skipCurrent: skipCurrent, backwards: backwards, wrap: true, regExp: this.regExpOption.checked, caseSensitive: this.caseSensitiveOption.checked, wholeWord: this.wholeWordOption.checked, preventScroll: preventScroll, range: this.searchRange }); var noMatch = !range && this.searchInput.value; dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); this.editor._emit("findSearchBox", { match: !noMatch }); this.highlight(); this.updateCounter(); }; this.updateCounter = function() { var editor = this.editor; var regex = editor.$search.$options.re; var all = 0; var before = 0; if (regex) { var value = this.searchRange ? editor.session.getTextRange(this.searchRange) : editor.getValue(); var offset = editor.session.doc.positionToIndex(editor.selection.anchor); if (this.searchRange) offset -= editor.session.doc.positionToIndex(this.searchRange.start); var last = regex.lastIndex = 0; var m; while ((m = regex.exec(value))) { all++; last = m.index; if (last <= offset) before++; if (all > MAX_COUNT) break; if (!m[0]) { regex.lastIndex = last += 1; if (last >= value.length) break; } } } this.searchCounter.textContent = before + " of " + (all > MAX_COUNT ? MAX_COUNT + "+" : all); }; this.findNext = function() { this.find(true, false); }; this.findPrev = function() { this.find(true, true); }; this.findAll = function(){ var range = this.editor.findAll(this.searchInput.value, { regExp: this.regExpOption.checked, caseSensitive: this.caseSensitiveOption.checked, wholeWord: this.wholeWordOption.checked }); var noMatch = !range && this.searchInput.value; dom.setCssClass(this.searchBox, "ace_nomatch", noMatch); this.editor._emit("findSearchBox", { match: !noMatch }); this.highlight(); this.hide(); }; this.replace = function() { if (!this.editor.getReadOnly()) this.editor.replace(this.replaceInput.value); }; this.replaceAndFindNext = function() { if (!this.editor.getReadOnly()) { this.editor.replace(this.replaceInput.value); this.findNext(); } }; this.replaceAll = function() { if (!this.editor.getReadOnly()) this.editor.replaceAll(this.replaceInput.value); }; this.hide = function() { this.active = false; this.setSearchRange(null); this.editor.off("changeSession", this.setSession); this.element.style.display = "none"; this.editor.keyBinding.removeKeyboardHandler(this.$closeSearchBarKb); this.editor.focus(); }; this.show = function(value, isReplace) { this.active = true; this.editor.on("changeSession", this.setSession); this.element.style.display = ""; this.replaceOption.checked = isReplace; if (value) this.searchInput.value = value; this.searchInput.focus(); this.searchInput.select(); this.editor.keyBinding.addKeyboardHandler(this.$closeSearchBarKb); this.$syncOptions(true); }; this.isFocused = function() { var el = document.activeElement; return el == this.searchInput || el == this.replaceInput; }; }).call(SearchBox.prototype); exports.SearchBox = SearchBox; exports.Search = function(editor, isReplace) { var sb = editor.searchBox || new SearchBox(editor); sb.show(editor.session.getTextRange(), isReplace); }; }); /* ------------------------------------------------------------------------------------------ * TODO * --------------------------------------------------------------------------------------- */ /* - move search form to the left if it masks current word - include all options that search has. ex: regex - searchbox.searchbox is not that pretty. We should have just searchbox - disable prev button if it makes sense */ ================================================ FILE: lib/ace/ext/settings_menu.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /*jslint indent: 4, maxerr: 50, white: true, browser: true, vars: true*/ /*global define, require */ /** * Show Settings Menu * @fileOverview Show Settings Menu
    * Displays an interactive settings menu mostly generated on the fly based on * the current state of the editor. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { "use strict"; var generateSettingsMenu = require('./menu_tools/generate_settings_menu').generateSettingsMenu; var overlayPage = require('./menu_tools/overlay_page').overlayPage; /** * This displays the settings menu if it is not already being shown. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ * @param {ace.Editor} editor An instance of the ace editor. */ function showSettingsMenu(editor) { // make sure the menu isn't open already. var sm = document.getElementById('ace_settingsmenu'); if (!sm) overlayPage(editor, generateSettingsMenu(editor), '0', '0', '0'); } /** * Initializes the settings menu extension. It adds the showSettingsMenu * method to the given editor object and adds the showSettingsMenu command * to the editor with appropriate keyboard shortcuts. * @param {ace.Editor} editor An instance of the Editor. */ module.exports.init = function(editor) { var Editor = require("ace/editor").Editor; Editor.prototype.showSettingsMenu = function() { showSettingsMenu(this); }; }; }); ================================================ FILE: lib/ace/ext/spellcheck.js ================================================ define(function(require, exports, module) { "use strict"; var event = require("../lib/event"); exports.contextMenuHandler = function(e){ var host = e.target; var text = host.textInput.getElement(); if (!host.selection.isEmpty()) return; var c = host.getCursorPosition(); var r = host.session.getWordRange(c.row, c.column); var w = host.session.getTextRange(r); host.session.tokenRe.lastIndex = 0; if (!host.session.tokenRe.test(w)) return; var PLACEHOLDER = "\x01\x01"; var value = w + " " + PLACEHOLDER; text.value = value; text.setSelectionRange(w.length, w.length + 1); text.setSelectionRange(0, 0); text.setSelectionRange(0, w.length); var afterKeydown = false; event.addListener(text, "keydown", function onKeydown() { event.removeListener(text, "keydown", onKeydown); afterKeydown = true; }); host.textInput.setInputHandler(function(newVal) { console.log(newVal , value, text.selectionStart, text.selectionEnd); if (newVal == value) return ''; if (newVal.lastIndexOf(value, 0) === 0) return newVal.slice(value.length); if (newVal.substr(text.selectionEnd) == value) return newVal.slice(0, -value.length); if (newVal.slice(-2) == PLACEHOLDER) { var val = newVal.slice(0, -2); if (val.slice(-1) == " ") { if (afterKeydown) return val.substring(0, text.selectionEnd); val = val.slice(0, -1); host.session.replace(r, val); return ""; } } return newVal; }); }; // todo support highlighting with typo.js var Editor = require("../editor").Editor; require("../config").defineOptions(Editor.prototype, "editor", { spellcheck: { set: function(val) { var text = this.textInput.getElement(); text.spellcheck = !!val; if (!val) this.removeListener("nativecontextmenu", exports.contextMenuHandler); else this.on("nativecontextmenu", exports.contextMenuHandler); }, value: true } }); }); ================================================ FILE: lib/ace/ext/split.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; /** * this is experimental, and subject to change, use at your own risk! */ module.exports = require("../split"); }); ================================================ FILE: lib/ace/ext/static.css ================================================ .ace_static_highlight { font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', 'Droid Sans Mono', monospace; font-size: 12px; white-space: pre-wrap } .ace_static_highlight .ace_gutter { width: 2em; text-align: right; padding: 0 3px 0 0; margin-right: 3px; } .ace_static_highlight.ace_show_gutter .ace_line { padding-left: 2.6em; } .ace_static_highlight .ace_line { position: relative; } .ace_static_highlight .ace_gutter-cell { -moz-user-select: -moz-none; -khtml-user-select: none; -webkit-user-select: none; user-select: none; top: 0; bottom: 0; left: 0; position: absolute; } .ace_static_highlight .ace_gutter-cell:before { content: counter(ace_line, decimal); counter-increment: ace_line; } .ace_static_highlight { counter-reset: ace_line; } ================================================ FILE: lib/ace/ext/static_highlight.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var EditSession = require("../edit_session").EditSession; var TextLayer = require("../layer/text").Text; var baseStyles = require("../requirejs/text!./static.css"); var config = require("../config"); var dom = require("../lib/dom"); var SimpleTextLayer = function() { this.config = {}; }; SimpleTextLayer.prototype = TextLayer.prototype; var highlight = function(el, opts, callback) { var m = el.className.match(/lang-(\w+)/); var mode = opts.mode || m && ("ace/mode/" + m[1]); if (!mode) return false; var theme = opts.theme || "ace/theme/textmate"; var data = ""; var nodes = []; if (el.firstElementChild) { var textLen = 0; for (var i = 0; i < el.childNodes.length; i++) { var ch = el.childNodes[i]; if (ch.nodeType == 3) { textLen += ch.data.length; data += ch.data; } else { nodes.push(textLen, ch); } } } else { data = dom.getInnerText(el); if (opts.trim) data = data.trim(); } highlight.render(data, mode, theme, opts.firstLineNumber, !opts.showGutter, function (highlighted) { dom.importCssString(highlighted.css, "ace_highlight"); el.innerHTML = highlighted.html; var container = el.firstChild.firstChild; for (var i = 0; i < nodes.length; i += 2) { var pos = highlighted.session.doc.indexToPosition(nodes[i]); var node = nodes[i + 1]; var lineEl = container.children[pos.row]; lineEl && lineEl.appendChild(node); } callback && callback(); }); }; /** * Transforms a given input code snippet into HTML using the given mode * * @param {string} input Code snippet * @param {string|mode} mode String specifying the mode to load such as * `ace/mode/javascript` or, a mode loaded from `/ace/mode` * (use 'ServerSideHiglighter.getMode'). * @param {string|theme} theme String specifying the theme to load such as * `ace/theme/twilight` or, a theme loaded from `/ace/theme`. * @param {number} lineStart A number indicating the first line number. Defaults * to 1. * @param {boolean} disableGutter Specifies whether or not to disable the gutter. * `true` disables the gutter, `false` enables the gutter. Defaults to `false`. * @param {function} callback When specifying the mode or theme as a string, * this method has no return value and you must specify a callback function. The * callback will receive the rendered object containing the properties `html` * and `css`. * @returns {object} An object containing the properties `html` and `css`. */ highlight.render = function(input, mode, theme, lineStart, disableGutter, callback) { var waiting = 1; var modeCache = EditSession.prototype.$modes; // if either the theme or the mode were specified as objects // then we need to lazily load them. if (typeof theme == "string") { waiting++; config.loadModule(['theme', theme], function(m) { theme = m; --waiting || done(); }); } // allow setting mode options e.h {path: "ace/mode/php", inline:true} var modeOptions; if (mode && typeof mode === "object" && !mode.getTokenizer) { modeOptions = mode; mode = modeOptions.path; } if (typeof mode == "string") { waiting++; config.loadModule(['mode', mode], function(m) { if (!modeCache[mode] || modeOptions) modeCache[mode] = new m.Mode(modeOptions); mode = modeCache[mode]; --waiting || done(); }); } // loads or passes the specified mode module then calls renderer function done() { var result = highlight.renderSync(input, mode, theme, lineStart, disableGutter); return callback ? callback(result) : result; } return --waiting || done(); }; /** * Transforms a given input code snippet into HTML using the given mode * @param {string} input Code snippet * @param {mode} mode Mode loaded from /ace/mode (use 'ServerSideHiglighter.getMode') * @param {string} r Code snippet * @returns {object} An object containing: html, css */ highlight.renderSync = function(input, mode, theme, lineStart, disableGutter) { lineStart = parseInt(lineStart || 1, 10); var session = new EditSession(""); session.setUseWorker(false); session.setMode(mode); var textLayer = new SimpleTextLayer(); textLayer.setSession(session); session.setValue(input); var stringBuilder = []; var length = session.getLength(); for(var ix = 0; ix < length; ix++) { stringBuilder.push("
    "); if (!disableGutter) stringBuilder.push("" + /*(ix + lineStart) + */ ""); textLayer.$renderLine(stringBuilder, ix, true, false); stringBuilder.push("\n
    "); } // let's prepare the whole html var html = "
    " + "
    " + stringBuilder.join("") + "
    " + "
    "; textLayer.destroy(); return { css: baseStyles + theme.cssText, html: html, session: session }; }; module.exports = highlight; module.exports.highlight = highlight; }); ================================================ FILE: lib/ace/ext/static_highlight_test.js ================================================ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var assert = require("assert"); var highlighter = require("./static_highlight"); var JavaScriptMode = require("../mode/javascript").Mode; var TextMode = require("../mode/text").Mode; // Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite module.exports = { timeout: 10000, "test loading in node": function(next) { assert.equal(typeof window, "undefined"); require("../ace"); next(); }, "test simple snippet": function(next) { var theme = require("../theme/tomorrow"); var snippet = [ "/** this is a function", "*", "*/", "function hello (a, b, c) {", " console.log(a * b + c + 'sup$');", "}" ].join("\n"); var mode = new JavaScriptMode(); var result = highlighter.render(snippet, mode, theme); assert.equal(result.html, "
    " + "
    /** this is a function\n
    " + "
    *\n
    " + "
    */\n
    " + "
    function hello (a, b, c) {\n
    " + "
    console.log(a * b + c + 'sup$');\n
    " + "
    }\n
    " + "
    "); assert.ok(!!result.css); next(); }, "test css from theme is used": function(next) { var theme = require("../theme/tomorrow"); var snippet = [ "/** this is a function", "*", "*/", "function hello (a, b, c) {", " console.log(a * b + c + 'sup?');", "}" ].join("\n"); var mode = new JavaScriptMode(); var result = highlighter.render(snippet, mode, theme); assert.ok(result.css.indexOf(theme.cssText) !== -1); next(); }, "test theme classname should be in output html": function(next) { var theme = require("../theme/tomorrow"); var snippet = [ "/** this is a function", "*", "*/", "function hello (a, b, c) {", " console.log(a * b + c + 'sup?');", "}" ].join("\n"); var mode = new JavaScriptMode(); var result = highlighter.render(snippet, mode, theme); assert.equal(!!result.html.match(/
    /), true); next(); }, "test js string replace specials": function(next) { var theme = require("../theme/tomorrow"); var snippet = "$'$1$2$$$&"; var mode = new TextMode(); var result = highlighter.render(snippet, mode, theme); assert.ok(result.html.indexOf(snippet) != -1); next(); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/ext/statusbar.js ================================================ define(function(require, exports, module) { "use strict"; /** simple statusbar **/ var dom = require("ace/lib/dom"); var lang = require("ace/lib/lang"); var StatusBar = function(editor, parentNode) { this.element = dom.createElement("div"); this.element.className = "ace_status-indicator"; this.element.style.cssText = "display: inline-block;"; parentNode.appendChild(this.element); var statusUpdate = lang.delayedCall(function(){ this.updateStatus(editor); }.bind(this)).schedule.bind(null, 100); editor.on("changeStatus", statusUpdate); editor.on("changeSelection", statusUpdate); editor.on("keyboardActivity", statusUpdate); }; (function(){ this.updateStatus = function(editor) { var status = []; function add(str, separator) { str && status.push(str, separator || "|"); } add(editor.keyBinding.getStatusText(editor)); if (editor.commands.recording) add("REC"); var sel = editor.selection; var c = sel.lead; if (!sel.isEmpty()) { var r = editor.getSelectionRange(); add("(" + (r.end.row - r.start.row) + ":" +(r.end.column - r.start.column) + ")", " "); } add(c.row + ":" + c.column, " "); if (sel.rangeCount) add("[" + sel.rangeCount + "]", " "); status.pop(); this.element.textContent = status.join(""); }; }).call(StatusBar.prototype); exports.StatusBar = StatusBar; }); ================================================ FILE: lib/ace/ext/textarea.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var event = require("../lib/event"); var UA = require("../lib/useragent"); var net = require("../lib/net"); var ace = require("../ace"); require("../theme/textmate"); module.exports = exports = ace; /* * Returns the CSS property of element. * 1) If the CSS property is on the style object of the element, use it, OR * 2) Compute the CSS property * * If the property can't get computed, is 'auto' or 'intrinsic', the former * calculated property is used (this can happen in cases where the textarea * is hidden and has no dimension styles). */ var getCSSProperty = function(element, container, property) { var ret = element.style[property]; if (!ret) { if (window.getComputedStyle) { ret = window.getComputedStyle(element, '').getPropertyValue(property); } else { ret = element.currentStyle[property]; } } if (!ret || ret == 'auto' || ret == 'intrinsic') { ret = container.style[property]; } return ret; }; function applyStyles(elm, styles) { for (var style in styles) { elm.style[style] = styles[style]; } } function setupContainer(element, getValue) { if (element.type != 'textarea') { throw new Error("Textarea required!"); } var parentNode = element.parentNode; // This will hold the editor. var container = document.createElement('div'); // To put Ace in the place of the textarea, we have to copy a few of the // textarea's style attributes to the div container. // // The problem is that the properties have to get computed (they might be // defined by a CSS file on the page - you can't access such rules that // apply to an element via elm.style). Computed properties are converted to // pixels although the dimension might be given as percentage. When the // window resizes, the dimensions defined by percentages changes, so the // properties have to get recomputed to get the new/true pixels. var resizeEvent = function() { var style = 'position:relative;'; [ 'margin-top', 'margin-left', 'margin-right', 'margin-bottom' ].forEach(function(item) { style += item + ':' + getCSSProperty(element, container, item) + ';'; }); // Calculating the width/height of the textarea is somewhat tricky. To // do it right, you have to include the paddings to the sides as well // (eg. width = width + padding-left, -right). This works well, as // long as the width of the element is not set or given in pixels. In // this case and after the textarea is hidden, getCSSProperty(element, // container, 'width') will still return pixel value. If the element // has realtiv dimensions (e.g. width='95') // getCSSProperty(...) will return pixel values only as long as the // textarea is visible. After it is hidden getCSSProperty will return // the relative dimensions as they are set on the element (in the case // of width, 95). // Making the sum of pixel vaules (e.g. padding) and realtive values // (e.g. ) is not possible. As such the padding styles are // ignored. // The complete width is the width of the textarea + the padding // to the left and right. var width = getCSSProperty(element, container, 'width') || (element.clientWidth + "px"); var height = getCSSProperty(element, container, 'height') || (element.clientHeight + "px"); style += 'height:' + height + ';width:' + width + ';'; // Set the display property to 'inline-block'. style += 'display:inline-block;'; container.setAttribute('style', style); }; event.addListener(window, 'resize', resizeEvent); // Call the resizeEvent once, so that the size of the container is // calculated. resizeEvent(); // Insert the div container after the element. parentNode.insertBefore(container, element.nextSibling); // Override the forms onsubmit function. Set the innerHTML and value // of the textarea before submitting. while (parentNode !== document) { if (parentNode.tagName.toUpperCase() === 'FORM') { var oldSumit = parentNode.onsubmit; // Override the onsubmit function of the form. parentNode.onsubmit = function(evt) { element.value = getValue(); // If there is a onsubmit function already, then call // it with the current context and pass the event. if (oldSumit) { oldSumit.call(this, evt); } }; break; } parentNode = parentNode.parentNode; } return container; } exports.transformTextarea = function(element, options) { var session; var container = setupContainer(element, function() { return session.getValue(); }); // Hide the element. element.style.display = 'none'; container.style.background = 'white'; // var editorDiv = document.createElement("div"); applyStyles(editorDiv, { top: "0px", left: "0px", right: "0px", bottom: "0px", border: "1px solid gray", position: "absolute" }); container.appendChild(editorDiv); var settingOpener = document.createElement("div"); applyStyles(settingOpener, { position: "absolute", right: "0px", bottom: "0px", background: "red", cursor: "nw-resize", borderStyle: "solid", borderWidth: "9px 8px 10px 9px", width: "2px", borderColor: "lightblue gray gray lightblue", zIndex: 101 }); var settingDiv = document.createElement("div"); var settingDivStyles = { top: "0px", left: "20%", right: "0px", bottom: "0px", position: "absolute", padding: "5px", zIndex: 100, color: "white", display: "none", overflow: "auto", fontSize: "14px", boxShadow: "-5px 2px 3px gray" }; if (!UA.isOldIE) { settingDivStyles.backgroundColor = "rgba(0, 0, 0, 0.6)"; } else { settingDivStyles.backgroundColor = "#333"; } applyStyles(settingDiv, settingDivStyles); container.appendChild(settingDiv); options = options || exports.defaultOptions; // Power up ace on the textarea: var editor = ace.edit(editorDiv); session = editor.getSession(); session.setValue(element.value || element.innerHTML); editor.focus(); // Add the settingPanel opener to the editor's div. container.appendChild(settingOpener); // Create the API. setupApi(editor, editorDiv, settingDiv, ace, options); // Create the setting's panel. setupSettingPanel(settingDiv, settingOpener, editor); var state = ""; event.addListener(settingOpener, "mousemove", function(e) { var rect = this.getBoundingClientRect(); var x = e.clientX - rect.left, y = e.clientY - rect.top; if (x + y < (rect.width + rect.height)/2) { this.style.cursor = "pointer"; state = "toggle"; } else { state = "resize"; this.style.cursor = "nw-resize"; } }); event.addListener(settingOpener, "mousedown", function(e) { if (state == "toggle") { editor.setDisplaySettings(); return; } container.style.zIndex = 100000; var rect = container.getBoundingClientRect(); var startX = rect.width + rect.left - e.clientX; var startY = rect.height + rect.top - e.clientY; event.capture(settingOpener, function(e) { container.style.width = e.clientX - rect.left + startX + "px"; container.style.height = e.clientY - rect.top + startY + "px"; editor.resize(); }, function() {}); }); return editor; }; function load(url, module, callback) { net.loadScript(url, function() { require([module], callback); }); } function setupApi(editor, editorDiv, settingDiv, ace, options) { var session = editor.getSession(); var renderer = editor.renderer; function toBool(value) { return value === "true" || value == true; } editor.setDisplaySettings = function(display) { if (display == null) display = settingDiv.style.display == "none"; if (display) { settingDiv.style.display = "block"; settingDiv.hideButton.focus(); editor.on("focus", function onFocus() { editor.removeListener("focus", onFocus); settingDiv.style.display = "none"; }); } else { editor.focus(); } }; editor.$setOption = editor.setOption; editor.$getOption = editor.getOption; editor.setOption = function(key, value) { switch (key) { case "mode": editor.$setOption("mode", "ace/mode/" + value); break; case "theme": editor.$setOption("theme", "ace/theme/" + value); break; case "keybindings": switch (value) { case "vim": editor.setKeyboardHandler("ace/keyboard/vim"); break; case "emacs": editor.setKeyboardHandler("ace/keyboard/emacs"); break; default: editor.setKeyboardHandler(null); } break; case "softWrap": case "fontSize": editor.$setOption(key, value); break; default: editor.$setOption(key, toBool(value)); } }; editor.getOption = function(key) { switch (key) { case "mode": return editor.$getOption("mode").substr("ace/mode/".length); break; case "theme": return editor.$getOption("theme").substr("ace/theme/".length); break; case "keybindings": var value = editor.getKeyboardHandler(); switch (value && value.$id) { case "ace/keyboard/vim": return "vim"; case "ace/keyboard/emacs": return "emacs"; default: return "ace"; } break; default: return editor.$getOption(key); } }; editor.setOptions(options); return editor; } function setupSettingPanel(settingDiv, settingOpener, editor) { var BOOL = null; var desc = { mode: "Mode:", wrap: "Soft Wrap:", theme: "Theme:", fontSize: "Font Size:", showGutter: "Display Gutter:", keybindings: "Keyboard", showPrintMargin: "Show Print Margin:", useSoftTabs: "Use Soft Tabs:", showInvisibles: "Show Invisibles" }; var optionValues = { mode: { text: "Plain", javascript: "JavaScript", xml: "XML", html: "HTML", css: "CSS", scss: "SCSS", python: "Python", php: "PHP", java: "Java", ruby: "Ruby", c_cpp: "C/C++", coffee: "CoffeeScript", json: "json", perl: "Perl", clojure: "Clojure", ocaml: "OCaml", csharp: "C#", haxe: "haXe", svg: "SVG", textile: "Textile", groovy: "Groovy", liquid: "Liquid", Scala: "Scala" }, theme: { clouds: "Clouds", clouds_midnight: "Clouds Midnight", cobalt: "Cobalt", crimson_editor: "Crimson Editor", dawn: "Dawn", gob: "Green on Black", eclipse: "Eclipse", idle_fingers: "Idle Fingers", kr_theme: "Kr Theme", merbivore: "Merbivore", merbivore_soft: "Merbivore Soft", mono_industrial: "Mono Industrial", monokai: "Monokai", pastel_on_dark: "Pastel On Dark", solarized_dark: "Solarized Dark", solarized_light: "Solarized Light", textmate: "Textmate", twilight: "Twilight", vibrant_ink: "Vibrant Ink" }, showGutter: BOOL, fontSize: { "10px": "10px", "11px": "11px", "12px": "12px", "14px": "14px", "16px": "16px" }, wrap: { off: "Off", 40: "40", 80: "80", free: "Free" }, keybindings: { ace: "ace", vim: "vim", emacs: "emacs" }, showPrintMargin: BOOL, useSoftTabs: BOOL, showInvisibles: BOOL }; var table = []; table.push(""); function renderOption(builder, option, obj, cValue) { if (!obj) { builder.push( "" ); return; } builder.push(""); } for (var option in exports.defaultOptions) { table.push(""); table.push(""); } table.push("
    SettingValue
    ", desc[option], ""); renderOption(table, option, optionValues[option], editor.getOption(option)); table.push("
    "); settingDiv.innerHTML = table.join(""); var onChange = function(e) { var select = e.currentTarget; editor.setOption(select.title, select.value); }; var onClick = function(e) { var cb = e.currentTarget; editor.setOption(cb.title, cb.checked); }; var selects = settingDiv.getElementsByTagName("select"); for (var i = 0; i < selects.length; i++) selects[i].onchange = onChange; var cbs = settingDiv.getElementsByTagName("input"); for (var i = 0; i < cbs.length; i++) cbs[i].onclick = onClick; var button = document.createElement("input"); button.type = "button"; button.value = "Hide"; event.addListener(button, "click", function() { editor.setDisplaySettings(false); }); settingDiv.appendChild(button); settingDiv.hideButton = button; } // Default startup options. exports.defaultOptions = { mode: "javascript", theme: "textmate", wrap: "off", fontSize: "12px", showGutter: "false", keybindings: "ace", showPrintMargin: "false", useSoftTabs: "true", showInvisibles: "false" }; }); ================================================ FILE: lib/ace/ext/themelist.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2013 Matthew Christopher Kastor-Inare III, Atropa Inc. Intl * All rights reserved. * * Contributed to Ajax.org under the BSD license. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /** * Generates a list of themes available when ace was built. * @fileOverview Generates a list of themes available when ace was built. * @author * Matthew Christopher Kastor-Inare III
    * ☭ Hial Atropa!! ☭ */ define(function(require, exports, module) { "use strict"; require("ace/lib/fixoldbrowsers"); var themeData = [ ["Chrome" ], ["Clouds" ], ["Crimson Editor" ], ["Dawn" ], ["Dreamweaver" ], ["Eclipse" ], ["GitHub" ], ["IPlastic" ], ["Solarized Light"], ["TextMate" ], ["Tomorrow" ], ["XCode" ], ["Kuroir"], ["KatzenMilch"], ["SQL Server" ,"sqlserver" , "light"], ["Ambiance" ,"ambiance" , "dark"], ["Chaos" ,"chaos" , "dark"], ["Clouds Midnight" ,"clouds_midnight" , "dark"], ["Cobalt" ,"cobalt" , "dark"], ["Gruvbox" ,"gruvbox" , "dark"], ["Green on Black" ,"gob" , "dark"], ["idle Fingers" ,"idle_fingers" , "dark"], ["krTheme" ,"kr_theme" , "dark"], ["Merbivore" ,"merbivore" , "dark"], ["Merbivore Soft" ,"merbivore_soft" , "dark"], ["Mono Industrial" ,"mono_industrial" , "dark"], ["Monokai" ,"monokai" , "dark"], ["Pastel on dark" ,"pastel_on_dark" , "dark"], ["Solarized Dark" ,"solarized_dark" , "dark"], ["Terminal" ,"terminal" , "dark"], ["Tomorrow Night" ,"tomorrow_night" , "dark"], ["Tomorrow Night Blue" ,"tomorrow_night_blue" , "dark"], ["Tomorrow Night Bright","tomorrow_night_bright" , "dark"], ["Tomorrow Night 80s" ,"tomorrow_night_eighties" , "dark"], ["Twilight" ,"twilight" , "dark"], ["Vibrant Ink" ,"vibrant_ink" , "dark"] ]; exports.themesByName = {}; /** * An array containing information about available themes. */ exports.themes = themeData.map(function(data) { var name = data[1] || data[0].replace(/ /g, "_").toLowerCase(); var theme = { caption: data[0], theme: "ace/theme/" + name, isDark: data[2] == "dark", name: name }; exports.themesByName[name] = theme; return theme; }); }); ================================================ FILE: lib/ace/ext/whitespace.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var lang = require("../lib/lang"); // based on http://www.freehackers.org/Indent_Finder exports.$detectIndentation = function(lines, fallback) { var stats = []; var changes = []; var tabIndents = 0; var prevSpaces = 0; var max = Math.min(lines.length, 1000); for (var i = 0; i < max; i++) { var line = lines[i]; // ignore empty and comment lines if (!/^\s*[^*+\-\s]/.test(line)) continue; if (line[0] == "\t") { tabIndents++; prevSpaces = -Number.MAX_VALUE; } else { var spaces = line.match(/^ */)[0].length; if (spaces && line[spaces] != "\t") { var diff = spaces - prevSpaces; if (diff > 0 && !(prevSpaces%diff) && !(spaces%diff)) changes[diff] = (changes[diff] || 0) + 1; stats[spaces] = (stats[spaces] || 0) + 1; } prevSpaces = spaces; } // ignore lines ending with backslash while (i < max && line[line.length - 1] == "\\") line = lines[i++]; } function getScore(indent) { var score = 0; for (var i = indent; i < stats.length; i += indent) score += stats[i] || 0; return score; } var changesTotal = changes.reduce(function(a,b){return a+b;}, 0); var first = {score: 0, length: 0}; var spaceIndents = 0; for (var i = 1; i < 12; i++) { var score = getScore(i); if (i == 1) { spaceIndents = score; score = stats[1] ? 0.9 : 0.8; if (!stats.length) score = 0; } else score /= spaceIndents; if (changes[i]) score += changes[i] / changesTotal; if (score > first.score) first = {score: score, length: i}; } if (first.score && first.score > 1.4) var tabLength = first.length; if (tabIndents > spaceIndents + 1) { if (tabLength == 1 || spaceIndents < tabIndents / 4 || first.score < 1.8) tabLength = undefined; return {ch: "\t", length: tabLength}; } if (spaceIndents > tabIndents + 1) return {ch: " ", length: tabLength}; }; exports.detectIndentation = function(session) { var lines = session.getLines(0, 1000); var indent = exports.$detectIndentation(lines) || {}; if (indent.ch) session.setUseSoftTabs(indent.ch == " "); if (indent.length) session.setTabSize(indent.length); return indent; }; /** * EditSession session * options.trimEmpty trim empty lines too * options.keepCursorPosition do not trim whitespace before the cursor */ exports.trimTrailingSpace = function(session, options) { var doc = session.getDocument(); var lines = doc.getAllLines(); var min = options && options.trimEmpty ? -1 : 0; var cursors = [], ci = -1; if (options && options.keepCursorPosition) { if (session.selection.rangeCount) { session.selection.rangeList.ranges.forEach(function(x, i, ranges) { var next = ranges[i + 1]; if (next && next.cursor.row == x.cursor.row) return; cursors.push(x.cursor); }); } else { cursors.push(session.selection.getCursor()); } ci = 0; } var cursorRow = cursors[ci] && cursors[ci].row; for (var i = 0, l=lines.length; i < l; i++) { var line = lines[i]; var index = line.search(/\s+$/); if (i == cursorRow) { if (index < cursors[ci].column && index > min) index = cursors[ci].column; ci++; cursorRow = cursors[ci] ? cursors[ci].row : -1; } if (index > min) doc.removeInLine(i, index, line.length); } }; exports.convertIndentation = function(session, ch, len) { var oldCh = session.getTabString()[0]; var oldLen = session.getTabSize(); if (!len) len = oldLen; if (!ch) ch = oldCh; var tab = ch == "\t" ? ch: lang.stringRepeat(ch, len); var doc = session.doc; var lines = doc.getAllLines(); var cache = {}; var spaceCache = {}; for (var i = 0, l=lines.length; i < l; i++) { var line = lines[i]; var match = line.match(/^\s*/)[0]; if (match) { var w = session.$getStringScreenWidth(match)[0]; var tabCount = Math.floor(w/oldLen); var reminder = w%oldLen; var toInsert = cache[tabCount] || (cache[tabCount] = lang.stringRepeat(tab, tabCount)); toInsert += spaceCache[reminder] || (spaceCache[reminder] = lang.stringRepeat(" ", reminder)); if (toInsert != match) { doc.removeInLine(i, 0, match.length); doc.insertInLine({row: i, column: 0}, toInsert); } } } session.setTabSize(len); session.setUseSoftTabs(ch == " "); }; exports.$parseStringArg = function(text) { var indent = {}; if (/t/.test(text)) indent.ch = "\t"; else if (/s/.test(text)) indent.ch = " "; var m = text.match(/\d+/); if (m) indent.length = parseInt(m[0], 10); return indent; }; exports.$parseArg = function(arg) { if (!arg) return {}; if (typeof arg == "string") return exports.$parseStringArg(arg); if (typeof arg.text == "string") return exports.$parseStringArg(arg.text); return arg; }; exports.commands = [{ name: "detectIndentation", exec: function(editor) { exports.detectIndentation(editor.session); // todo show message? } }, { name: "trimTrailingSpace", exec: function(editor) { exports.trimTrailingSpace(editor.session); } }, { name: "convertIndentation", exec: function(editor, arg) { var indent = exports.$parseArg(arg); exports.convertIndentation(editor.session, indent.ch, indent.length); } }, { name: "setIndentation", exec: function(editor, arg) { var indent = exports.$parseArg(arg); indent.length && editor.session.setTabSize(indent.length); indent.ch && editor.session.setUseSoftTabs(indent.ch == " "); } }]; }); ================================================ FILE: lib/ace/ext/whitespace_test.js ================================================ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; require("../multi_select"); var assert = require("assert"); var EditSession = require("../edit_session").EditSession; var UndoManager = require("../undomanager").UndoManager; var whitespace = require("./whitespace"); // Execution ORDER: test.setUpSuite, setUp, testFn, tearDown, test.tearDownSuite module.exports = { timeout: 10000, "test tab detection": function(next) { var s = new EditSession([ "define({", "\tfoo:1,", "\tbar:2,", "\tbaz:{,", "\t\tx:3", "\t}", "})" ]); var indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, "\t"); assert.equal(indent.length, undefined); s.insert({row: 0, column: 0}, " "); indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, "\t"); assert.equal(indent.length, undefined); s.doc.removeInLine(0, 0, 2); s.insert({row: 0, column: 0}, "x\n y\n z\n"); indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, "\t"); assert.equal(indent.length, 4); s.setValue(""); indent = whitespace.$detectIndentation(s.doc.$lines); assert.ok(!indent); next(); }, "test empty session": function(next) { var s = new EditSession([ "define({", "foo:1,", "})" ]); var indent = whitespace.$detectIndentation(s.doc.$lines); assert.ok(!indent); s.insert({row: 1, column: 0}, " x\n "); indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, " "); assert.equal(indent.length, 4); next(); }, "!test one line": function(next) { var s = new EditSession([ "define({", " foo:1,", "})" ]); var indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, " "); assert.equal(indent.length, 4); next(); }, "test 1 width indents": function(next) { var s = new EditSession([ "define({", " foo:1,", "})", "define({", " bar:1,", "})", " t", " t", " t", " t", " t", " t", " t", " t" ]); var indent = whitespace.$detectIndentation(s.doc.$lines); // assert.equal(indent.ch, " "); // assert.equal(indent.length, 4); s = new EditSession([ "{", " foo:1,", " bar: {", " baz:2", " }", "}" ]); indent = whitespace.$detectIndentation(s.doc.$lines); assert.equal(indent.ch, " "); assert.equal(indent.length, 1); next(); }, "test trimTrailingSpace": function(next) { var session = new EditSession([ "a", "\t b \t", " ", "\t", "\t\tx\t\t", " ", " " ]); session.setUndoManager(new UndoManager()); function testOne(value, options) { console.log(JSON.stringify(session.getValue())); whitespace.trimTrailingSpace(session, options); assert.equal(value, session.getValue()); session.markUndoGroup(); session.getUndoManager().undo(); } testOne("a\n\t b\n \n\t\n\t\tx\n \n "); testOne("a\n\t b\n\n\n\t\tx\n\n", { trimEmpty: true }); session.selection.fromJSON([{ start: {row:2,column:3}, end: {row:4,column:4} }]); testOne("a\n\t b\n\n\n\t\tx\t\n\n", { keepCursorPosition: true, trimEmpty: true }); session.selection.fromJSON([{ start: {row:2,column:3}, end: {row:4,column:4}, isBackwards: true }]); testOne("a\n\t b\n \n\n\t\tx\n\n", { keepCursorPosition: true, trimEmpty: true }); session.selection.$initRangeList(); session.selection.fromJSON([{ start: {row:2, column:3}, end: {row:2,column:3} }, { start: {row:1, column:1}, end: {row:1, column:1} }, { start: {row:2,column:2}, end: {row:2,column:2} }, { start: {row:0,column:5}, end: {row:0,column:5}, isBackwards:false }, { start: {row:6,column:1}, end: {row:6,column:1}, isBackwards:false }]); testOne("a\n\t b\n \n\n\t\tx\n\n ", { trimEmpty: true, keepCursorPosition: true }); session.setValue("some text"); session.selection.fromJSON([{ start: {row:0,column:4}, end: {row:0,column:4} }]); testOne("some text", { keepCursorPosition: true, trimEmpty: true }); next(); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/incremental_search.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var Range = require("./range").Range; var Search = require("./search").Search; var SearchHighlight = require("./search_highlight").SearchHighlight; var iSearchCommandModule = require("./commands/incremental_search_commands"); var ISearchKbd = iSearchCommandModule.IncrementalSearchKeyboardHandler; /** * @class IncrementalSearch * * Implements immediate searching while the user is typing. When incremental * search is activated, keystrokes into the editor will be used for composing * a search term. Immediately after every keystroke the search is updated: * - so-far-matching characters are highlighted * - the cursor is moved to the next match * **/ /** * * * Creates a new `IncrementalSearch` object. * * @constructor **/ function IncrementalSearch() { this.$options = {wrap: false, skipCurrent: false}; this.$keyboardHandler = new ISearchKbd(this); } oop.inherits(IncrementalSearch, Search); // regexp handling function isRegExp(obj) { return obj instanceof RegExp; } function regExpToObject(re) { var string = String(re), start = string.indexOf('/'), flagStart = string.lastIndexOf('/'); return { expression: string.slice(start+1, flagStart), flags: string.slice(flagStart+1) }; } function stringToRegExp(string, flags) { try { return new RegExp(string, flags); } catch (e) { return string; } } function objectToRegExp(obj) { return stringToRegExp(obj.expression, obj.flags); } // iSearch class (function() { this.activate = function(ed, backwards) { this.$editor = ed; this.$startPos = this.$currentPos = ed.getCursorPosition(); this.$options.needle = ''; this.$options.backwards = backwards; ed.keyBinding.addKeyboardHandler(this.$keyboardHandler); // we need to completely intercept paste, just registering an event handler does not work this.$originalEditorOnPaste = ed.onPaste; ed.onPaste = this.onPaste.bind(this); this.$mousedownHandler = ed.addEventListener('mousedown', this.onMouseDown.bind(this)); this.selectionFix(ed); this.statusMessage(true); }; this.deactivate = function(reset) { this.cancelSearch(reset); var ed = this.$editor; ed.keyBinding.removeKeyboardHandler(this.$keyboardHandler); if (this.$mousedownHandler) { ed.removeEventListener('mousedown', this.$mousedownHandler); delete this.$mousedownHandler; } ed.onPaste = this.$originalEditorOnPaste; this.message(''); }; this.selectionFix = function(editor) { // Fix selection bug: When clicked inside the editor // editor.selection.$isEmpty is false even if the mouse click did not // open a selection. This is interpreted by the move commands to // extend the selection. To only extend the selection when there is // one, we clear it here if (editor.selection.isEmpty() && !editor.session.$emacsMark) { editor.clearSelection(); } }; this.highlight = function(regexp) { var sess = this.$editor.session, hl = sess.$isearchHighlight = sess.$isearchHighlight || sess.addDynamicMarker( new SearchHighlight(null, "ace_isearch-result", "text")); hl.setRegexp(regexp); sess._emit("changeBackMarker"); // force highlight layer redraw }; this.cancelSearch = function(reset) { var e = this.$editor; this.$prevNeedle = this.$options.needle; this.$options.needle = ''; if (reset) { e.moveCursorToPosition(this.$startPos); this.$currentPos = this.$startPos; } else { e.pushEmacsMark && e.pushEmacsMark(this.$startPos, false); } this.highlight(null); return Range.fromPoints(this.$currentPos, this.$currentPos); }; this.highlightAndFindWithNeedle = function(moveToNext, needleUpdateFunc) { if (!this.$editor) return null; var options = this.$options; // get search term if (needleUpdateFunc) { options.needle = needleUpdateFunc.call(this, options.needle || '') || ''; } if (options.needle.length === 0) { this.statusMessage(true); return this.cancelSearch(true); } // try to find the next occurrence and enable highlighting marker options.start = this.$currentPos; var session = this.$editor.session, found = this.find(session), shouldSelect = this.$editor.emacsMark ? !!this.$editor.emacsMark() : !this.$editor.selection.isEmpty(); if (found) { if (options.backwards) found = Range.fromPoints(found.end, found.start); this.$editor.selection.setRange(Range.fromPoints(shouldSelect ? this.$startPos : found.end, found.end)); if (moveToNext) this.$currentPos = found.end; // highlight after cursor move, so selection works properly this.highlight(options.re); } this.statusMessage(found); return found; }; this.addString = function(s) { return this.highlightAndFindWithNeedle(false, function(needle) { if (!isRegExp(needle)) return needle + s; var reObj = regExpToObject(needle); reObj.expression += s; return objectToRegExp(reObj); }); }; this.removeChar = function(c) { return this.highlightAndFindWithNeedle(false, function(needle) { if (!isRegExp(needle)) return needle.substring(0, needle.length-1); var reObj = regExpToObject(needle); reObj.expression = reObj.expression.substring(0, reObj.expression.length-1); return objectToRegExp(reObj); }); }; this.next = function(options) { // try to find the next occurrence of whatever we have searched for // earlier. // options = {[backwards: BOOL], [useCurrentOrPrevSearch: BOOL]} options = options || {}; this.$options.backwards = !!options.backwards; this.$currentPos = this.$editor.getCursorPosition(); return this.highlightAndFindWithNeedle(true, function(needle) { return options.useCurrentOrPrevSearch && needle.length === 0 ? this.$prevNeedle || '' : needle; }); }; this.onMouseDown = function(evt) { // when mouse interaction happens then we quit incremental search this.deactivate(); return true; }; this.onPaste = function(text) { this.addString(text); }; this.convertNeedleToRegExp = function() { return this.highlightAndFindWithNeedle(false, function(needle) { return isRegExp(needle) ? needle : stringToRegExp(needle, 'ig'); }); }; this.convertNeedleToString = function() { return this.highlightAndFindWithNeedle(false, function(needle) { return isRegExp(needle) ? regExpToObject(needle).expression : needle; }); }; this.statusMessage = function(found) { var options = this.$options, msg = ''; msg += options.backwards ? 'reverse-' : ''; msg += 'isearch: ' + options.needle; msg += found ? '' : ' (not found)'; this.message(msg); }; this.message = function(msg) { if (this.$editor.showCommandLine) { this.$editor.showCommandLine(msg); this.$editor.focus(); } else { console.log(msg); } }; }).call(IncrementalSearch.prototype); exports.IncrementalSearch = IncrementalSearch; /** * * Config settings for enabling/disabling [[IncrementalSearch `IncrementalSearch`]]. * **/ var dom = require('./lib/dom'); dom.importCssString && dom.importCssString("\ .ace_marker-layer .ace_isearch-result {\ position: absolute;\ z-index: 6;\ -moz-box-sizing: border-box;\ -webkit-box-sizing: border-box;\ box-sizing: border-box;\ }\ div.ace_isearch-result {\ border-radius: 4px;\ background-color: rgba(255, 200, 0, 0.5);\ box-shadow: 0 0 4px rgb(255, 200, 0);\ }\ .ace_dark div.ace_isearch-result {\ background-color: rgb(100, 110, 160);\ box-shadow: 0 0 4px rgb(80, 90, 140);\ }", "incremental-search-highlighting"); // support for default keyboard handler var commands = require("./commands/command_manager"); (function() { this.setupIncrementalSearch = function(editor, val) { if (this.usesIncrementalSearch == val) return; this.usesIncrementalSearch = val; var iSearchCommands = iSearchCommandModule.iSearchStartCommands; var method = val ? 'addCommands' : 'removeCommands'; this[method](iSearchCommands); }; }).call(commands.CommandManager.prototype); // incremental search config option var Editor = require("./editor").Editor; require("./config").defineOptions(Editor.prototype, "editor", { useIncrementalSearch: { set: function(val) { this.keyBinding.$handlers.forEach(function(handler) { if (handler.setupIncrementalSearch) { handler.setupIncrementalSearch(this, val); } }); this._emit('incrementalSearchSettingChanged', {isEnabled: val}); } } }); }); ================================================ FILE: lib/ace/incremental_search_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var emacs = require('./keyboard/emacs'); var EditSession = require("./edit_session").EditSession; var Editor = require("./editor").Editor; var MockRenderer = require("./test/mockrenderer").MockRenderer; var Range = require("./range").Range; var MultiSelect = require("./multi_select").MultiSelect; var assert = require("./test/assertions"); var IncrementalSearch = require("./incremental_search").IncrementalSearch; require("./multi_select"); var editor, iSearch; function testRanges(str, ranges) { ranges = ranges || editor.selection.getAllRanges(); assert.equal(ranges + "", str + ""); } // force "rerender" function callHighlighterUpdate() { var session = editor.session, ranges = [], mockMarkerLayer = { drawSingleLineMarker: function(_, markerRanges) { ranges = ranges.concat(markerRanges); } }; session.$isearchHighlight.update([], mockMarkerLayer, session, { firstRow: 0, lastRow: session.getRowLength()}); return ranges; } module.exports = { name: "ACE incremental_search.js", setUp: function() { var session = new EditSession(["abc123", "xyz124"]); editor = new Editor(new MockRenderer(), session); new MultiSelect(editor); iSearch = new IncrementalSearch(); }, "test: keyboard handler setup" : function() { iSearch.activate(editor); assert.equal(editor.getKeyboardHandler(), iSearch.$keyboardHandler); iSearch.deactivate(); assert.notEqual(editor.getKeyboardHandler(), iSearch.$keyboardHandler); }, "test: isearch highlight setup" : function() { var sess = editor.session; iSearch.activate(editor); iSearch.highlight('foo'); var highl = sess.$isearchHighlight.id; assert.ok(sess.$isearchHighlight, 'session has no isearch highlighter'); assert.equal(sess.getMarkers()[highl.id], highl.id, 'isearch highlight not in markers'); iSearch.deactivate(); iSearch.activate(editor); iSearch.highlight('bar'); var highl2 = sess.$isearchHighlight.id; assert.equal(highl2, highl, 'multiple isearch highlights'); }, "test: find simple text incrementally" : function() { iSearch.activate(editor); var range = iSearch.addString('1'), // "1" highlightRanges = callHighlighterUpdate(); testRanges("Range: [0/3] -> [0/4]", [range]); testRanges("Range: [0/3] -> [0/4],Range: [1/3] -> [1/4]", highlightRanges); range = iSearch.addString('2'); // "12" highlightRanges = callHighlighterUpdate(); testRanges("Range: [0/3] -> [0/5]", [range]); testRanges("Range: [0/3] -> [0/5],Range: [1/3] -> [1/5]", highlightRanges); range = iSearch.addString('3'); // "123" highlightRanges = callHighlighterUpdate(); testRanges("Range: [0/3] -> [0/6]", [range]); testRanges("Range: [0/3] -> [0/6]", highlightRanges); range = iSearch.removeChar(); // "12" highlightRanges = callHighlighterUpdate(); testRanges("Range: [0/3] -> [0/5]", [range]); testRanges("Range: [0/3] -> [0/5],Range: [1/3] -> [1/5]", highlightRanges); }, "test: forward / backward" : function() { iSearch.activate(editor); iSearch.addString('1'); iSearch.addString('2'); var range = iSearch.next(); testRanges("Range: [1/3] -> [1/5]", [range]); range = iSearch.next(); // nothing to find testRanges("", [range]); range = iSearch.next({backwards: true}); // backwards testRanges("Range: [1/5] -> [1/3]", [range]); }, "test: cancelSearch" : function() { iSearch.activate(editor); iSearch.addString('1'); iSearch.addString('2'); var range = iSearch.cancelSearch(true); testRanges("Range: [0/0] -> [0/0]", [range]); iSearch.addString('1'); range = iSearch.addString('2'); testRanges("Range: [0/3] -> [0/5]", [range]); }, "test: failing search keeps pos" : function() { iSearch.activate(editor); iSearch.addString('1'); iSearch.addString('2'); var range = iSearch.addString('x'); testRanges("", [range]); assert.position(editor.getCursorPosition(), 0, 5); }, "test: backwards search" : function() { editor.moveCursorTo(1,0); iSearch.activate(editor, true); iSearch.addString('1'); var range = iSearch.addString('2'); testRanges("Range: [0/5] -> [0/3]", [range]); assert.position(editor.getCursorPosition(), 0, 3); }, "test: forwards then backwards, same result, reoriented range" : function() { iSearch.activate(editor); iSearch.addString('1'); var range = iSearch.addString('2'); testRanges("Range: [0/3] -> [0/5]", [range]); assert.position(editor.getCursorPosition(), 0, 5); range = iSearch.next({backwards: true}); testRanges("Range: [0/5] -> [0/3]", [range]); assert.position(editor.getCursorPosition(), 0, 3); }, "test: reuse prev search via option" : function() { iSearch.activate(editor); iSearch.addString('1'); iSearch.addString('2'); assert.position(editor.getCursorPosition(), 0, 5); iSearch.deactivate(); iSearch.activate(editor); iSearch.next({backwards: false, useCurrentOrPrevSearch: true}); assert.position(editor.getCursorPosition(), 1, 5); }, "test: don't extend selection range if selection is empty" : function() { iSearch.activate(editor); iSearch.addString('1'); iSearch.addString('2'); testRanges("Range: [0/5] -> [0/5]", [editor.getSelectionRange()]); }, "test: extend selection range if selection exists" : function() { iSearch.activate(editor); editor.selection.selectTo(0, 1); iSearch.addString('1'); iSearch.addString('2'); testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()]); }, "test: extend selection in emacs mark mode" : function() { var emacs = require('./keyboard/emacs'); editor.keyBinding.addKeyboardHandler(emacs.handler); emacs.handler.commands.setMark.exec(editor); iSearch.activate(editor); iSearch.addString('1'); iSearch.addString('2'); testRanges("Range: [0/0] -> [0/5]", [editor.getSelectionRange()]); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/keyboard/emacs.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("../lib/dom"); require("../incremental_search"); var iSearchCommandModule = require("../commands/incremental_search_commands"); var screenToTextBlockCoordinates = function(x, y) { var canvasPos = this.scroller.getBoundingClientRect(); var offsetX = x + this.scrollLeft - canvasPos.left - this.$padding; var col = Math.floor(offsetX / this.characterWidth); var row = Math.floor( (y + this.scrollTop - canvasPos.top) / this.lineHeight ); return this.session.screenToDocumentPosition(row, col, offsetX); }; var HashHandler = require("./hash_handler").HashHandler; exports.handler = new HashHandler(); exports.handler.isEmacs = true; exports.handler.$id = "ace/keyboard/emacs"; var initialized = false; var $formerLongWords; var $formerLineStart; exports.handler.attach = function(editor) { if (!initialized) { initialized = true; dom.importCssString('\ .emacs-mode .ace_cursor{\ border: 1px rgba(50,250,50,0.8) solid!important;\ -moz-box-sizing: border-box!important;\ -webkit-box-sizing: border-box!important;\ box-sizing: border-box!important;\ background-color: rgba(0,250,0,0.9);\ opacity: 0.5;\ }\ .emacs-mode .ace_hidden-cursors .ace_cursor{\ opacity: 1;\ background-color: transparent;\ }\ .emacs-mode .ace_overwrite-cursors .ace_cursor {\ opacity: 1;\ background-color: transparent;\ border-width: 0 0 2px 2px !important;\ }\ .emacs-mode .ace_text-layer {\ z-index: 4\ }\ .emacs-mode .ace_cursor-layer {\ z-index: 2\ }', 'emacsMode' ); } // in emacs, gotowordleft/right should not count a space as a word.. $formerLongWords = editor.session.$selectLongWords; editor.session.$selectLongWords = true; // CTRL-A should go to actual beginning of line $formerLineStart = editor.session.$useEmacsStyleLineStart; editor.session.$useEmacsStyleLineStart = true; editor.session.$emacsMark = null; // the active mark editor.session.$emacsMarkRing = editor.session.$emacsMarkRing || []; editor.emacsMark = function() { return this.session.$emacsMark; }; editor.setEmacsMark = function(p) { // to deactivate pass in a falsy value this.session.$emacsMark = p; }; editor.pushEmacsMark = function(p, activate) { var prevMark = this.session.$emacsMark; if (prevMark) this.session.$emacsMarkRing.push(prevMark); if (!p || activate) this.setEmacsMark(p); else this.session.$emacsMarkRing.push(p); }; editor.popEmacsMark = function() { var mark = this.emacsMark(); if (mark) { this.setEmacsMark(null); return mark; } return this.session.$emacsMarkRing.pop(); }; editor.getLastEmacsMark = function(p) { return this.session.$emacsMark || this.session.$emacsMarkRing.slice(-1)[0]; }; editor.emacsMarkForSelection = function(replacement) { // find the mark in $emacsMarkRing corresponding to the current // selection var sel = this.selection, multiRangeLength = this.multiSelect ? this.multiSelect.getAllRanges().length : 1, selIndex = sel.index || 0, markRing = this.session.$emacsMarkRing, markIndex = markRing.length - (multiRangeLength - selIndex), lastMark = markRing[markIndex] || sel.anchor; if (replacement) { markRing.splice(markIndex, 1, "row" in replacement && "column" in replacement ? replacement : undefined); } return lastMark; }; editor.on("click", $resetMarkMode); editor.on("changeSession", $kbSessionChange); editor.renderer.screenToTextCoordinates = screenToTextBlockCoordinates; editor.setStyle("emacs-mode"); editor.commands.addCommands(commands); exports.handler.platform = editor.commands.platform; editor.$emacsModeHandler = this; editor.addEventListener('copy', this.onCopy); editor.addEventListener('paste', this.onPaste); }; exports.handler.detach = function(editor) { delete editor.renderer.screenToTextCoordinates; editor.session.$selectLongWords = $formerLongWords; editor.session.$useEmacsStyleLineStart = $formerLineStart; editor.removeEventListener("click", $resetMarkMode); editor.removeEventListener("changeSession", $kbSessionChange); editor.unsetStyle("emacs-mode"); editor.commands.removeCommands(commands); editor.removeEventListener('copy', this.onCopy); editor.removeEventListener('paste', this.onPaste); editor.$emacsModeHandler = null; }; var $kbSessionChange = function(e) { if (e.oldSession) { e.oldSession.$selectLongWords = $formerLongWords; e.oldSession.$useEmacsStyleLineStart = $formerLineStart; } $formerLongWords = e.session.$selectLongWords; e.session.$selectLongWords = true; $formerLineStart = e.session.$useEmacsStyleLineStart; e.session.$useEmacsStyleLineStart = true; if (!e.session.hasOwnProperty('$emacsMark')) e.session.$emacsMark = null; if (!e.session.hasOwnProperty('$emacsMarkRing')) e.session.$emacsMarkRing = []; }; var $resetMarkMode = function(e) { e.editor.session.$emacsMark = null; }; var keys = require("../lib/keys").KEY_MODS; var eMods = {C: "ctrl", S: "shift", M: "alt", CMD: "command"}; var combinations = ["C-S-M-CMD", "S-M-CMD", "C-M-CMD", "C-S-CMD", "C-S-M", "M-CMD", "S-CMD", "S-M", "C-CMD", "C-M", "C-S", "CMD", "M", "S", "C"]; combinations.forEach(function(c) { var hashId = 0; c.split("-").forEach(function(c) { hashId = hashId | keys[eMods[c]]; }); eMods[hashId] = c.toLowerCase() + "-"; }); exports.handler.onCopy = function(e, editor) { if (editor.$handlesEmacsOnCopy) return; editor.$handlesEmacsOnCopy = true; exports.handler.commands.killRingSave.exec(editor); editor.$handlesEmacsOnCopy = false; }; exports.handler.onPaste = function(e, editor) { editor.pushEmacsMark(editor.getCursorPosition()); }; exports.handler.bindKey = function(key, command) { if (typeof key == "object") key = key[this.platform]; if (!key) return; var ckb = this.commandKeyBinding; key.split("|").forEach(function(keyPart) { keyPart = keyPart.toLowerCase(); ckb[keyPart] = command; // register all partial key combos as null commands // to be able to activate key combos with arbitrary length // Example: if keyPart is "C-c C-l t" then "C-c C-l t" will // get command assigned and "C-c" and "C-c C-l" will get // a null command assigned in this.commandKeyBinding. For // the lookup logic see handleKeyboard() var keyParts = keyPart.split(" ").slice(0,-1); keyParts.reduce(function(keyMapKeys, keyPart, i) { var prefix = keyMapKeys[i-1] ? keyMapKeys[i-1] + ' ' : ''; return keyMapKeys.concat([prefix + keyPart]); }, []).forEach(function(keyPart) { if (!ckb[keyPart]) ckb[keyPart] = "null"; }); }, this); }; exports.handler.getStatusText = function(editor, data) { var str = ""; if (data.count) str += data.count; if (data.keyChain) str += " " + data.keyChain; return str; }; exports.handler.handleKeyboard = function(data, hashId, key, keyCode) { // if keyCode == -1 a non-printable key was pressed, such as just // control. Handling those is currently not supported in this handler if (keyCode === -1) return undefined; var editor = data.editor; editor._signal("changeStatus"); // insertstring data.count times if (hashId == -1) { editor.pushEmacsMark(); if (data.count) { var str = new Array(data.count + 1).join(key); data.count = null; return {command: "insertstring", args: str}; } } var modifier = eMods[hashId]; // CTRL + number / universalArgument for setting data.count if (modifier == "c-" || data.count) { var count = parseInt(key[key.length - 1]); if (typeof count === 'number' && !isNaN(count)) { data.count = Math.max(data.count, 0) || 0; data.count = 10 * data.count + count; return {command: "null"}; } } // this.commandKeyBinding maps key specs like "c-p" (for CTRL + P) to // command objects, for lookup key needs to include the modifier if (modifier) key = modifier + key; // Key combos like CTRL+X H build up the data.keyChain if (data.keyChain) key = data.keyChain += " " + key; // Key combo prefixes get stored as "null" (String!) in this // this.commandKeyBinding. When encountered no command is invoked but we // buld up data.keyChain var command = this.commandKeyBinding[key]; data.keyChain = command == "null" ? key : ""; // there really is no command if (!command) return undefined; // we pass b/c of key combo or universalArgument if (command === "null") return {command: "null"}; if (command === "universalArgument") { // if no number pressed emacs repeats action 4 times. // minus sign is needed to allow next keypress to replace it data.count = -4; return {command: "null"}; } // lookup command // TODO extract special handling of markmode // TODO special case command.command is really unnecessary, remove var args; if (typeof command !== "string") { args = command.args; if (command.command) command = command.command; if (command === "goorselect") { command = editor.emacsMark() ? args[1] : args[0]; args = null; } } if (typeof command === "string") { if (command === "insertstring" || command === "splitline" || command === "togglecomment") { editor.pushEmacsMark(); } command = this.commands[command] || editor.commands.commands[command]; if (!command) return undefined; } if (!command.readOnly && !command.isYank) data.lastCommand = null; if (!command.readOnly && editor.emacsMark()) editor.setEmacsMark(null); if (data.count) { var count = data.count; data.count = 0; if (!command || !command.handlesCount) { return { args: args, command: { exec: function(editor, args) { for (var i = 0; i < count; i++) command.exec(editor, args); }, multiSelectAction: command.multiSelectAction } }; } else { if (!args) args = {}; if (typeof args === 'object') args.count = count; } } return {command: command, args: args}; }; exports.emacsKeys = { // movement "Up|C-p" : {command: "goorselect", args: ["golineup","selectup"]}, "Down|C-n" : {command: "goorselect", args: ["golinedown","selectdown"]}, "Left|C-b" : {command: "goorselect", args: ["gotoleft","selectleft"]}, "Right|C-f" : {command: "goorselect", args: ["gotoright","selectright"]}, "C-Left|M-b" : {command: "goorselect", args: ["gotowordleft","selectwordleft"]}, "C-Right|M-f" : {command: "goorselect", args: ["gotowordright","selectwordright"]}, "Home|C-a" : {command: "goorselect", args: ["gotolinestart","selecttolinestart"]}, "End|C-e" : {command: "goorselect", args: ["gotolineend","selecttolineend"]}, "C-Home|S-M-,": {command: "goorselect", args: ["gotostart","selecttostart"]}, "C-End|S-M-." : {command: "goorselect", args: ["gotoend","selecttoend"]}, // selection "S-Up|S-C-p" : "selectup", "S-Down|S-C-n" : "selectdown", "S-Left|S-C-b" : "selectleft", "S-Right|S-C-f" : "selectright", "S-C-Left|S-M-b" : "selectwordleft", "S-C-Right|S-M-f" : "selectwordright", "S-Home|S-C-a" : "selecttolinestart", "S-End|S-C-e" : "selecttolineend", "S-C-Home" : "selecttostart", "S-C-End" : "selecttoend", "C-l" : "recenterTopBottom", "M-s" : "centerselection", "M-g": "gotoline", "C-x C-p": "selectall", // todo fix these "C-Down": {command: "goorselect", args: ["gotopagedown","selectpagedown"]}, "C-Up": {command: "goorselect", args: ["gotopageup","selectpageup"]}, "PageDown|C-v": {command: "goorselect", args: ["gotopagedown","selectpagedown"]}, "PageUp|M-v": {command: "goorselect", args: ["gotopageup","selectpageup"]}, "S-C-Down": "selectpagedown", "S-C-Up": "selectpageup", "C-s": "iSearch", "C-r": "iSearchBackwards", "M-C-s": "findnext", "M-C-r": "findprevious", "S-M-5": "replace", // basic editing "Backspace": "backspace", "Delete|C-d": "del", "Return|C-m": {command: "insertstring", args: "\n"}, // "newline" "C-o": "splitline", "M-d|C-Delete": {command: "killWord", args: "right"}, "C-Backspace|M-Backspace|M-Delete": {command: "killWord", args: "left"}, "C-k": "killLine", "C-y|S-Delete": "yank", "M-y": "yankRotate", "C-g": "keyboardQuit", "C-w|C-S-W": "killRegion", "M-w": "killRingSave", "C-Space": "setMark", "C-x C-x": "exchangePointAndMark", "C-t": "transposeletters", "M-u": "touppercase", // Doesn't work "M-l": "tolowercase", "M-/": "autocomplete", // Doesn't work "C-u": "universalArgument", "M-;": "togglecomment", "C-/|C-x u|S-C--|C-z": "undo", "S-C-/|S-C-x u|C--|S-C-z": "redo", // infinite undo? // vertical editing "C-x r": "selectRectangularRegion", "M-x": {command: "focusCommandLine", args: "M-x "} // todo // "C-x C-t" "M-t" "M-c" "F11" "C-M- "M-q" }; exports.handler.bindKeys(exports.emacsKeys); exports.handler.addCommands({ recenterTopBottom: function(editor) { var renderer = editor.renderer; var pos = renderer.$cursorLayer.getPixelPosition(); var h = renderer.$size.scrollerHeight - renderer.lineHeight; var scrollTop = renderer.scrollTop; if (Math.abs(pos.top - scrollTop) < 2) { scrollTop = pos.top - h; } else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) { scrollTop = pos.top; } else { scrollTop = pos.top - h * 0.5; } editor.session.setScrollTop(scrollTop); }, selectRectangularRegion: function(editor) { editor.multiSelect.toggleBlockSelection(); }, setMark: { exec: function(editor, args) { // Sets mark-mode and clears current selection. // When mark is set, keyboard cursor movement commands become // selection modification commands. That is, // "goto" commands become "select" commands. // Any insertion or mouse click resets mark-mode. // setMark twice in a row at the same place resets markmode. // in multi select mode, ea selection is handled individually if (args && args.count) { if (editor.inMultiSelectMode) editor.forEachSelection(moveToMark); else moveToMark(); moveToMark(); return; } var mark = editor.emacsMark(), ranges = editor.selection.getAllRanges(), rangePositions = ranges.map(function(r) { return {row: r.start.row, column: r.start.column}; }), transientMarkModeActive = true, hasNoSelection = ranges.every(function(range) { return range.isEmpty(); }); // if transientMarkModeActive then mark behavior is a little // different. Deactivate the mark when setMark is run with active // mark if (transientMarkModeActive && (mark || !hasNoSelection)) { if (editor.inMultiSelectMode) editor.forEachSelection({exec: editor.clearSelection.bind(editor)}); else editor.clearSelection(); if (mark) editor.pushEmacsMark(null); return; } if (!mark) { rangePositions.forEach(function(pos) { editor.pushEmacsMark(pos); }); editor.setEmacsMark(rangePositions[rangePositions.length-1]); return; } // -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- function moveToMark() { var mark = editor.popEmacsMark(); mark && editor.moveCursorToPosition(mark); } }, readOnly: true, handlesCount: true }, exchangePointAndMark: { exec: function exchangePointAndMark$exec(editor, args) { var sel = editor.selection; if (!args.count && !sel.isEmpty()) { // just invert selection sel.setSelectionRange(sel.getRange(), !sel.isBackwards()); return; } if (args.count) { // replace mark and point var pos = {row: sel.lead.row, column: sel.lead.column}; sel.clearSelection(); sel.moveCursorToPosition(editor.emacsMarkForSelection(pos)); } else { // create selection to last mark sel.selectToPosition(editor.emacsMarkForSelection()); } }, readOnly: true, handlesCount: true, multiSelectAction: "forEach" }, killWord: { exec: function(editor, dir) { editor.clearSelection(); if (dir == "left") editor.selection.selectWordLeft(); else editor.selection.selectWordRight(); var range = editor.getSelectionRange(); var text = editor.session.getTextRange(range); exports.killRing.add(text); editor.session.remove(range); editor.clearSelection(); }, multiSelectAction: "forEach" }, killLine: function(editor) { editor.pushEmacsMark(null); // don't delete the selection if it's before the cursor editor.clearSelection(); var range = editor.getSelectionRange(); var line = editor.session.getLine(range.start.row); range.end.column = line.length; line = line.substr(range.start.column); var foldLine = editor.session.getFoldLine(range.start.row); if (foldLine && range.end.row != foldLine.end.row) { range.end.row = foldLine.end.row; line = "x"; } // remove EOL if only whitespace remains after the cursor if (/^\s*$/.test(line)) { range.end.row++; line = editor.session.getLine(range.end.row); range.end.column = /^\s*$/.test(line) ? line.length : 0; } var text = editor.session.getTextRange(range); if (editor.prevOp.command == this) exports.killRing.append(text); else exports.killRing.add(text); editor.session.remove(range); editor.clearSelection(); }, yank: function(editor) { editor.onPaste(exports.killRing.get() || ''); editor.keyBinding.$data.lastCommand = "yank"; }, yankRotate: function(editor) { if (editor.keyBinding.$data.lastCommand != "yank") return; editor.undo(); editor.session.$emacsMarkRing.pop(); // also undo recording mark editor.onPaste(exports.killRing.rotate()); editor.keyBinding.$data.lastCommand = "yank"; }, killRegion: { exec: function(editor) { exports.killRing.add(editor.getCopyText()); editor.commands.byName.cut.exec(editor); editor.setEmacsMark(null); }, readOnly: true, multiSelectAction: "forEach" }, killRingSave: { exec: function(editor) { // copy text and deselect. will save marks for starts of the // selection(s) editor.$handlesEmacsOnCopy = true; var marks = editor.session.$emacsMarkRing.slice(), deselectedMarks = []; exports.killRing.add(editor.getCopyText()); setTimeout(function() { function deselect() { var sel = editor.selection, range = sel.getRange(), pos = sel.isBackwards() ? range.end : range.start; deselectedMarks.push({row: pos.row, column: pos.column}); sel.clearSelection(); } editor.$handlesEmacsOnCopy = false; if (editor.inMultiSelectMode) editor.forEachSelection({exec: deselect}); else deselect(); editor.session.$emacsMarkRing = marks.concat(deselectedMarks.reverse()); }, 0); }, readOnly: true }, keyboardQuit: function(editor) { editor.selection.clearSelection(); editor.setEmacsMark(null); editor.keyBinding.$data.count = null; }, focusCommandLine: function(editor, arg) { if (editor.showCommandLine) editor.showCommandLine(arg); } }); exports.handler.addCommands(iSearchCommandModule.iSearchStartCommands); var commands = exports.handler.commands; commands.yank.isYank = true; commands.yankRotate.isYank = true; exports.killRing = { $data: [], add: function(str) { str && this.$data.push(str); if (this.$data.length > 30) this.$data.shift(); }, append: function(str) { var idx = this.$data.length - 1; var text = this.$data[idx] || ""; if (str) text += str; if (text) this.$data[idx] = text; }, get: function(n) { n = n || 1; return this.$data.slice(this.$data.length-n, this.$data.length).reverse().join('\n'); }, pop: function() { if (this.$data.length > 1) this.$data.pop(); return this.get(); }, rotate: function() { this.$data.unshift(this.$data.pop()); return this.get(); } }; }); ================================================ FILE: lib/ace/keyboard/emacs_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("../test/mockdom"); } define(function(require, exports, module) { "use strict"; require("../multi_select"); var EditSession = require("./../edit_session").EditSession, Editor = require("./../editor").Editor, Range = require("./../range").Range, MockRenderer = require("./../test/mockrenderer").MockRenderer, emacs = require('./emacs'), assert = require("./../test/assertions"), editor, sel; function initEditor(docString) { var doc = new EditSession(docString.split("\n")); editor = new Editor(new MockRenderer(), doc); editor.setKeyboardHandler(emacs.handler); sel = editor.selection; } function print(obj) { return JSON.stringify(obj, null, 2); } function pluck(arr, what) { return arr.map(function(ea) { return ea[what]; }); } module.exports = { "test: detach removes emacs commands from command manager": function() { initEditor(''); assert.ok(!!editor.commands.byName["keyboardQuit"], 'setup error: emacs commands not installed'); editor.keyBinding.removeKeyboardHandler(editor.getKeyboardHandler()); assert.ok(!editor.commands.byName["keyboardQuit"], 'emacs commands not removed'); }, "test: keyboardQuit clears selection": function() { initEditor('foo'); editor.selectAll(); editor.execCommand('keyboardQuit'); assert.ok(editor.selection.isEmpty(), 'selection non-empty'); }, "test: exchangePointAndMark without mark set": function() { initEditor('foo'); sel.setRange(Range.fromPoints({row: 0, column: 1}, {row: 0, column: 3})); editor.execCommand('exchangePointAndMark'); assert.deepEqual({row: 0, column: 1}, editor.getCursorPosition(), print(editor.getCursorPosition())); }, "test: exchangePointAndMark with mark set": function() { initEditor('foo'); editor.pushEmacsMark({row: 0, column: 1}); editor.pushEmacsMark({row: 0, column: 2}); editor.execCommand('exchangePointAndMark', {count: 4}); assert.deepEqual({row: 0, column: 2}, editor.getCursorPosition(), print(editor.getCursorPosition())); assert.deepEqual([{row: 0, column: 1}, {row: 0, column: 0}], editor.session.$emacsMarkRing, print(editor.session.$emacsMarkRing)); }, "test: exchangePointAndMark with selection": function() { initEditor('foo'); editor.pushEmacsMark({row: 0, column: 1}); editor.pushEmacsMark({row: 0, column: 2}); sel.setRange(Range.fromPoints({row: 0, column: 0}, {row: 0, column: 1}), true); editor.execCommand('exchangePointAndMark'); assert.deepEqual({row: 0, column: 1}, editor.getCursorPosition(), print(editor.getCursorPosition())); assert.deepEqual([{row: 0, column: 1}, {row: 0, column: 2}], editor.session.$emacsMarkRing, print(editor.session.$emacsMarkRing)); }, "test: exchangePointAndMark with multi selection": function() { initEditor('foo\nhello world\n123'); var ranges = [[{row: 0, column: 0}, {row: 0, column: 3}], [{row: 1, column: 0}, {row: 1, column: 5}], [{row: 1, column: 6}, {row: 1, column: 11}]]; ranges.forEach(function(r) { sel.addRange(Range.fromPoints(r[0], r[1])); }); assert.equal("foo\nhello\nworld", editor.getSelectedText()); editor.execCommand('exchangePointAndMark'); assert.equal("foo\nhello\nworld", editor.getSelectedText()); assert.deepEqual(pluck(ranges, 0), pluck(sel.getAllRanges(), 'cursor'), "selections dir not inverted"); }, "test: exchangePointAndMark with multi cursors": function() { initEditor('foo\nhello world\n123'); var ranges = [[{row: 0, column: 0}, {row: 0, column: 3}], [{row: 1, column: 0}, {row: 1, column: 5}], [{row: 1, column: 6}, {row: 1, column: 11}]]; // move cursors to the start of each range and set a mark to its end // without selecting anything ranges.forEach(function(r) { editor.pushEmacsMark(r[1]); sel.addRange(Range.fromPoints(r[0], r[0])); }); assert.deepEqual(pluck(ranges, 0), pluck(sel.getAllRanges(), 'cursor'), print(sel.getAllRanges())); editor.execCommand('exchangePointAndMark'); assert.deepEqual(pluck(ranges, 1), pluck(sel.getAllRanges(), 'cursor'), "not inverted: " + print(sel.getAllRanges())); }, "test: setMark with multi cursors": function() { initEditor('foo\nhello world\n123'); var positions = [{row: 0, column: 0}, {row: 1, column: 0}, {row: 1, column: 6}]; positions.forEach(function(p) { sel.addRange(Range.fromPoints(p,p)); }); editor.execCommand('setMark'); assert.deepEqual(positions, editor.session.$emacsMarkRing, print(editor.session.$emacsMarkRing)); }, "test: killLine": function() { initEditor("foo \n Hello world\n \n 123"); sel.setRange(new Range(0, 0, 0, 2)); editor.endOperation(); editor.execCommand("killLine"); assert.equal(editor.getValue(),"fo\n Hello world\n \n 123"); editor.execCommand("killLine"); assert.equal(editor.getValue(),"fo Hello world\n \n 123"); editor.execCommand("killLine"); assert.equal(editor.getValue(),"fo\n \n 123"); editor.execCommand("killLine"); assert.equal(editor.getValue(),"fo\n 123"); editor.execCommand("killLine"); assert.equal(editor.getValue(),"fo 123"); editor.execCommand("killLine"); assert.equal(editor.getValue(),"fo"); editor.execCommand("killLine"); editor.execCommand("yank"); assert.equal(editor.getValue(),"foo \n Hello world\n \n 123"); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/keyboard/hash_handler.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var keyUtil = require("../lib/keys"); var useragent = require("../lib/useragent"); var KEY_MODS = keyUtil.KEY_MODS; function HashHandler(config, platform) { this.platform = platform || (useragent.isMac ? "mac" : "win"); this.commands = {}; this.commandKeyBinding = {}; this.addCommands(config); this.$singleCommand = true; } function MultiHashHandler(config, platform) { HashHandler.call(this, config, platform); this.$singleCommand = false; } MultiHashHandler.prototype = HashHandler.prototype; (function() { this.addCommand = function(command) { if (this.commands[command.name]) this.removeCommand(command); this.commands[command.name] = command; if (command.bindKey) this._buildKeyHash(command); }; this.removeCommand = function(command, keepCommand) { var name = command && (typeof command === 'string' ? command : command.name); command = this.commands[name]; if (!keepCommand) delete this.commands[name]; // exhaustive search is brute force but since removeCommand is // not a performance critical operation this should be OK var ckb = this.commandKeyBinding; for (var keyId in ckb) { var cmdGroup = ckb[keyId]; if (cmdGroup == command) { delete ckb[keyId]; } else if (Array.isArray(cmdGroup)) { var i = cmdGroup.indexOf(command); if (i != -1) { cmdGroup.splice(i, 1); if (cmdGroup.length == 1) ckb[keyId] = cmdGroup[0]; } } } }; this.bindKey = function(key, command, position) { if (typeof key == "object" && key) { if (position == undefined) position = key.position; key = key[this.platform]; } if (!key) return; if (typeof command == "function") return this.addCommand({exec: command, bindKey: key, name: command.name || key}); key.split("|").forEach(function(keyPart) { var chain = ""; if (keyPart.indexOf(" ") != -1) { var parts = keyPart.split(/\s+/); keyPart = parts.pop(); parts.forEach(function(keyPart) { var binding = this.parseKeys(keyPart); var id = KEY_MODS[binding.hashId] + binding.key; chain += (chain ? " " : "") + id; this._addCommandToBinding(chain, "chainKeys"); }, this); chain += " "; } var binding = this.parseKeys(keyPart); var id = KEY_MODS[binding.hashId] + binding.key; this._addCommandToBinding(chain + id, command, position); }, this); }; function getPosition(command) { return typeof command == "object" && command.bindKey && command.bindKey.position || (command.isDefault ? -100 : 0); } this._addCommandToBinding = function(keyId, command, position) { var ckb = this.commandKeyBinding, i; if (!command) { delete ckb[keyId]; } else if (!ckb[keyId] || this.$singleCommand) { ckb[keyId] = command; } else { if (!Array.isArray(ckb[keyId])) { ckb[keyId] = [ckb[keyId]]; } else if ((i = ckb[keyId].indexOf(command)) != -1) { ckb[keyId].splice(i, 1); } if (typeof position != "number") { position = getPosition(command); } var commands = ckb[keyId]; for (i = 0; i < commands.length; i++) { var other = commands[i]; var otherPos = getPosition(other); if (otherPos > position) break; } commands.splice(i, 0, command); } }; this.addCommands = function(commands) { commands && Object.keys(commands).forEach(function(name) { var command = commands[name]; if (!command) return; if (typeof command === "string") return this.bindKey(command, name); if (typeof command === "function") command = { exec: command }; if (typeof command !== "object") return; if (!command.name) command.name = name; this.addCommand(command); }, this); }; this.removeCommands = function(commands) { Object.keys(commands).forEach(function(name) { this.removeCommand(commands[name]); }, this); }; this.bindKeys = function(keyList) { Object.keys(keyList).forEach(function(key) { this.bindKey(key, keyList[key]); }, this); }; this._buildKeyHash = function(command) { this.bindKey(command.bindKey, command); }; // accepts keys in the form ctrl+Enter or ctrl-Enter // keys without modifiers or shift only this.parseKeys = function(keys) { var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x;}); var key = parts.pop(); var keyCode = keyUtil[key]; if (keyUtil.FUNCTION_KEYS[keyCode]) key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase(); else if (!parts.length) return {key: key, hashId: -1}; else if (parts.length == 1 && parts[0] == "shift") return {key: key.toUpperCase(), hashId: -1}; var hashId = 0; for (var i = parts.length; i--;) { var modifier = keyUtil.KEY_MODS[parts[i]]; if (modifier == null) { if (typeof console != "undefined") console.error("invalid modifier " + parts[i] + " in " + keys); return false; } hashId |= modifier; } return {key: key, hashId: hashId}; }; this.findKeyCommand = function findKeyCommand(hashId, keyString) { var key = KEY_MODS[hashId] + keyString; return this.commandKeyBinding[key]; }; this.handleKeyboard = function(data, hashId, keyString, keyCode) { if (keyCode < 0) return; var key = KEY_MODS[hashId] + keyString; var command = this.commandKeyBinding[key]; if (data.$keyChain) { data.$keyChain += " " + key; command = this.commandKeyBinding[data.$keyChain] || command; } if (command) { if (command == "chainKeys" || command[command.length - 1] == "chainKeys") { data.$keyChain = data.$keyChain || key; return {command: "null"}; } } if (data.$keyChain) { if ((!hashId || hashId == 4) && keyString.length == 1) data.$keyChain = data.$keyChain.slice(0, -key.length - 1); // wait for input else if (hashId == -1 || keyCode > 0) data.$keyChain = ""; // reset keyChain } return {command: command}; }; this.getStatusText = function(editor, data) { return data.$keyChain || ""; }; }).call(HashHandler.prototype); exports.HashHandler = HashHandler; exports.MultiHashHandler = MultiHashHandler; }); ================================================ FILE: lib/ace/keyboard/keybinding.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var keyUtil = require("../lib/keys"); var event = require("../lib/event"); var KeyBinding = function(editor) { this.$editor = editor; this.$data = {editor: editor}; this.$handlers = []; this.setDefaultHandler(editor.commands); }; (function() { this.setDefaultHandler = function(kb) { this.removeKeyboardHandler(this.$defaultHandler); this.$defaultHandler = kb; this.addKeyboardHandler(kb, 0); }; this.setKeyboardHandler = function(kb) { var h = this.$handlers; if (h[h.length - 1] == kb) return; while (h[h.length - 1] && h[h.length - 1] != this.$defaultHandler) this.removeKeyboardHandler(h[h.length - 1]); this.addKeyboardHandler(kb, 1); }; this.addKeyboardHandler = function(kb, pos) { if (!kb) return; if (typeof kb == "function" && !kb.handleKeyboard) kb.handleKeyboard = kb; var i = this.$handlers.indexOf(kb); if (i != -1) this.$handlers.splice(i, 1); if (pos == undefined) this.$handlers.push(kb); else this.$handlers.splice(pos, 0, kb); if (i == -1 && kb.attach) kb.attach(this.$editor); }; this.removeKeyboardHandler = function(kb) { var i = this.$handlers.indexOf(kb); if (i == -1) return false; this.$handlers.splice(i, 1); kb.detach && kb.detach(this.$editor); return true; }; this.getKeyboardHandler = function() { return this.$handlers[this.$handlers.length - 1]; }; this.getStatusText = function() { var data = this.$data; var editor = data.editor; return this.$handlers.map(function(h) { return h.getStatusText && h.getStatusText(editor, data) || ""; }).filter(Boolean).join(" "); }; this.$callKeyboardHandlers = function(hashId, keyString, keyCode, e) { var toExecute; var success = false; var commands = this.$editor.commands; for (var i = this.$handlers.length; i--;) { toExecute = this.$handlers[i].handleKeyboard( this.$data, hashId, keyString, keyCode, e ); if (!toExecute || !toExecute.command) continue; // allow keyboardHandler to consume keys if (toExecute.command == "null") { success = true; } else { success = commands.exec(toExecute.command, this.$editor, toExecute.args, e); } // do not stop input events to not break repeating if (success && e && hashId != -1 && toExecute.passEvent != true && toExecute.command.passEvent != true ) { event.stopEvent(e); } if (success) break; } if (!success && hashId == -1) { toExecute = {command: "insertstring"}; success = commands.exec("insertstring", this.$editor, keyString); } if (success && this.$editor._signal) this.$editor._signal("keyboardActivity", toExecute); return success; }; this.onCommandKey = function(e, hashId, keyCode) { var keyString = keyUtil.keyCodeToString(keyCode); this.$callKeyboardHandlers(hashId, keyString, keyCode, e); }; this.onTextInput = function(text) { this.$callKeyboardHandlers(-1, text); }; }).call(KeyBinding.prototype); exports.KeyBinding = KeyBinding; }); ================================================ FILE: lib/ace/keyboard/keybinding_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var EditSession = require("./../edit_session").EditSession, Editor = require("./../editor").Editor, MockRenderer = require("./../test/mockrenderer").MockRenderer, assert = require("./../test/assertions"), HashHandler = require('./hash_handler').HashHandler, keys = require('../lib/keys'), editor; function initEditor(docString) { var doc = new EditSession(docString.split("\n")); editor = new Editor(new MockRenderer(), doc); } module.exports = { "test: adding a new keyboard handler does not remove the default handler": function() { initEditor('abc'); var handler = new HashHandler({'del': 'f1'}); editor.keyBinding.setKeyboardHandler(handler); editor.onCommandKey({}, 0, keys['f1']); assert.equal('bc', editor.getValue(), "binding of new handler"); editor.onCommandKey({}, 0, keys['delete']); assert.equal('c', editor.getValue(), "bindings of the old handler should still work"); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/keyboard/state_handler.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; // If you're developing a new keymapping and want to get an idea what's going // on, then enable debugging. var DEBUG = false; function StateHandler(keymapping) { this.keymapping = this.$buildKeymappingRegex(keymapping); } StateHandler.prototype = { /* * Build the RegExp from the keymapping as RegExp can't stored directly * in the metadata JSON and as the RegExp used to match the keys/buffer * need to be adapted. */ $buildKeymappingRegex: function(keymapping) { for (var state in keymapping) { this.$buildBindingsRegex(keymapping[state]); } return keymapping; }, $buildBindingsRegex: function(bindings) { // Escape a given Regex string. bindings.forEach(function(binding) { if (binding.key) { binding.key = new RegExp('^' + binding.key + '$'); } else if (Array.isArray(binding.regex)) { if (!('key' in binding)) binding.key = new RegExp('^' + binding.regex[1] + '$'); binding.regex = new RegExp(binding.regex.join('') + '$'); } else if (binding.regex) { binding.regex = new RegExp(binding.regex + '$'); } }); }, $composeBuffer: function(data, hashId, key, e) { // Initialize the data object. if (data.state == null || data.buffer == null) { data.state = "start"; data.buffer = ""; } var keyArray = []; if (hashId & 1) keyArray.push("ctrl"); if (hashId & 8) keyArray.push("command"); if (hashId & 2) keyArray.push("option"); if (hashId & 4) keyArray.push("shift"); if (key) keyArray.push(key); var symbolicName = keyArray.join("-"); var bufferToUse = data.buffer + symbolicName; // Don't add the symbolic name to the key buffer if the alt_ key is // part of the symbolic name. If it starts with alt_, this means // that the user hit an alt keycombo and there will be a single, // new character detected after this event, which then will be // added to the buffer (e.g. alt_j will result in ∆). // // We test for 2 and not for & 2 as we only want to exclude the case where // the option key is pressed alone. if (hashId != 2) { data.buffer = bufferToUse; } var bufferObj = { bufferToUse: bufferToUse, symbolicName: symbolicName }; if (e) { bufferObj.keyIdentifier = e.keyIdentifier; } return bufferObj; }, $find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) { // Holds the command to execute and the args if a command matched. var result = {}; // Loop over all the bindings of the keymap until a match is found. this.keymapping[data.state].some(function(binding) { var match; // Check if the key matches. if (binding.key && !binding.key.test(symbolicName)) { return false; } // Check if the regex matches. if (binding.regex && !(match = binding.regex.exec(buffer))) { return false; } // Check if the match function matches. if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) { return false; } // Check for disallowed matches. if (binding.disallowMatches) { for (var i = 0; i < binding.disallowMatches.length; i++) { if (!!match[binding.disallowMatches[i]]) { return false; } } } // If there is a command to execute, then figure out the // command and the arguments. if (binding.exec) { result.command = binding.exec; // Build the arguments. if (binding.params) { var value; result.args = {}; binding.params.forEach(function(param) { if (param.match != null && match != null) { value = match[param.match] || param.defaultValue; } else { value = param.defaultValue; } if (param.type === 'number') { value = parseInt(value); } result.args[param.name] = value; }); } data.buffer = ""; } // Handle the 'then' property. if (binding.then) { data.state = binding.then; data.buffer = ""; } // If no command is set, then execute the "null" fake command. if (result.command == null) { result.command = "null"; } if (DEBUG) { console.log("KeyboardStateMapper#find", binding); } return true; }); if (result.command) { return result; } else { data.buffer = ""; return false; } }, /* * This function is called by keyBinding. */ handleKeyboard: function(data, hashId, key, keyCode, e) { if (hashId == -1) hashId = 0; // If we pressed any command key but no other key, then ignore the input. // Otherwise "shift-" is added to the buffer, and later on "shift-g" // which results in "shift-shift-g" which doesn't make sense. if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) { return null; } // Compute the current value of the keyboard input buffer. var r = this.$composeBuffer(data, hashId, key, e); var buffer = r.bufferToUse; var symbolicName = r.symbolicName; var keyId = r.keyIdentifier; r = this.$find(data, buffer, symbolicName, hashId, key, keyId); if (DEBUG) { console.log("KeyboardStateMapper#match", buffer, symbolicName, r); } return r; } }; /* * This is a useful matching function and therefore is defined here so that * users of KeyboardStateMapper can use it. * * @return {Boolean} If no command key (Command|Option|Shift|Ctrl) is pressed, it * returns true. If the only the Shift key is pressed + a character * true is returned as well. Otherwise, false is returned. * Summing up, the function returns true whenever the user typed * a normal character on the keyboard and no shortcut. */ exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) { // If no command keys are pressed, then catch the input. if (hashId == 0) { return true; } // If only the shift key is pressed and a character key, then // catch that input as well. else if ((hashId == 4) && key.length == 1) { return true; } // Otherwise, we let the input got through. else { return false; } }; exports.StateHandler = StateHandler; }); ================================================ FILE: lib/ace/keyboard/textarea.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var HashHandler = require("./hash_handler").HashHandler; exports.handler = new HashHandler(); [{ bindKey: "Shift-Tab|Tab", command: "passKeysToBrowser" }, { bindKey: {win: "Ctrl-L", mac: "Cmd-L"}, command: "passKeysToBrowser" }, { bindKey: {win: "Ctrl-G", mac: "Cmd-G"}, command: "gotoline" }, { bindKey: {win: "Ctrl-T|Ctrl-Shift-T|Ctrl-K", mac: "Cmd-T|Cmd-Shift-T"}, // TODO can't used shared passKeysToBrowser command since passEvent from it is ignored command: { name: "passKeysToBrowser", exec: function() {}, passEvent: true, readOnly: true } }, { bindKey: {win: "Ctrl-G", mac: "Cmd-G"}, command: "passKeysToBrowser" }, { bindKey: {win: "Ctrl-G", mac: "Cmd-G"}, command: "passKeysToBrowser" }, { command: "golineup", bindKey: {win: null, mac: "Ctrl-P"} }, { command: "golinedown", bindKey: {win: null, mac: "Ctrl-N"} }, { command: "gotoleft", bindKey: {win: null, mac: "Ctrl-B"} }, { command: "gotoright", bindKey: {win: null, mac: "Ctrl-F"} }, { command: "gotolineend", bindKey: {win: null, mac: "Ctrl-E"} }, { command: "gotolinestart", bindKey: {win: null, mac: "Ctrl-A"} } ].forEach(function(k) { var bindKey = k.bindKey; if (typeof bindKey == "object") bindKey = bindKey[exports.handler.platform]; exports.handler.bindKey(bindKey, k.command); }); exports.handler.$id = "ace/keyboard/textarea"; }); ================================================ FILE: lib/ace/keyboard/textinput.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var event = require("../lib/event"); var useragent = require("../lib/useragent"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; var TextInputIOS = require("./textinput_ios").TextInput; var TextInput = function(parentNode, host) { if (useragent.isIOS) return TextInputIOS.call(this, parentNode, host); var text = dom.createElement("textarea"); text.className = "ace_text-input"; text.setAttribute("wrap", "off"); text.setAttribute("autocorrect", "off"); text.setAttribute("autocapitalize", "off"); text.setAttribute("spellcheck", false); text.style.opacity = "0"; parentNode.insertBefore(text, parentNode.firstChild); var PLACEHOLDER = "\u2028\u2028"; var copied = false; var pasted = false; var inComposition = false; var tempStyle = ''; var isSelectionEmpty = true; var copyWithEmptySelection = false; // FOCUS // ie9 throws error if document.activeElement is accessed too soon try { var isFocused = document.activeElement === text; } catch(e) {} event.addListener(text, "blur", function(e) { host.onBlur(e); isFocused = false; }); event.addListener(text, "focus", function(e) { isFocused = true; host.onFocus(e); resetSelection(); }); this.focus = function() { if (tempStyle) return text.focus(); var top = text.style.top; text.style.position = "fixed"; text.style.top = "0px"; text.focus(); setTimeout(function() { text.style.position = ""; if (text.style.top == "0px") text.style.top = top; }, 0); }; this.blur = function() { text.blur(); }; this.isFocused = function() { return isFocused; }; // modifying selection of blured textarea can focus it (chrome mac/linux) var syncSelection = lang.delayedCall(function() { isFocused && resetSelection(isSelectionEmpty); }); var syncValue = lang.delayedCall(function() { if (!inComposition) { text.value = PLACEHOLDER; isFocused && resetSelection(); } }); function resetSelection(isEmpty) { isEmpty = copyWithEmptySelection ? false : isEmpty; if (inComposition) return; // this prevents infinite recursion on safari 8 // see https://github.com/ajaxorg/ace/issues/2114 inComposition = true; if (inputHandler) { var selectionStart = 0; var selectionEnd = isEmpty ? 0 : text.value.length - 1; } else { var selectionStart = isEmpty ? 2 : 1; var selectionEnd = 2; } // on firefox this throws if textarea is hidden try { text.setSelectionRange(selectionStart, selectionEnd); } catch(e){} inComposition = false; } function resetValue() { if (inComposition) return; text.value = PLACEHOLDER; //http://code.google.com/p/chromium/issues/detail?id=76516 if (useragent.isWebKit) syncValue.schedule(); } useragent.isWebKit || host.addEventListener('changeSelection', function() { if (host.selection.isEmpty() != isSelectionEmpty) { isSelectionEmpty = !isSelectionEmpty; syncSelection.schedule(); } }); resetValue(); if (isFocused) host.onFocus(); var isAllSelected = function(text) { return text.selectionStart === 0 && text.selectionEnd === text.value.length; }; var onSelect = function(e) { if (copied) { copied = false; } else if (isAllSelected(text)) { host.selectAll(); resetSelection(); } else if (inputHandler) { resetSelection(host.selection.isEmpty()); } }; var inputHandler = null; this.setInputHandler = function(cb) {inputHandler = cb;}; this.getInputHandler = function() {return inputHandler;}; var afterContextMenu = false; var sendText = function(data) { if (inputHandler) { data = inputHandler(data); inputHandler = null; } if (pasted) { resetSelection(); if (data) host.onPaste(data); pasted = false; } else if (data == PLACEHOLDER.charAt(0)) { if (afterContextMenu) host.execCommand("del", {source: "ace"}); else // some versions of android do not fire keydown when pressing backspace host.execCommand("backspace", {source: "ace"}); } else { if (data.substring(0, 2) == PLACEHOLDER) data = data.substr(2); else if (data.charAt(0) == PLACEHOLDER.charAt(0)) data = data.substr(1); else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0)) data = data.slice(0, -1); // can happen if undo in textarea isn't stopped if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0)) data = data.slice(0, -1); if (data) host.onTextInput(data); } if (afterContextMenu) afterContextMenu = false; }; var onInput = function(e) { // console.log("onInput", inComposition) if (inComposition) return; var data = text.value; sendText(data); resetValue(); }; var handleClipboardData = function(e, data, forceIEMime) { var clipboardData = e.clipboardData || window.clipboardData; if (!clipboardData || BROKEN_SETDATA) return; // using "Text" doesn't work on old webkit but ie needs it var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain"; try { if (data) { // Safari 5 has clipboardData object, but does not handle setData() return clipboardData.setData(mime, data) !== false; } else { return clipboardData.getData(mime); } } catch(e) { if (!forceIEMime) return handleClipboardData(e, data, true); } }; var doCopy = function(e, isCut) { var data = host.getCopyText(); if (!data) return event.preventDefault(e); if (handleClipboardData(e, data)) { isCut ? host.onCut() : host.onCopy(); event.preventDefault(e); } else { copied = true; text.value = data; text.select(); setTimeout(function(){ copied = false; resetValue(); resetSelection(); isCut ? host.onCut() : host.onCopy(); }); } }; var onCut = function(e) { doCopy(e, true); }; var onCopy = function(e) { doCopy(e, false); }; var onPaste = function(e) { var data = handleClipboardData(e); if (typeof data == "string") { if (data) host.onPaste(data, e); if (useragent.isIE) setTimeout(resetSelection); event.preventDefault(e); } else { text.value = ""; pasted = true; } }; event.addCommandKeyListener(text, host.onCommandKey.bind(host)); event.addListener(text, "select", onSelect); event.addListener(text, "input", onInput); event.addListener(text, "cut", onCut); event.addListener(text, "copy", onCopy); event.addListener(text, "paste", onPaste); // Opera has no clipboard events if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)) { event.addListener(parentNode, "keydown", function(e) { if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) return; switch (e.keyCode) { case 67: onCopy(e); break; case 86: onPaste(e); break; case 88: onCut(e); break; } }); } // COMPOSITION var onCompositionStart = function(e) { if (inComposition || !host.onCompositionStart || host.$readOnly) return; // console.log("onCompositionStart", inComposition) inComposition = {}; inComposition.canUndo = host.session.$undoManager; host.onCompositionStart(); setTimeout(onCompositionUpdate, 0); host.on("mousedown", onCompositionEnd); if (inComposition.canUndo && !host.selection.isEmpty()) { host.insert(""); host.session.markUndoGroup(); host.selection.clearSelection(); } host.session.markUndoGroup(); }; var onCompositionUpdate = function() { // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value)) if (!inComposition || !host.onCompositionUpdate || host.$readOnly) return; var val = text.value.replace(/\u2028/g, ""); if (inComposition.lastValue === val) return; host.onCompositionUpdate(val); if (inComposition.lastValue) host.undo(); if (inComposition.canUndo) inComposition.lastValue = val; if (inComposition.lastValue) { var r = host.selection.getRange(); host.insert(inComposition.lastValue); host.session.markUndoGroup(); inComposition.range = host.selection.getRange(); host.selection.setRange(r); host.selection.clearSelection(); } }; var onCompositionEnd = function(e) { if (!host.onCompositionEnd || host.$readOnly) return; // console.log("onCompositionEnd", inComposition &&inComposition.lastValue) var c = inComposition; inComposition = false; var timer = setTimeout(function() { timer = null; var str = text.value.replace(/\u2028/g, ""); // console.log(str, c.lastValue) if (inComposition) return; else if (str == c.lastValue) resetValue(); else if (!c.lastValue && str) { resetValue(); sendText(str); } }); inputHandler = function compositionInputHandler(str) { // console.log("onCompositionEnd", str, c.lastValue) if (timer) clearTimeout(timer); str = str.replace(/\u2028/g, ""); if (str == c.lastValue) return ""; if (c.lastValue && timer) host.undo(); return str; }; host.onCompositionEnd(); host.removeListener("mousedown", onCompositionEnd); if (e.type == "compositionend" && c.range) { host.selection.setRange(c.range); } // Workaround for #3027, #3045, #3097, #3100, #3249 var needsOnInput = (!!useragent.isChrome && useragent.isChrome >= 53) || (!!useragent.isWebKit && useragent.isWebKit >= 603); if (needsOnInput) { onInput(); } }; var syncComposition = lang.delayedCall(onCompositionUpdate, 50); event.addListener(text, "compositionstart", onCompositionStart); event.addListener(text, "compositionupdate", function(){syncComposition.schedule();}); event.addListener(text, "keyup", function(){syncComposition.schedule();}); event.addListener(text, "keydown", function(){syncComposition.schedule();}); event.addListener(text, "compositionend", onCompositionEnd); this.getElement = function() { return text; }; this.setReadOnly = function(readOnly) { text.readOnly = readOnly; }; this.setCopyWithEmptySelection = function(value) { copyWithEmptySelection = value; }; this.onContextMenu = function(e) { afterContextMenu = true; resetSelection(host.selection.isEmpty()); host._emit("nativecontextmenu", {target: host, domEvent: e}); this.moveToMouse(e, true); }; this.moveToMouse = function(e, bringToFront) { if (!tempStyle) tempStyle = text.style.cssText; text.style.cssText = (bringToFront ? "z-index:100000;" : "") + "height:" + text.style.height + ";" + (useragent.isIE ? "opacity:0.1;" : ""); var rect = host.container.getBoundingClientRect(); var style = dom.computedStyle(host.container); var top = rect.top + (parseInt(style.borderTopWidth) || 0); var left = rect.left + (parseInt(rect.borderLeftWidth) || 0); var maxTop = rect.bottom - top - text.clientHeight -2; var move = function(e) { text.style.left = e.clientX - left - 2 + "px"; text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px"; }; move(e); if (e.type != "mousedown") return; if (host.renderer.$keepTextAreaAtCursor) host.renderer.$keepTextAreaAtCursor = null; clearTimeout(closeTimeout); // on windows context menu is opened after mouseup if (useragent.isWin) event.capture(host.container, move, onContextMenuClose); }; this.onContextMenuClose = onContextMenuClose; var closeTimeout; function onContextMenuClose() { clearTimeout(closeTimeout); closeTimeout = setTimeout(function () { if (tempStyle) { text.style.cssText = tempStyle; tempStyle = ''; } if (host.renderer.$keepTextAreaAtCursor == null) { host.renderer.$keepTextAreaAtCursor = true; host.renderer.$moveTextAreaToCursor(); } }, 0); } var onContextMenu = function(e) { host.textInput.onContextMenu(e); onContextMenuClose(); }; event.addListener(text, "mouseup", onContextMenu); event.addListener(text, "mousedown", function(e) { e.preventDefault(); onContextMenuClose(); }); event.addListener(host.renderer.scroller, "contextmenu", onContextMenu); event.addListener(text, "contextmenu", onContextMenu); }; exports.TextInput = TextInput; }); ================================================ FILE: lib/ace/keyboard/textinput_ios.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var event = require("../lib/event"); var useragent = require("../lib/useragent"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var KEYS = require("../lib/keys"); var MODS = KEYS.KEY_MODS; var BROKEN_SETDATA = useragent.isChrome < 18; var USE_IE_MIME_TYPE = useragent.isIE; var TextInput = function(parentNode, host) { var self = this; var text = dom.createElement("textarea"); text.className = useragent.isIOS ? "ace_text-input ace_text-input-ios" : "ace_text-input"; if (useragent.isTouchPad) text.setAttribute("x-palm-disable-auto-cap", true); text.setAttribute("wrap", "off"); text.setAttribute("autocorrect", "off"); text.setAttribute("autocapitalize", "off"); text.setAttribute("spellcheck", false); text.style.opacity = "0"; parentNode.insertBefore(text, parentNode.firstChild); var PLACEHOLDER = "\n aaaa a\n"; var copied = false; var cut = false; var pasted = false; var inComposition = false; var tempStyle = ''; var isSelectionEmpty = true; // FOCUS // ie9 throws error if document.activeElement is accessed too soon try { var isFocused = document.activeElement === text; } catch(e) {} event.addListener(text, "blur", function(e) { host.onBlur(e); isFocused = false; }); event.addListener(text, "focus", function(e) { isFocused = true; host.onFocus(e); resetSelection(); }); this.focus = function() { if (tempStyle) return text.focus(); text.style.position = "fixed"; text.focus(); }; this.blur = function() { text.blur(); }; this.isFocused = function() { return isFocused; }; // modifying selection of blured textarea can focus it (chrome mac/linux) var syncSelection = lang.delayedCall(function() { isFocused && resetSelection(isSelectionEmpty); }); var syncValue = lang.delayedCall(function() { if (!inComposition) { text.value = PLACEHOLDER; isFocused && resetSelection(); } }); function resetSelection(isEmpty) { if (inComposition) return; // this prevents infinite recursion on safari 8 // see https://github.com/ajaxorg/ace/issues/2114 inComposition = true; if (inputHandler) { selectionStart = 0; selectionEnd = isEmpty ? 0 : text.value.length - 1; } else { var selectionStart = 4; var selectionEnd = 5; } // on firefox this throws if textarea is hidden try { text.setSelectionRange(selectionStart, selectionEnd); } catch(e) {} inComposition = false; } function resetValue() { if (inComposition) return; text.value = PLACEHOLDER; //http://code.google.com/p/chromium/issues/detail?id=76516 if (useragent.isWebKit) syncValue.schedule(); } useragent.isWebKit || host.addEventListener('changeSelection', function() { if (host.selection.isEmpty() != isSelectionEmpty) { isSelectionEmpty = !isSelectionEmpty; syncSelection.schedule(); } }); resetValue(); if (isFocused) host.onFocus(); var isAllSelected = function(text) { return text.selectionStart === 0 && text.selectionEnd === text.value.length; }; var onSelect = function(e) { if (isAllSelected(text)) { host.selectAll(); resetSelection(); } else if (inputHandler) { resetSelection(host.selection.isEmpty()); } }; var inputHandler = null; this.setInputHandler = function(cb) {inputHandler = cb;}; this.getInputHandler = function() {return inputHandler;}; var afterContextMenu = false; var sendText = function(data) { if (text.selectionStart === 4 && text.selectionEnd === 5) { return; } if (inputHandler) { data = inputHandler(data); inputHandler = null; } if (pasted) { resetSelection(); if (data) host.onPaste(data); pasted = false; } else if (data == PLACEHOLDER.substr(0) && text.selectionStart === 4) { if (afterContextMenu) host.execCommand("del", {source: "ace"}); else // some versions of android do not fire keydown when pressing backspace host.execCommand("backspace", {source: "ace"}); } else if (!copied) { if (data.substring(0, 9) == PLACEHOLDER && data.length > PLACEHOLDER.length) data = data.substr(9); else if (data.substr(0, 4) == PLACEHOLDER.substr(0, 4)) data = data.substr(4, data.length - PLACEHOLDER.length + 1); else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0)) data = data.slice(0, -1); // can happen if undo in textarea isn't stopped if (data == PLACEHOLDER.charAt(0)) { // Do nothing } else if (data.charAt(data.length - 1) == PLACEHOLDER.charAt(0)) data = data.slice(0, -1); if (data) host.onTextInput(data); } if (copied) { copied = false; } if (afterContextMenu) afterContextMenu = false; }; var onInput = function(e) { // console.log("onInput", inComposition) if (inComposition) return; var data = text.value; sendText(data); resetValue(); }; var handleClipboardData = function(e, data, forceIEMime) { var clipboardData = e.clipboardData || window.clipboardData; if (!clipboardData || BROKEN_SETDATA) return; // using "Text" doesn't work on old webkit but ie needs it var mime = USE_IE_MIME_TYPE || forceIEMime ? "Text" : "text/plain"; try { if (data) { // Safari 5 has clipboardData object, but does not handle setData() return clipboardData.setData(mime, data) !== false; } else { return clipboardData.getData(mime); } } catch(e) { if (!forceIEMime) return handleClipboardData(e, data, true); } }; var doCopy = function(e, isCut) { var data = host.getCopyText(); if (!data) return event.preventDefault(e); if (handleClipboardData(e, data)) { if (useragent.isIOS) { cut = isCut; text.value = "\n aa" + data + "a a\n"; text.setSelectionRange(4, 4 + data.length); copied = { value: data }; } isCut ? host.onCut() : host.onCopy(); if (!useragent.isIOS) event.preventDefault(e); } else { copied = true; text.value = data; text.select(); setTimeout(function(){ copied = false; resetValue(); resetSelection(); isCut ? host.onCut() : host.onCopy(); }); } }; var onCut = function(e) { doCopy(e, true); }; var onCopy = function(e) { doCopy(e, false); }; var onPaste = function(e) { var data = handleClipboardData(e); if (typeof data == "string") { if (data) host.onPaste(data, e); if (useragent.isIE) setTimeout(resetSelection); event.preventDefault(e); } else { text.value = ""; pasted = true; } }; event.addCommandKeyListener(text, host.onCommandKey.bind(host)); event.addListener(text, "select", onSelect); event.addListener(text, "input", onInput); event.addListener(text, "cut", onCut); event.addListener(text, "copy", onCopy); event.addListener(text, "paste", onPaste); // COMPOSITION var onCompositionStart = function(e) { if (inComposition || !host.onCompositionStart || host.$readOnly) return; // console.log("onCompositionStart", inComposition) inComposition = {}; inComposition.canUndo = host.session.$undoManager; host.onCompositionStart(); setTimeout(onCompositionUpdate, 0); host.on("mousedown", onCompositionEnd); if (inComposition.canUndo && !host.selection.isEmpty()) { host.insert(""); host.session.markUndoGroup(); host.selection.clearSelection(); } host.session.markUndoGroup(); }; var onCompositionUpdate = function() { // console.log("onCompositionUpdate", inComposition && JSON.stringify(text.value)) if (!inComposition || !host.onCompositionUpdate || host.$readOnly) return; var val = text.value.replace(/\x01/g, ""); if (inComposition.lastValue === val) return; host.onCompositionUpdate(val); if (inComposition.lastValue) host.undo(); if (inComposition.canUndo) inComposition.lastValue = val; if (inComposition.lastValue) { var r = host.selection.getRange(); host.insert(inComposition.lastValue); host.session.markUndoGroup(); inComposition.range = host.selection.getRange(); host.selection.setRange(r); host.selection.clearSelection(); } }; var onCompositionEnd = function(e) { if (!host.onCompositionEnd || host.$readOnly) return; // console.log("onCompositionEnd", inComposition &&inComposition.lastValue) var c = inComposition; inComposition = false; var timer = setTimeout(function() { timer = null; var str = text.value.replace(/\x01/g, ""); // console.log(str, c.lastValue) if (inComposition) return; else if (str == c.lastValue) resetValue(); else if (!c.lastValue && str) { resetValue(); sendText(str); } }); inputHandler = function compositionInputHandler(str) { // console.log("onCompositionEnd", str, c.lastValue) if (timer) clearTimeout(timer); str = str.replace(/\x01/g, ""); if (str == c.lastValue) return ""; if (c.lastValue && timer) host.undo(); return str; }; host.onCompositionEnd(); host.removeListener("mousedown", onCompositionEnd); if (e.type == "compositionend" && c.range) { host.selection.setRange(c.range); } // Workaround for #3027, #3045, #3097, #3100, #3249 var needsOnInput = (!!useragent.isChrome && useragent.isChrome >= 53) || (!!useragent.isWebKit && useragent.isWebKit >= 603); if (needsOnInput) { onInput(); } }; var syncComposition = lang.delayedCall(onCompositionUpdate, 50); event.addListener(text, "compositionstart", onCompositionStart); event.addListener(text, "compositionupdate", function(){syncComposition.schedule();}); event.addListener(text, "keyup", function(){syncComposition.schedule();}); event.addListener(text, "keydown", function(){syncComposition.schedule();}); event.addListener(text, "compositionend", onCompositionEnd); this.getElement = function() { return text; }; this.setReadOnly = function(readOnly) { text.readOnly = readOnly; }; this.onContextMenu = function(e) { afterContextMenu = true; resetSelection(host.selection.isEmpty()); host._emit("nativecontextmenu", {target: host, domEvent: e}); this.moveToMouse(e, true); }; this.moveToMouse = function(e, bringToFront) { if (!tempStyle) tempStyle = text.style.cssText; text.style.cssText = (bringToFront ? "z-index:100000;" : "") + "height:" + text.style.height + ";" + (useragent.isIE ? "opacity:0.1;" : ""); var rect = host.container.getBoundingClientRect(); var style = dom.computedStyle(host.container); var top = rect.top + (parseInt(style.borderTopWidth) || 0); var left = rect.left + (parseInt(rect.borderLeftWidth) || 0); var maxTop = rect.bottom - top - text.clientHeight -2; var move = function(e) { text.style.left = e.clientX - left - 2 + "px"; text.style.top = Math.min(e.clientY - top - 2, maxTop) + "px"; }; move(e); if (e.type != "mousedown") return; if (host.renderer.$keepTextAreaAtCursor) host.renderer.$keepTextAreaAtCursor = null; clearTimeout(closeTimeout); // on windows context menu is opened after mouseup if (useragent.isWin) event.capture(host.container, move, onContextMenuClose); }; this.onContextMenuClose = onContextMenuClose; var closeTimeout; function onContextMenuClose() { clearTimeout(closeTimeout); closeTimeout = setTimeout(function () { if (tempStyle) { text.style.cssText = tempStyle; tempStyle = ''; } if (host.renderer.$keepTextAreaAtCursor == null) { host.renderer.$keepTextAreaAtCursor = true; host.renderer.$moveTextAreaToCursor(); } }, 0); } var onContextMenu = function(e) { host.textInput.onContextMenu(e); onContextMenuClose(); }; event.addListener(text, "mouseup", onContextMenu); event.addListener(text, "mousedown", function(e) { e.preventDefault(); onContextMenuClose(); }); event.addListener(host.renderer.scroller, "contextmenu", onContextMenu); event.addListener(text, "contextmenu", onContextMenu); if (useragent.isIOS) { var typingResetTimeout = null; var typing = false; parentNode.addEventListener("keydown", function (e) { if (typingResetTimeout) clearTimeout(typingResetTimeout); typing = true; }); parentNode.addEventListener("keyup", function (e) { typingResetTimeout = setTimeout(function () { typing = false; }, 100); }); // IOS doesn't fire events for arrow keys, but this unique hack changes everything! var detectArrowKeys = function(e) { if (document.activeElement !== text) return; if (typing) return; if (cut) { return setTimeout(function () { cut = false; }, 100); } var selectionStart = text.selectionStart; var selectionEnd = text.selectionEnd; text.setSelectionRange(4, 5); if (selectionStart == selectionEnd) { switch (selectionStart) { case 0: host.onCommandKey(null, 0, KEYS.up); break; case 1: host.onCommandKey(null, 0, KEYS.home); break; case 2: host.onCommandKey(null, MODS.option, KEYS.left); break; case 4: host.onCommandKey(null, 0, KEYS.left); break; case 5: host.onCommandKey(null, 0, KEYS.right); break; case 7: host.onCommandKey(null, MODS.option, KEYS.right); break; case 8: host.onCommandKey(null, 0, KEYS.end); break; case 9: host.onCommandKey(null, 0, KEYS.down); break; } } else { switch (selectionEnd) { case 6: host.onCommandKey(null, MODS.shift, KEYS.right); break; case 7: host.onCommandKey(null, MODS.shift | MODS.option, KEYS.right); break; case 8: host.onCommandKey(null, MODS.shift, KEYS.end); break; case 9: host.onCommandKey(null, MODS.shift, KEYS.down); break; } switch (selectionStart) { case 0: host.onCommandKey(null, MODS.shift, KEYS.up); break; case 1: host.onCommandKey(null, MODS.shift, KEYS.home); break; case 2: host.onCommandKey(null, MODS.shift | MODS.option, KEYS.left); break; case 3: host.onCommandKey(null, MODS.shift, KEYS.left); break; } } }; // On iOS, "selectionchange" can only be attached to the document object... document.addEventListener("selectionchange", detectArrowKeys); host.on("destroy", function() { document.removeEventListener("selectionchange", detectArrowKeys); }); } }; exports.TextInput = TextInput; }); ================================================ FILE: lib/ace/keyboard/vim.js ================================================ // CodeMirror, copyright (c) by Marijn Haverbeke and others // Distributed under an MIT license: http://codemirror.net/LICENSE /** * Supported keybindings: * Too many to list. Refer to defaultKeyMap below. * * Supported Ex commands: * Refer to defaultExCommandMap below. * * Registers: unnamed, -, a-z, A-Z, 0-9 * (Does not respect the special case for number registers when delete * operator is made with these commands: %, (, ), , /, ?, n, N, {, } ) * TODO: Implement the remaining registers. * * Marks: a-z, A-Z, and 0-9 * TODO: Implement the remaining special marks. They have more complex * behavior. * * Events: * 'vim-mode-change' - raised on the editor anytime the current mode changes, * Event object: {mode: "visual", subMode: "linewise"} * * Code structure: * 1. Default keymap * 2. Variable declarations and short basic helpers * 3. Instance (External API) implementation * 4. Internal state tracking objects (input state, counter) implementation * and instanstiation * 5. Key handler (the main command dispatcher) implementation * 6. Motion, operator, and action implementations * 7. Helper functions for the key handler, motions, operators, and actions * 8. Set up Vim to work as a keymap for CodeMirror. * 9. Ex command implementations. */ define(function(require, exports, module) { 'use strict'; function log() { var d = ""; function format(p) { if (typeof p != "object") return p + ""; if ("line" in p) { return p.line + ":" + p.ch; } if ("anchor" in p) { return format(p.anchor) + "->" + format(p.head); } if (Array.isArray(p)) return "[" + p.map(function(x) { return format(x); }) + "]"; return JSON.stringify(p); } for (var i = 0; i < arguments.length; i++) { var p = arguments[i]; var f = format(p); d += f + " "; } console.log(d); } var Range = require("../range").Range; var EventEmitter = require("../lib/event_emitter").EventEmitter; var dom = require("../lib/dom"); var oop = require("../lib/oop"); var KEYS = require("../lib/keys"); var event = require("../lib/event"); var Search = require("../search").Search; var useragent = require("../lib/useragent"); var SearchHighlight = require("../search_highlight").SearchHighlight; var multiSelectCommands = require("../commands/multi_select_commands"); var TextModeTokenRe = require("../mode/text").Mode.prototype.tokenRe; require("../multi_select"); var CodeMirror = function(ace) { this.ace = ace; this.state = {}; this.marks = {}; this.$uid = 0; this.onChange = this.onChange.bind(this); this.onSelectionChange = this.onSelectionChange.bind(this); this.onBeforeEndOperation = this.onBeforeEndOperation.bind(this); this.ace.on('change', this.onChange); this.ace.on('changeSelection', this.onSelectionChange); this.ace.on('beforeEndOperation', this.onBeforeEndOperation); }; CodeMirror.Pos = function(line, ch) { if (!(this instanceof Pos)) return new Pos(line, ch); this.line = line; this.ch = ch; }; CodeMirror.defineOption = function(name, val, setter) {}; CodeMirror.commands = { redo: function(cm) { cm.ace.redo(); }, undo: function(cm) { cm.ace.undo(); }, newlineAndIndent: function(cm) { cm.ace.insert("\n"); } }; CodeMirror.keyMap = {}; CodeMirror.addClass = CodeMirror.rmClass = CodeMirror.e_stop = function() {}; CodeMirror.keyName = function(e) { if (e.key) return e.key; var key = (KEYS[e.keyCode] || ""); if (key.length == 1) key = key.toUpperCase(); key = event.getModifierString(e).replace(/(^|-)\w/g, function(m) { return m.toUpperCase(); }) + key; return key; }; CodeMirror.keyMap['default'] = function(key) { return function(cm) { var cmd = cm.ace.commands.commandKeyBinding[key.toLowerCase()]; return cmd && cm.ace.execCommand(cmd) !== false; }; }; CodeMirror.lookupKey = function lookupKey(key, map, handle) { if (typeof map == "string") map = CodeMirror.keyMap[map]; var found = typeof map == "function" ? map(key) : map[key]; if (found === false) return "nothing"; if (found === "...") return "multi"; if (found != null && handle(found)) return "handled"; if (map.fallthrough) { if (!Array.isArray(map.fallthrough)) return lookupKey(key, map.fallthrough, handle); for (var i = 0; i < map.fallthrough.length; i++) { var result = lookupKey(key, map.fallthrough[i], handle); if (result) return result; } } }; CodeMirror.signal = function(o, name, e) { return o._signal(name, e) }; CodeMirror.on = event.addListener; CodeMirror.off = event.removeListener; CodeMirror.isWordChar = function(ch) { if (ch < "\x7f") return /^\w$/.test(ch); TextModeTokenRe.lastIndex = 0; return TextModeTokenRe.test(ch); }; (function() { oop.implement(CodeMirror.prototype, EventEmitter); this.destroy = function() { this.ace.off('change', this.onChange); this.ace.off('changeSelection', this.onSelectionChange); this.ace.off('beforeEndOperation', this.onBeforeEndOperation); this.removeOverlay(); }; this.virtualSelectionMode = function() { return this.ace.inVirtualSelectionMode && this.ace.selection.index; }; this.onChange = function(delta) { var change = { text: delta.action[0] == 'i' ? delta.lines : [] }; var curOp = this.curOp = this.curOp || {}; if (!curOp.changeHandlers) curOp.changeHandlers = this._eventRegistry["change"] && this._eventRegistry["change"].slice(); if (this.virtualSelectionMode()) return; if (!curOp.lastChange) { curOp.lastChange = curOp.change = change; } else { curOp.lastChange.next = curOp.lastChange = change; } this.$updateMarkers(delta); }; this.onSelectionChange = function() { var curOp = this.curOp = this.curOp || {}; if (!curOp.cursorActivityHandlers) curOp.cursorActivityHandlers = this._eventRegistry["cursorActivity"] && this._eventRegistry["cursorActivity"].slice(); this.curOp.cursorActivity = true; if (this.ace.inMultiSelectMode) { this.ace.keyBinding.removeKeyboardHandler(multiSelectCommands.keyboardHandler); } }; this.operation = function(fn, force) { if (!force && this.curOp || force && this.curOp && this.curOp.force) { return fn(); } if (force || !this.ace.curOp) { if (this.curOp) this.onBeforeEndOperation(); } if (!this.ace.curOp) { var prevOp = this.ace.prevOp; this.ace.startOperation({ command: { name: "vim", scrollIntoView: "cursor" } }); } var curOp = this.curOp = this.curOp || {}; this.curOp.force = force; var result = fn(); if (this.ace.curOp && this.ace.curOp.command.name == "vim") { this.ace.endOperation(); if (!curOp.cursorActivity && !curOp.lastChange && prevOp) this.ace.prevOp = prevOp; } if (force || !this.ace.curOp) { if (this.curOp) this.onBeforeEndOperation(); } return result; }; this.onBeforeEndOperation = function() { var op = this.curOp; if (op) { if (op.change) { this.signal("change", op.change, op); } if (op && op.cursorActivity) { this.signal("cursorActivity", null, op); } this.curOp = null; } }; this.signal = function(eventName, e, handlers) { var listeners = handlers ? handlers[eventName + "Handlers"] : (this._eventRegistry || {})[eventName]; if (!listeners) return; listeners = listeners.slice(); for (var i=0; i 0) { point.row += rowShift; point.column += point.row == end.row ? colShift : 0; continue; } if (!isInsert && cmp2 <= 0) { point.row = start.row; point.column = start.column; if (cmp2 === 0) point.bias = 1; } } }; var Marker = function(cm, id, row, column) { this.cm = cm; this.id = id; this.row = row; this.column = column; cm.marks[this.id] = this; }; Marker.prototype.clear = function() { delete this.cm.marks[this.id] }; Marker.prototype.find = function() { return toCmPos(this) }; this.setBookmark = function(cursor, options) { var bm = new Marker(this, this.$uid++, cursor.line, cursor.ch); if (!options || !options.insertLeft) bm.$insertRight = true; this.marks[bm.id] = bm; return bm; }; this.moveH = function(increment, unit) { if (unit == 'char') { var sel = this.ace.selection; sel.clearSelection(); sel.moveCursorBy(0, increment); } }; this.findPosV = function(start, amount, unit, goalColumn) { if (unit == 'page') { var renderer = this.ace.renderer; var config = renderer.layerConfig; amount = amount * Math.floor(config.height / config.lineHeight); unit = 'line'; } if (unit == 'line') { var screenPos = this.ace.session.documentToScreenPosition(start.line, start.ch); if (goalColumn != null) screenPos.column = goalColumn; screenPos.row += amount; // not what codemirror does but vim mode needs only this screenPos.row = Math.min(Math.max(0, screenPos.row), this.ace.session.getScreenLength() - 1); var pos = this.ace.session.screenToDocumentPosition(screenPos.row, screenPos.column); return toCmPos(pos); } else { debugger; } }; this.charCoords = function(pos, mode) { if (mode == 'div' || !mode) { var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch); return {left: sc.column, top: sc.row}; }if (mode == 'local') { var renderer = this.ace.renderer; var sc = this.ace.session.documentToScreenPosition(pos.line, pos.ch); var lh = renderer.layerConfig.lineHeight; var cw = renderer.layerConfig.characterWidth; var top = lh * sc.row; return {left: sc.column * cw, top: top, bottom: top + lh}; } }; this.coordsChar = function(pos, mode) { var renderer = this.ace.renderer; if (mode == 'local') { var row = Math.max(0, Math.floor(pos.top / renderer.lineHeight)); var col = Math.max(0, Math.floor(pos.left / renderer.characterWidth)); var ch = renderer.session.screenToDocumentPosition(row, col); return toCmPos(ch); } else if (mode == 'div') { throw "not implemented"; } }; this.getSearchCursor = function(query, pos, caseFold) { var caseSensitive = false; var isRegexp = false; if (query instanceof RegExp && !query.global) { caseSensitive = !query.ignoreCase; query = query.source; isRegexp = true; } var search = new Search(); if (pos.ch == undefined) pos.ch = Number.MAX_VALUE; var acePos = {row: pos.line, column: pos.ch}; var cm = this; var last = null; return { findNext: function() { return this.find(false) }, findPrevious: function() {return this.find(true) }, find: function(back) { search.setOptions({ needle: query, caseSensitive: caseSensitive, wrap: false, backwards: back, regExp: isRegexp, start: last || acePos }); var range = search.find(cm.ace.session); if (range && range.isEmpty()) { if (cm.getLine(range.start.row).length == range.start.column) { search.$options.start = range; range = search.find(cm.ace.session); } } last = range; return last; }, from: function() { return last && toCmPos(last.start) }, to: function() { return last && toCmPos(last.end) }, replace: function(text) { if (last) { last.end = cm.ace.session.doc.replace(last, text); } } }; }; this.scrollTo = function(x, y) { var renderer = this.ace.renderer; var config = renderer.layerConfig; var maxHeight = config.maxHeight; maxHeight -= (renderer.$size.scrollerHeight - renderer.lineHeight) * renderer.$scrollPastEnd; if (y != null) this.ace.session.setScrollTop(Math.max(0, Math.min(y, maxHeight))); if (x != null) this.ace.session.setScrollLeft(Math.max(0, Math.min(x, config.width))); }; this.scrollInfo = function() { return 0; }; this.scrollIntoView = function(pos, margin) { if (pos) { var renderer = this.ace.renderer; var viewMargin = { "top": 0, "bottom": margin }; renderer.scrollCursorIntoView(toAcePos(pos), (renderer.lineHeight * 2) / renderer.$size.scrollerHeight, viewMargin); } }; this.getLine = function(row) { return this.ace.session.getLine(row) }; this.getRange = function(s, e) { return this.ace.session.getTextRange(new Range(s.line, s.ch, e.line, e.ch)); }; this.replaceRange = function(text, s, e) { if (!e) e = s; return this.ace.session.replace(new Range(s.line, s.ch, e.line, e.ch), text); }; this.replaceSelections = function(p) { var sel = this.ace.selection; if (this.ace.inVirtualSelectionMode) { this.ace.session.replace(sel.getRange(), p[0] || ""); return; } sel.inVirtualSelectionMode = true; var ranges = sel.rangeList.ranges; if (!ranges.length) ranges = [this.ace.multiSelect.getRange()]; for (var i = ranges.length; i--;) this.ace.session.replace(ranges[i], p[i] || ""); sel.inVirtualSelectionMode = false; }; this.getSelection = function() { return this.ace.getSelectedText(); }; this.getSelections = function() { return this.listSelections().map(function(x) { return this.getRange(x.anchor, x.head); }, this); }; this.getInputField = function() { return this.ace.textInput.getElement(); }; this.getWrapperElement = function() { return this.ace.containter; }; var optMap = { indentWithTabs: "useSoftTabs", indentUnit: "tabSize", tabSize: "tabSize", firstLineNumber: "firstLineNumber", readOnly: "readOnly" }; this.setOption = function(name, val) { this.state[name] = val; switch (name) { case 'indentWithTabs': name = optMap[name]; val = !val; break; default: name = optMap[name]; } if (name) this.ace.setOption(name, val); }; this.getOption = function(name, val) { var aceOpt = optMap[name]; if (aceOpt) val = this.ace.getOption(aceOpt); switch (name) { case 'indentWithTabs': name = optMap[name]; return !val; } return aceOpt ? val : this.state[name]; }; this.toggleOverwrite = function(on) { this.state.overwrite = on; return this.ace.setOverwrite(on); }; this.addOverlay = function(o) { if (!this.$searchHighlight || !this.$searchHighlight.session) { var highlight = new SearchHighlight(null, "ace_highlight-marker", "text"); var marker = this.ace.session.addDynamicMarker(highlight); highlight.id = marker.id; highlight.session = this.ace.session; highlight.destroy = function(o) { highlight.session.off("change", highlight.updateOnChange); highlight.session.off("changeEditor", highlight.destroy); highlight.session.removeMarker(highlight.id); highlight.session = null; }; highlight.updateOnChange = function(delta) { var row = delta.start.row; if (row == delta.end.row) highlight.cache[row] = undefined; else highlight.cache.splice(row, highlight.cache.length); }; highlight.session.on("changeEditor", highlight.destroy); highlight.session.on("change", highlight.updateOnChange); } var re = new RegExp(o.query.source, "gmi"); this.$searchHighlight = o.highlight = highlight; this.$searchHighlight.setRegexp(re); this.ace.renderer.updateBackMarkers(); }; this.removeOverlay = function(o) { if (this.$searchHighlight && this.$searchHighlight.session) { this.$searchHighlight.destroy(); } }; this.getScrollInfo = function() { var renderer = this.ace.renderer; var config = renderer.layerConfig; return { left: renderer.scrollLeft, top: renderer.scrollTop, height: config.maxHeight, width: config.width, clientHeight: config.height, clientWidth: config.width }; }; this.getValue = function() { return this.ace.getValue(); }; this.setValue = function(v) { return this.ace.setValue(v); }; this.getTokenTypeAt = function(pos) { var token = this.ace.session.getTokenAt(pos.line, pos.ch); return token && /comment|string/.test(token.type) ? "string" : ""; }; this.findMatchingBracket = function(pos) { var m = this.ace.session.findMatchingBracket(toAcePos(pos)); return {to: m && toCmPos(m)}; }; this.indentLine = function(line, method) { if (method === true) this.ace.session.indentRows(line, line, "\t"); else if (method === false) this.ace.session.outdentRows(new Range(line, 0, line, 0)); }; this.indexFromPos = function(pos) { return this.ace.session.doc.positionToIndex(toAcePos(pos)); }; this.posFromIndex = function(index) { return toCmPos(this.ace.session.doc.indexToPosition(index)); }; this.focus = function(index) { return this.ace.focus(); }; this.blur = function(index) { return this.ace.blur(); }; this.defaultTextHeight = function(index) { return this.ace.renderer.layerConfig.lineHeight; }; this.scanForBracket = function(pos, dir, _, options) { var re = options.bracketRegex.source; if (dir == 1) { var m = this.ace.session.$findClosingBracket(re.slice(1, 2), toAcePos(pos), /paren|text/); } else { var m = this.ace.session.$findOpeningBracket(re.slice(-2, -1), {row: pos.line, column: pos.ch + 1}, /paren|text/); } return m && {pos: toCmPos(m)}; }; this.refresh = function() { return this.ace.resize(true); }; this.getMode = function() { return { name : this.getOption("mode") }; } }).call(CodeMirror.prototype); function toAcePos(cmPos) { return {row: cmPos.line, column: cmPos.ch}; } function toCmPos(acePos) { return new Pos(acePos.row, acePos.column); } var StringStream = CodeMirror.StringStream = function(string, tabSize) { this.pos = this.start = 0; this.string = string; this.tabSize = tabSize || 8; this.lastColumnPos = this.lastColumnValue = 0; this.lineStart = 0; }; StringStream.prototype = { eol: function() {return this.pos >= this.string.length;}, sol: function() {return this.pos == this.lineStart;}, peek: function() {return this.string.charAt(this.pos) || undefined;}, next: function() { if (this.pos < this.string.length) return this.string.charAt(this.pos++); }, eat: function(match) { var ch = this.string.charAt(this.pos); if (typeof match == "string") var ok = ch == match; else var ok = ch && (match.test ? match.test(ch) : match(ch)); if (ok) {++this.pos; return ch;} }, eatWhile: function(match) { var start = this.pos; while (this.eat(match)){} return this.pos > start; }, eatSpace: function() { var start = this.pos; while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) ++this.pos; return this.pos > start; }, skipToEnd: function() {this.pos = this.string.length;}, skipTo: function(ch) { var found = this.string.indexOf(ch, this.pos); if (found > -1) {this.pos = found; return true;} }, backUp: function(n) {this.pos -= n;}, column: function() { throw "not implemented"; }, indentation: function() { throw "not implemented"; }, match: function(pattern, consume, caseInsensitive) { if (typeof pattern == "string") { var cased = function(str) {return caseInsensitive ? str.toLowerCase() : str;}; var substr = this.string.substr(this.pos, pattern.length); if (cased(substr) == cased(pattern)) { if (consume !== false) this.pos += pattern.length; return true; } } else { var match = this.string.slice(this.pos).match(pattern); if (match && match.index > 0) return null; if (match && consume !== false) this.pos += match[0].length; return match; } }, current: function(){return this.string.slice(this.start, this.pos);}, hideFirstChars: function(n, inner) { this.lineStart += n; try { return inner(); } finally { this.lineStart -= n; } } }; // todo replace with showCommandLine CodeMirror.defineExtension = function(name, fn) { CodeMirror.prototype[name] = fn; }; dom.importCssString(".normal-mode .ace_cursor{\ border: 1px solid red;\ background-color: red;\ opacity: 0.5;\ }\ .normal-mode .ace_hidden-cursors .ace_cursor{\ background-color: transparent;\ }\ .ace_dialog {\ position: absolute;\ left: 0; right: 0;\ background: white;\ z-index: 15;\ padding: .1em .8em;\ overflow: hidden;\ color: #333;\ }\ .ace_dialog-top {\ border-bottom: 1px solid #eee;\ top: 0;\ }\ .ace_dialog-bottom {\ border-top: 1px solid #eee;\ bottom: 0;\ }\ .ace_dialog input {\ border: none;\ outline: none;\ background: transparent;\ width: 20em;\ color: inherit;\ font-family: monospace;\ }", "vimMode"); (function() { function dialogDiv(cm, template, bottom) { var wrap = cm.ace.container; var dialog; dialog = wrap.appendChild(document.createElement("div")); if (bottom) dialog.className = "ace_dialog ace_dialog-bottom"; else dialog.className = "ace_dialog ace_dialog-top"; if (typeof template == "string") { dialog.innerHTML = template; } else { // Assuming it's a detached DOM element. dialog.appendChild(template); } return dialog; } function closeNotification(cm, newVal) { if (cm.state.currentNotificationClose) cm.state.currentNotificationClose(); cm.state.currentNotificationClose = newVal; } CodeMirror.defineExtension("openDialog", function(template, callback, options) { if (this.virtualSelectionMode()) return; if (!options) options = {}; closeNotification(this, null); var dialog = dialogDiv(this, template, options.bottom); var closed = false, me = this; function close(newVal) { if (typeof newVal == 'string') { inp.value = newVal; } else { if (closed) return; closed = true; dialog.parentNode.removeChild(dialog); me.focus(); if (options.onClose) options.onClose(dialog); } } var inp = dialog.getElementsByTagName("input")[0], button; if (inp) { if (options.value) { inp.value = options.value; if (options.select !== false) inp.select(); } if (options.onInput) CodeMirror.on(inp, "input", function(e) { options.onInput(e, inp.value, close);}); if (options.onKeyUp) CodeMirror.on(inp, "keyup", function(e) {options.onKeyUp(e, inp.value, close);}); CodeMirror.on(inp, "keydown", function(e) { if (options && options.onKeyDown && options.onKeyDown(e, inp.value, close)) { return; } if (e.keyCode == 27 || (options.closeOnEnter !== false && e.keyCode == 13)) { inp.blur(); CodeMirror.e_stop(e); close(); } if (e.keyCode == 13) callback(inp.value); }); if (options.closeOnBlur !== false) CodeMirror.on(inp, "blur", close); inp.focus(); } else if (button = dialog.getElementsByTagName("button")[0]) { CodeMirror.on(button, "click", function() { close(); me.focus(); }); if (options.closeOnBlur !== false) CodeMirror.on(button, "blur", close); button.focus(); } return close; }); CodeMirror.defineExtension("openNotification", function(template, options) { if (this.virtualSelectionMode()) return; closeNotification(this, close); var dialog = dialogDiv(this, template, options && options.bottom); var closed = false, doneTimer; var duration = options && typeof options.duration !== "undefined" ? options.duration : 5000; function close() { if (closed) return; closed = true; clearTimeout(doneTimer); dialog.parentNode.removeChild(dialog); } CodeMirror.on(dialog, 'click', function(e) { CodeMirror.e_preventDefault(e); close(); }); if (duration) doneTimer = setTimeout(close, duration); return close; }); })(); var defaultKeymap = [ // Key to key mapping. This goes first to make it possible to override // existing mappings. { keys: '', type: 'keyToKey', toKeys: 'h' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'k' }, { keys: '', type: 'keyToKey', toKeys: 'j' }, { keys: '', type: 'keyToKey', toKeys: 'l' }, { keys: '', type: 'keyToKey', toKeys: 'h', context: 'normal'}, { keys: '', type: 'keyToKey', toKeys: 'W' }, { keys: '', type: 'keyToKey', toKeys: 'B', context: 'normal' }, { keys: '', type: 'keyToKey', toKeys: 'w' }, { keys: '', type: 'keyToKey', toKeys: 'b', context: 'normal' }, { keys: '', type: 'keyToKey', toKeys: 'j' }, { keys: '', type: 'keyToKey', toKeys: 'k' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, { keys: '', type: 'keyToKey', toKeys: '', context: 'insert' }, { keys: 's', type: 'keyToKey', toKeys: 'cl', context: 'normal' }, { keys: 's', type: 'keyToKey', toKeys: 'c', context: 'visual'}, { keys: 'S', type: 'keyToKey', toKeys: 'cc', context: 'normal' }, { keys: 'S', type: 'keyToKey', toKeys: 'VdO', context: 'visual' }, { keys: '', type: 'keyToKey', toKeys: '0' }, { keys: '', type: 'keyToKey', toKeys: '$' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: '' }, { keys: '', type: 'keyToKey', toKeys: 'j^', context: 'normal' }, // Motions { keys: 'H', type: 'motion', motion: 'moveToTopLine', motionArgs: { linewise: true, toJumplist: true }}, { keys: 'M', type: 'motion', motion: 'moveToMiddleLine', motionArgs: { linewise: true, toJumplist: true }}, { keys: 'L', type: 'motion', motion: 'moveToBottomLine', motionArgs: { linewise: true, toJumplist: true }}, { keys: 'h', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: false }}, { keys: 'l', type: 'motion', motion: 'moveByCharacters', motionArgs: { forward: true }}, { keys: 'j', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, linewise: true }}, { keys: 'k', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, linewise: true }}, { keys: 'gj', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: true }}, { keys: 'gk', type: 'motion', motion: 'moveByDisplayLines', motionArgs: { forward: false }}, { keys: 'w', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false }}, { keys: 'W', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: false, bigWord: true }}, { keys: 'e', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, inclusive: true }}, { keys: 'E', type: 'motion', motion: 'moveByWords', motionArgs: { forward: true, wordEnd: true, bigWord: true, inclusive: true }}, { keys: 'b', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }}, { keys: 'B', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false, bigWord: true }}, { keys: 'ge', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, inclusive: true }}, { keys: 'gE', type: 'motion', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: true, bigWord: true, inclusive: true }}, { keys: '{', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: false, toJumplist: true }}, { keys: '}', type: 'motion', motion: 'moveByParagraph', motionArgs: { forward: true, toJumplist: true }}, { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: true }}, { keys: '', type: 'motion', motion: 'moveByPage', motionArgs: { forward: false }}, { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: true, explicitRepeat: true }}, { keys: '', type: 'motion', motion: 'moveByScroll', motionArgs: { forward: false, explicitRepeat: true }}, { keys: 'gg', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: 'G', type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: true, explicitRepeat: true, linewise: true, toJumplist: true }}, { keys: '0', type: 'motion', motion: 'moveToStartOfLine' }, { keys: '^', type: 'motion', motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '+', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true }}, { keys: '-', type: 'motion', motion: 'moveByLines', motionArgs: { forward: false, toFirstChar:true }}, { keys: '_', type: 'motion', motion: 'moveByLines', motionArgs: { forward: true, toFirstChar:true, repeatOffset:-1 }}, { keys: '$', type: 'motion', motion: 'moveToEol', motionArgs: { inclusive: true }}, { keys: '%', type: 'motion', motion: 'moveToMatchedSymbol', motionArgs: { inclusive: true, toJumplist: true }}, { keys: 'f', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: true , inclusive: true }}, { keys: 'F', type: 'motion', motion: 'moveToCharacter', motionArgs: { forward: false }}, { keys: 't', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: true, inclusive: true }}, { keys: 'T', type: 'motion', motion: 'moveTillCharacter', motionArgs: { forward: false }}, { keys: ';', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: true }}, { keys: ',', type: 'motion', motion: 'repeatLastCharacterSearch', motionArgs: { forward: false }}, { keys: '\'', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true, linewise: true}}, { keys: '`', type: 'motion', motion: 'goToMark', motionArgs: {toJumplist: true}}, { keys: ']`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true } }, { keys: '[`', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false } }, { keys: ']\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: true, linewise: true } }, { keys: '[\'', type: 'motion', motion: 'jumpToMark', motionArgs: { forward: false, linewise: true } }, // the next two aren't motions but must come before more general motion declarations { keys: ']p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true, matchIndent: true}}, { keys: '[p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true, matchIndent: true}}, { keys: ']', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: true, toJumplist: true}}, { keys: '[', type: 'motion', motion: 'moveToSymbol', motionArgs: { forward: false, toJumplist: true}}, { keys: '|', type: 'motion', motion: 'moveToColumn'}, { keys: 'o', type: 'motion', motion: 'moveToOtherHighlightedEnd', context:'visual'}, { keys: 'O', type: 'motion', motion: 'moveToOtherHighlightedEnd', motionArgs: {sameLine: true}, context:'visual'}, // Operators { keys: 'd', type: 'operator', operator: 'delete' }, { keys: 'y', type: 'operator', operator: 'yank' }, { keys: 'c', type: 'operator', operator: 'change' }, { keys: '>', type: 'operator', operator: 'indent', operatorArgs: { indentRight: true }}, { keys: '<', type: 'operator', operator: 'indent', operatorArgs: { indentRight: false }}, { keys: 'g~', type: 'operator', operator: 'changeCase' }, { keys: 'gu', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, isEdit: true }, { keys: 'gU', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, isEdit: true }, { keys: 'n', type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: true }}, { keys: 'N', type: 'motion', motion: 'findNext', motionArgs: { forward: false, toJumplist: true }}, // Operator-Motion dual commands { keys: 'x', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorMotionArgs: { visualLine: false }}, { keys: 'X', type: 'operatorMotion', operator: 'delete', motion: 'moveByCharacters', motionArgs: { forward: false }, operatorMotionArgs: { visualLine: true }}, { keys: 'D', type: 'operatorMotion', operator: 'delete', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, { keys: 'D', type: 'operator', operator: 'delete', operatorArgs: { linewise: true }, context: 'visual'}, { keys: 'Y', type: 'operatorMotion', operator: 'yank', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, { keys: 'Y', type: 'operator', operator: 'yank', operatorArgs: { linewise: true }, context: 'visual'}, { keys: 'C', type: 'operatorMotion', operator: 'change', motion: 'moveToEol', motionArgs: { inclusive: true }, context: 'normal'}, { keys: 'C', type: 'operator', operator: 'change', operatorArgs: { linewise: true }, context: 'visual'}, { keys: '~', type: 'operatorMotion', operator: 'changeCase', motion: 'moveByCharacters', motionArgs: { forward: true }, operatorArgs: { shouldMoveCursor: true }, context: 'normal'}, { keys: '~', type: 'operator', operator: 'changeCase', context: 'visual'}, { keys: '', type: 'operatorMotion', operator: 'delete', motion: 'moveByWords', motionArgs: { forward: false, wordEnd: false }, context: 'insert' }, // Actions { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: true }}, { keys: '', type: 'action', action: 'jumpListWalk', actionArgs: { forward: false }}, { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: true, linewise: true }}, { keys: '', type: 'action', action: 'scroll', actionArgs: { forward: false, linewise: true }}, { keys: 'a', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'charAfter' }, context: 'normal' }, { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'eol' }, context: 'normal' }, { keys: 'A', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'endOfSelectedArea' }, context: 'visual' }, { keys: 'i', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'inplace' }, context: 'normal' }, { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'firstNonBlank'}, context: 'normal' }, { keys: 'I', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { insertAt: 'startOfSelectedArea' }, context: 'visual' }, { keys: 'o', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: true }, context: 'normal' }, { keys: 'O', type: 'action', action: 'newLineAndEnterInsertMode', isEdit: true, interlaceInsertRepeat: true, actionArgs: { after: false }, context: 'normal' }, { keys: 'v', type: 'action', action: 'toggleVisualMode' }, { keys: 'V', type: 'action', action: 'toggleVisualMode', actionArgs: { linewise: true }}, { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, { keys: '', type: 'action', action: 'toggleVisualMode', actionArgs: { blockwise: true }}, { keys: 'gv', type: 'action', action: 'reselectLastSelection' }, { keys: 'J', type: 'action', action: 'joinLines', isEdit: true }, { keys: 'p', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: true, isEdit: true }}, { keys: 'P', type: 'action', action: 'paste', isEdit: true, actionArgs: { after: false, isEdit: true }}, { keys: 'r', type: 'action', action: 'replace', isEdit: true }, { keys: '@', type: 'action', action: 'replayMacro' }, { keys: 'q', type: 'action', action: 'enterMacroRecordMode' }, // Handle Replace-mode as a special case of insert mode. { keys: 'R', type: 'action', action: 'enterInsertMode', isEdit: true, actionArgs: { replace: true }}, { keys: 'u', type: 'action', action: 'undo', context: 'normal' }, { keys: 'u', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: true}, context: 'visual', isEdit: true }, { keys: 'U', type: 'operator', operator: 'changeCase', operatorArgs: {toLower: false}, context: 'visual', isEdit: true }, { keys: '', type: 'action', action: 'redo' }, { keys: 'm', type: 'action', action: 'setMark' }, { keys: '"', type: 'action', action: 'setRegister' }, { keys: 'zz', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }}, { keys: 'z.', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'center' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: 'zt', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }}, { keys: 'z', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'top' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: 'z-', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }}, { keys: 'zb', type: 'action', action: 'scrollToCursor', actionArgs: { position: 'bottom' }, motion: 'moveToFirstNonWhiteSpaceCharacter' }, { keys: '.', type: 'action', action: 'repeatLastEdit' }, { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: true, backtrack: false}}, { keys: '', type: 'action', action: 'incrementNumberToken', isEdit: true, actionArgs: {increase: false, backtrack: false}}, // Text object motions { keys: 'a', type: 'motion', motion: 'textObjectManipulation' }, { keys: 'i', type: 'motion', motion: 'textObjectManipulation', motionArgs: { textObjectInner: true }}, // Search { keys: '/', type: 'search', searchArgs: { forward: true, querySrc: 'prompt', toJumplist: true }}, { keys: '?', type: 'search', searchArgs: { forward: false, querySrc: 'prompt', toJumplist: true }}, { keys: '*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, { keys: '#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', wholeWordOnly: true, toJumplist: true }}, { keys: 'g*', type: 'search', searchArgs: { forward: true, querySrc: 'wordUnderCursor', toJumplist: true }}, { keys: 'g#', type: 'search', searchArgs: { forward: false, querySrc: 'wordUnderCursor', toJumplist: true }}, // Ex command { keys: ':', type: 'ex' } ]; /** * Ex commands * Care must be taken when adding to the default Ex command map. For any * pair of commands that have a shared prefix, at least one of their * shortNames must not match the prefix of the other command. */ var defaultExCommandMap = [ { name: 'colorscheme', shortName: 'colo' }, { name: 'map' }, { name: 'imap', shortName: 'im' }, { name: 'nmap', shortName: 'nm' }, { name: 'vmap', shortName: 'vm' }, { name: 'unmap' }, { name: 'write', shortName: 'w' }, { name: 'undo', shortName: 'u' }, { name: 'redo', shortName: 'red' }, { name: 'set', shortName: 'se' }, { name: 'set', shortName: 'se' }, { name: 'setlocal', shortName: 'setl' }, { name: 'setglobal', shortName: 'setg' }, { name: 'sort', shortName: 'sor' }, { name: 'substitute', shortName: 's', possiblyAsync: true }, { name: 'nohlsearch', shortName: 'noh' }, { name: 'delmarks', shortName: 'delm' }, { name: 'registers', shortName: 'reg', excludeFromCommandHistory: true }, { name: 'global', shortName: 'g' } ]; var Pos = CodeMirror.Pos; var Vim = function() { return vimApi; } //{ function enterVimMode(cm) { cm.setOption('disableInput', true); cm.setOption('showCursorWhenSelecting', false); CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); cm.on('cursorActivity', onCursorActivity); maybeInitVimState(cm); CodeMirror.on(cm.getInputField(), 'paste', getOnPasteFn(cm)); } function leaveVimMode(cm) { cm.setOption('disableInput', false); cm.off('cursorActivity', onCursorActivity); CodeMirror.off(cm.getInputField(), 'paste', getOnPasteFn(cm)); cm.state.vim = null; } function detachVimMap(cm, next) { if (this == CodeMirror.keyMap.vim) CodeMirror.rmClass(cm.getWrapperElement(), "cm-fat-cursor"); if (!next || next.attach != attachVimMap) leaveVimMode(cm); } function attachVimMap(cm, prev) { if (this == CodeMirror.keyMap.vim) CodeMirror.addClass(cm.getWrapperElement(), "cm-fat-cursor"); if (!prev || prev.attach != attachVimMap) enterVimMode(cm); } // Deprecated, simply setting the keymap works again. CodeMirror.defineOption('vimMode', false, function(cm, val, prev) { if (val && cm.getOption("keyMap") != "vim") cm.setOption("keyMap", "vim"); else if (!val && prev != CodeMirror.Init && /^vim/.test(cm.getOption("keyMap"))) cm.setOption("keyMap", "default"); }); function cmKey(key, cm) { if (!cm) { return undefined; } var vimKey = cmKeyToVimKey(key); if (!vimKey) { return false; } var cmd = CodeMirror.Vim.findKey(cm, vimKey); if (typeof cmd == 'function') { CodeMirror.signal(cm, 'vim-keypress', vimKey); } return cmd; } var modifiers = {'Shift': 'S', 'Ctrl': 'C', 'Alt': 'A', 'Cmd': 'D', 'Mod': 'A'}; var specialKeys = {Enter:'CR',Backspace:'BS',Delete:'Del'}; function cmKeyToVimKey(key) { if (key.charAt(0) == '\'') { // Keypress character binding of format "'a'" return key.charAt(1); } var pieces = key.split(/-(?!$)/); var lastPiece = pieces[pieces.length - 1]; if (pieces.length == 1 && pieces[0].length == 1) { // No-modifier bindings use literal character bindings above. Skip. return false; } else if (pieces.length == 2 && pieces[0] == 'Shift' && lastPiece.length == 1) { // Ignore Shift+char bindings as they should be handled by literal character. return false; } var hasCharacter = false; for (var i = 0; i < pieces.length; i++) { var piece = pieces[i]; if (piece in modifiers) { pieces[i] = modifiers[piece]; } else { hasCharacter = true; } if (piece in specialKeys) { pieces[i] = specialKeys[piece]; } } if (!hasCharacter) { // Vim does not support modifier only keys. return false; } // TODO: Current bindings expect the character to be lower case, but // it looks like vim key notation uses upper case. if (isUpperCase(lastPiece)) { pieces[pieces.length - 1] = lastPiece.toLowerCase(); } return '<' + pieces.join('-') + '>'; } function getOnPasteFn(cm) { var vim = cm.state.vim; if (!vim.onPasteFn) { vim.onPasteFn = function() { if (!vim.insertMode) { cm.setCursor(offsetCursor(cm.getCursor(), 0, 1)); actions.enterInsertMode(cm, {}, vim); } }; } return vim.onPasteFn; } var numberRegex = /[\d]/; var wordCharTest = [CodeMirror.isWordChar, function(ch) { return ch && !CodeMirror.isWordChar(ch) && !/\s/.test(ch); }], bigWordCharTest = [function(ch) { return /\S/.test(ch); }]; function makeKeyRange(start, size) { var keys = []; for (var i = start; i < start + size; i++) { keys.push(String.fromCharCode(i)); } return keys; } var upperCaseAlphabet = makeKeyRange(65, 26); var lowerCaseAlphabet = makeKeyRange(97, 26); var numbers = makeKeyRange(48, 10); var validMarks = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['<', '>']); var validRegisters = [].concat(upperCaseAlphabet, lowerCaseAlphabet, numbers, ['-', '"', '.', ':', '/']); function isLine(cm, line) { return line >= cm.firstLine() && line <= cm.lastLine(); } function isLowerCase(k) { return (/^[a-z]$/).test(k); } function isMatchableSymbol(k) { return '()[]{}'.indexOf(k) != -1; } function isNumber(k) { return numberRegex.test(k); } function isUpperCase(k) { return (/^[A-Z]$/).test(k); } function isWhiteSpaceString(k) { return (/^\s*$/).test(k); } function inArray(val, arr) { for (var i = 0; i < arr.length; i++) { if (arr[i] == val) { return true; } } return false; } var options = {}; function defineOption(name, defaultValue, type, aliases, callback) { if (defaultValue === undefined && !callback) { throw Error('defaultValue is required unless callback is provided'); } if (!type) { type = 'string'; } options[name] = { type: type, defaultValue: defaultValue, callback: callback }; if (aliases) { for (var i = 0; i < aliases.length; i++) { options[aliases[i]] = options[name]; } } if (defaultValue) { setOption(name, defaultValue); } } function setOption(name, value, cm, cfg) { var option = options[name]; cfg = cfg || {}; var scope = cfg.scope; if (!option) { throw Error('Unknown option: ' + name); } if (option.type == 'boolean') { if (value && value !== true) { throw Error('Invalid argument: ' + name + '=' + value); } else if (value !== false) { // Boolean options are set to true if value is not defined. value = true; } } if (option.callback) { if (scope !== 'local') { option.callback(value, undefined); } if (scope !== 'global' && cm) { option.callback(value, cm); } } else { if (scope !== 'local') { option.value = option.type == 'boolean' ? !!value : value; } if (scope !== 'global' && cm) { cm.state.vim.options[name] = {value: value}; } } } function getOption(name, cm, cfg) { var option = options[name]; cfg = cfg || {}; var scope = cfg.scope; if (!option) { throw Error('Unknown option: ' + name); } if (option.callback) { var local = cm && option.callback(undefined, cm); if (scope !== 'global' && local !== undefined) { return local; } if (scope !== 'local') { return option.callback(); } return; } else { var local = (scope !== 'global') && (cm && cm.state.vim.options[name]); return (local || (scope !== 'local') && option || {}).value; } } defineOption('filetype', undefined, 'string', ['ft'], function(name, cm) { // Option is local. Do nothing for global. if (cm === undefined) { return; } // The 'filetype' option proxies to the CodeMirror 'mode' option. if (name === undefined) { var mode = cm.getOption('mode'); return mode == 'null' ? '' : mode; } else { var mode = name == '' ? 'null' : name; cm.setOption('mode', mode); } }); var createCircularJumpList = function() { var size = 100; var pointer = -1; var head = 0; var tail = 0; var buffer = new Array(size); function add(cm, oldCur, newCur) { var current = pointer % size; var curMark = buffer[current]; function useNextSlot(cursor) { var next = ++pointer % size; var trashMark = buffer[next]; if (trashMark) { trashMark.clear(); } buffer[next] = cm.setBookmark(cursor); } if (curMark) { var markPos = curMark.find(); // avoid recording redundant cursor position if (markPos && !cursorEqual(markPos, oldCur)) { useNextSlot(oldCur); } } else { useNextSlot(oldCur); } useNextSlot(newCur); head = pointer; tail = pointer - size + 1; if (tail < 0) { tail = 0; } } function move(cm, offset) { pointer += offset; if (pointer > head) { pointer = head; } else if (pointer < tail) { pointer = tail; } var mark = buffer[(size + pointer) % size]; // skip marks that are temporarily removed from text buffer if (mark && !mark.find()) { var inc = offset > 0 ? 1 : -1; var newCur; var oldCur = cm.getCursor(); do { pointer += inc; mark = buffer[(size + pointer) % size]; // skip marks that are the same as current position if (mark && (newCur = mark.find()) && !cursorEqual(oldCur, newCur)) { break; } } while (pointer < head && pointer > tail); } return mark; } return { cachedCursor: undefined, //used for # and * jumps add: add, move: move }; }; // Returns an object to track the changes associated insert mode. It // clones the object that is passed in, or creates an empty object one if // none is provided. var createInsertModeChanges = function(c) { if (c) { // Copy construction return { changes: c.changes, expectCursorActivityForChange: c.expectCursorActivityForChange }; } return { // Change list changes: [], // Set to true on change, false on cursorActivity. expectCursorActivityForChange: false }; }; function MacroModeState() { this.latestRegister = undefined; this.isPlaying = false; this.isRecording = false; this.replaySearchQueries = []; this.onRecordingDone = undefined; this.lastInsertModeChanges = createInsertModeChanges(); } MacroModeState.prototype = { exitMacroRecordMode: function() { var macroModeState = vimGlobalState.macroModeState; if (macroModeState.onRecordingDone) { macroModeState.onRecordingDone(); // close dialog } macroModeState.onRecordingDone = undefined; macroModeState.isRecording = false; }, enterMacroRecordMode: function(cm, registerName) { var register = vimGlobalState.registerController.getRegister(registerName); if (register) { register.clear(); this.latestRegister = registerName; if (cm.openDialog) { this.onRecordingDone = cm.openDialog( '(recording)['+registerName+']', null, {bottom:true}); } this.isRecording = true; } } }; function maybeInitVimState(cm) { if (!cm.state.vim) { // Store instance state in the CodeMirror object. cm.state.vim = { inputState: new InputState(), // Vim's input state that triggered the last edit, used to repeat // motions and operators with '.'. lastEditInputState: undefined, // Vim's action command before the last edit, used to repeat actions // with '.' and insert mode repeat. lastEditActionCommand: undefined, // When using jk for navigation, if you move from a longer line to a // shorter line, the cursor may clip to the end of the shorter line. // If j is pressed again and cursor goes to the next line, the // cursor should go back to its horizontal position on the longer // line if it can. This is to keep track of the horizontal position. lastHPos: -1, // Doing the same with screen-position for gj/gk lastHSPos: -1, // The last motion command run. Cleared if a non-motion command gets // executed in between. lastMotion: null, marks: {}, // Mark for rendering fake cursor for visual mode. fakeCursor: null, insertMode: false, // Repeat count for changes made in insert mode, triggered by key // sequences like 3,i. Only exists when insertMode is true. insertModeRepeat: undefined, visualMode: false, // If we are in visual line mode. No effect if visualMode is false. visualLine: false, visualBlock: false, lastSelection: null, lastPastedText: null, sel: {}, // Buffer-local/window-local values of vim options. options: {} }; } return cm.state.vim; } var vimGlobalState; function resetVimGlobalState() { vimGlobalState = { // The current search query. searchQuery: null, // Whether we are searching backwards. searchIsReversed: false, // Replace part of the last substituted pattern lastSubstituteReplacePart: undefined, jumpList: createCircularJumpList(), macroModeState: new MacroModeState, // Recording latest f, t, F or T motion command. lastChararacterSearch: {increment:0, forward:true, selectedCharacter:''}, registerController: new RegisterController({}), // search history buffer searchHistoryController: new HistoryController(), // ex Command history buffer exCommandHistoryController : new HistoryController() }; for (var optionName in options) { var option = options[optionName]; option.value = option.defaultValue; } } var lastInsertModeKeyTimer; var vimApi= { buildKeyMap: function() { // TODO: Convert keymap into dictionary format for fast lookup. }, // Testing hook, though it might be useful to expose the register // controller anyways. getRegisterController: function() { return vimGlobalState.registerController; }, // Testing hook. resetVimGlobalState_: resetVimGlobalState, // Testing hook. getVimGlobalState_: function() { return vimGlobalState; }, // Testing hook. maybeInitVimState_: maybeInitVimState, suppressErrorLogging: false, InsertModeKey: InsertModeKey, map: function(lhs, rhs, ctx) { // Add user defined key bindings. exCommandDispatcher.map(lhs, rhs, ctx); }, unmap: function(lhs, ctx) { exCommandDispatcher.unmap(lhs, ctx); }, // TODO: Expose setOption and getOption as instance methods. Need to decide how to namespace // them, or somehow make them work with the existing CodeMirror setOption/getOption API. setOption: setOption, getOption: getOption, defineOption: defineOption, defineEx: function(name, prefix, func){ if (!prefix) { prefix = name; } else if (name.indexOf(prefix) !== 0) { throw new Error('(Vim.defineEx) "'+prefix+'" is not a prefix of "'+name+'", command not registered'); } exCommands[name]=func; exCommandDispatcher.commandMap_[prefix]={name:name, shortName:prefix, type:'api'}; }, handleKey: function (cm, key, origin) { var command = this.findKey(cm, key, origin); if (typeof command === 'function') { return command(); } }, /** * This is the outermost function called by CodeMirror, after keys have * been mapped to their Vim equivalents. * * Finds a command based on the key (and cached keys if there is a * multi-key sequence). Returns `undefined` if no key is matched, a noop * function if a partial match is found (multi-key), and a function to * execute the bound command if a a key is matched. The function always * returns true. */ findKey: function(cm, key, origin) { var vim = maybeInitVimState(cm); function handleMacroRecording() { var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isRecording) { if (key == 'q') { macroModeState.exitMacroRecordMode(); clearInputState(cm); return true; } if (origin != 'mapping') { logKey(macroModeState, key); } } } function handleEsc() { if (key == '') { // Clear input state and get back to normal mode. clearInputState(cm); if (vim.visualMode) { exitVisualMode(cm); } else if (vim.insertMode) { exitInsertMode(cm); } return true; } } function doKeyToKey(keys) { // TODO: prevent infinite recursion. var match; while (keys) { // Pull off one command key, which is either a single character // or a special sequence wrapped in '<' and '>', e.g. ''. match = (/<\w+-.+?>|<\w+>|./).exec(keys); key = match[0]; keys = keys.substring(match.index + key.length); CodeMirror.Vim.handleKey(cm, key, 'mapping'); } } function handleKeyInsertMode() { if (handleEsc()) { return true; } var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; var keysAreChars = key.length == 1; var match = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); // Need to check all key substrings in insert mode. while (keys.length > 1 && match.type != 'full') { var keys = vim.inputState.keyBuffer = keys.slice(1); var thisMatch = commandDispatcher.matchCommand(keys, defaultKeymap, vim.inputState, 'insert'); if (thisMatch.type != 'none') { match = thisMatch; } } if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } lastInsertModeKeyTimer = window.setTimeout( function() { if (vim.insertMode && vim.inputState.keyBuffer) { clearInputState(cm); } }, getOption('insertModeEscKeysTimeout')); return !keysAreChars; } if (lastInsertModeKeyTimer) { window.clearTimeout(lastInsertModeKeyTimer); } if (keysAreChars) { var selections = cm.listSelections(); for (var i = 0; i < selections.length; i++) { var here = selections[i].head; cm.replaceRange('', offsetCursor(here, 0, -(keys.length - 1)), here, '+input'); } vimGlobalState.macroModeState.lastInsertModeChanges.changes.pop(); } clearInputState(cm); return match.command; } function handleKeyNonInsertMode() { if (handleMacroRecording() || handleEsc()) { return true; } var keys = vim.inputState.keyBuffer = vim.inputState.keyBuffer + key; if (/^[1-9]\d*$/.test(keys)) { return true; } var keysMatcher = /^(\d*)(.*)$/.exec(keys); if (!keysMatcher) { clearInputState(cm); return false; } var context = vim.visualMode ? 'visual' : 'normal'; var match = commandDispatcher.matchCommand(keysMatcher[2] || keysMatcher[1], defaultKeymap, vim.inputState, context); if (match.type == 'none') { clearInputState(cm); return false; } else if (match.type == 'partial') { return true; } vim.inputState.keyBuffer = ''; var keysMatcher = /^(\d*)(.*)$/.exec(keys); if (keysMatcher[1] && keysMatcher[1] != '0') { vim.inputState.pushRepeatDigit(keysMatcher[1]); } return match.command; } var command; if (vim.insertMode) { command = handleKeyInsertMode(); } else { command = handleKeyNonInsertMode(); } if (command === false) { return undefined; } else if (command === true) { // TODO: Look into using CodeMirror's multi-key handling. // Return no-op since we are caching the key. Counts as handled, but // don't want act on it just yet. return function() { return true; }; } else { return function() { if ((command.operator || command.isEdit) && cm.getOption('readOnly')) return; // ace_patch return cm.operation(function() { cm.curOp.isVimOp = true; try { if (command.type == 'keyToKey') { doKeyToKey(command.toKeys); } else { commandDispatcher.processCommand(cm, vim, command); } } catch (e) { // clear VIM state in case it's in a bad state. cm.state.vim = undefined; maybeInitVimState(cm); if (!CodeMirror.Vim.suppressErrorLogging) { console['log'](e); } throw e; } return true; }); }; } }, handleEx: function(cm, input) { exCommandDispatcher.processCommand(cm, input); }, defineMotion: defineMotion, defineAction: defineAction, defineOperator: defineOperator, mapCommand: mapCommand, _mapCommand: _mapCommand, defineRegister: defineRegister, exitVisualMode: exitVisualMode, exitInsertMode: exitInsertMode }; // Represents the current input state. function InputState() { this.prefixRepeat = []; this.motionRepeat = []; this.operator = null; this.operatorArgs = null; this.motion = null; this.motionArgs = null; this.keyBuffer = []; // For matching multi-key commands. this.registerName = null; // Defaults to the unnamed register. } InputState.prototype.pushRepeatDigit = function(n) { if (!this.operator) { this.prefixRepeat = this.prefixRepeat.concat(n); } else { this.motionRepeat = this.motionRepeat.concat(n); } }; InputState.prototype.getRepeat = function() { var repeat = 0; if (this.prefixRepeat.length > 0 || this.motionRepeat.length > 0) { repeat = 1; if (this.prefixRepeat.length > 0) { repeat *= parseInt(this.prefixRepeat.join(''), 10); } if (this.motionRepeat.length > 0) { repeat *= parseInt(this.motionRepeat.join(''), 10); } } return repeat; }; function clearInputState(cm, reason) { cm.state.vim.inputState = new InputState(); CodeMirror.signal(cm, 'vim-command-done', reason); } /* * Register stores information about copy and paste registers. Besides * text, a register must store whether it is linewise (i.e., when it is * pasted, should it insert itself into a new line, or should the text be * inserted at the cursor position.) */ function Register(text, linewise, blockwise) { this.clear(); this.keyBuffer = [text || '']; this.insertModeChanges = []; this.searchQueries = []; this.linewise = !!linewise; this.blockwise = !!blockwise; } Register.prototype = { setText: function(text, linewise, blockwise) { this.keyBuffer = [text || '']; this.linewise = !!linewise; this.blockwise = !!blockwise; }, pushText: function(text, linewise) { // if this register has ever been set to linewise, use linewise. if (linewise) { if (!this.linewise) { this.keyBuffer.push('\n'); } this.linewise = true; } this.keyBuffer.push(text); }, pushInsertModeChanges: function(changes) { this.insertModeChanges.push(createInsertModeChanges(changes)); }, pushSearchQuery: function(query) { this.searchQueries.push(query); }, clear: function() { this.keyBuffer = []; this.insertModeChanges = []; this.searchQueries = []; this.linewise = false; }, toString: function() { return this.keyBuffer.join(''); } }; /** * Defines an external register. * * The name should be a single character that will be used to reference the register. * The register should support setText, pushText, clear, and toString(). See Register * for a reference implementation. */ function defineRegister(name, register) { var registers = vimGlobalState.registerController.registers[name]; if (!name || name.length != 1) { throw Error('Register name must be 1 character'); } // ace_patch registers[name] = register; validRegisters.push(name); } /* * vim registers allow you to keep many independent copy and paste buffers. * See http://usevim.com/2012/04/13/registers/ for an introduction. * * RegisterController keeps the state of all the registers. An initial * state may be passed in. The unnamed register '"' will always be * overridden. */ function RegisterController(registers) { this.registers = registers; this.unnamedRegister = registers['"'] = new Register(); registers['.'] = new Register(); registers[':'] = new Register(); registers['/'] = new Register(); } RegisterController.prototype = { pushText: function(registerName, operator, text, linewise, blockwise) { if (linewise && text.charAt(0) == '\n') { text = text.slice(1) + '\n'; } if (linewise && text.charAt(text.length - 1) !== '\n'){ text += '\n'; } // Lowercase and uppercase registers refer to the same register. // Uppercase just means append. var register = this.isValidRegister(registerName) ? this.getRegister(registerName) : null; // if no register/an invalid register was specified, things go to the // default registers if (!register) { switch (operator) { case 'yank': // The 0 register contains the text from the most recent yank. this.registers['0'] = new Register(text, linewise, blockwise); break; case 'delete': case 'change': if (text.indexOf('\n') == -1) { // Delete less than 1 line. Update the small delete register. this.registers['-'] = new Register(text, linewise); } else { // Shift down the contents of the numbered registers and put the // deleted text into register 1. this.shiftNumericRegisters_(); this.registers['1'] = new Register(text, linewise); } break; } // Make sure the unnamed register is set to what just happened this.unnamedRegister.setText(text, linewise, blockwise); return; } // If we've gotten to this point, we've actually specified a register var append = isUpperCase(registerName); if (append) { register.pushText(text, linewise); } else { register.setText(text, linewise, blockwise); } // The unnamed register always has the same value as the last used // register. this.unnamedRegister.setText(register.toString(), linewise); }, // Gets the register named @name. If one of @name doesn't already exist, // create it. If @name is invalid, return the unnamedRegister. getRegister: function(name) { if (!this.isValidRegister(name)) { return this.unnamedRegister; } name = name.toLowerCase(); if (!this.registers[name]) { this.registers[name] = new Register(); } return this.registers[name]; }, isValidRegister: function(name) { return name && inArray(name, validRegisters); }, shiftNumericRegisters_: function() { for (var i = 9; i >= 2; i--) { this.registers[i] = this.getRegister('' + (i - 1)); } } }; function HistoryController() { this.historyBuffer = []; this.iterator; this.initialPrefix = null; } HistoryController.prototype = { // the input argument here acts a user entered prefix for a small time // until we start autocompletion in which case it is the autocompleted. nextMatch: function (input, up) { var historyBuffer = this.historyBuffer; var dir = up ? -1 : 1; if (this.initialPrefix === null) this.initialPrefix = input; for (var i = this.iterator + dir; up ? i >= 0 : i < historyBuffer.length; i+= dir) { var element = historyBuffer[i]; for (var j = 0; j <= element.length; j++) { if (this.initialPrefix == element.substring(0, j)) { this.iterator = i; return element; } } } // should return the user input in case we reach the end of buffer. if (i >= historyBuffer.length) { this.iterator = historyBuffer.length; return this.initialPrefix; } // return the last autocompleted query or exCommand as it is. if (i < 0 ) return input; }, pushInput: function(input) { var index = this.historyBuffer.indexOf(input); if (index > -1) this.historyBuffer.splice(index, 1); if (input.length) this.historyBuffer.push(input); }, reset: function() { this.initialPrefix = null; this.iterator = this.historyBuffer.length; } }; var commandDispatcher = { matchCommand: function(keys, keyMap, inputState, context) { var matches = commandMatches(keys, keyMap, context, inputState); if (!matches.full && !matches.partial) { return {type: 'none'}; } else if (!matches.full && matches.partial) { return {type: 'partial'}; } var bestMatch; for (var i = 0; i < matches.full.length; i++) { var match = matches.full[i]; if (!bestMatch) { bestMatch = match; } } if (bestMatch.keys.slice(-11) == '') { var character = lastChar(keys); if (//.test(character)) return {type: 'none'}; inputState.selectedCharacter = character; } return {type: 'full', command: bestMatch}; }, processCommand: function(cm, vim, command) { vim.inputState.repeatOverride = command.repeatOverride; switch (command.type) { case 'motion': this.processMotion(cm, vim, command); break; case 'operator': this.processOperator(cm, vim, command); break; case 'operatorMotion': this.processOperatorMotion(cm, vim, command); break; case 'action': this.processAction(cm, vim, command); break; case 'search': this.processSearch(cm, vim, command); break; case 'ex': case 'keyToEx': this.processEx(cm, vim, command); break; default: break; } }, processMotion: function(cm, vim, command) { vim.inputState.motion = command.motion; vim.inputState.motionArgs = copyArgs(command.motionArgs); this.evalInput(cm, vim); }, processOperator: function(cm, vim, command) { var inputState = vim.inputState; if (inputState.operator) { if (inputState.operator == command.operator) { // Typing an operator twice like 'dd' makes the operator operate // linewise inputState.motion = 'expandToLine'; inputState.motionArgs = { linewise: true }; this.evalInput(cm, vim); return; } else { // 2 different operators in a row doesn't make sense. clearInputState(cm); } } inputState.operator = command.operator; inputState.operatorArgs = copyArgs(command.operatorArgs); if (vim.visualMode) { // Operating on a selection in visual mode. We don't need a motion. this.evalInput(cm, vim); } }, processOperatorMotion: function(cm, vim, command) { var visualMode = vim.visualMode; var operatorMotionArgs = copyArgs(command.operatorMotionArgs); if (operatorMotionArgs) { // Operator motions may have special behavior in visual mode. if (visualMode && operatorMotionArgs.visualLine) { vim.visualLine = true; } } this.processOperator(cm, vim, command); if (!visualMode) { this.processMotion(cm, vim, command); } }, processAction: function(cm, vim, command) { var inputState = vim.inputState; var repeat = inputState.getRepeat(); var repeatIsExplicit = !!repeat; var actionArgs = copyArgs(command.actionArgs) || {}; if (inputState.selectedCharacter) { actionArgs.selectedCharacter = inputState.selectedCharacter; } // Actions may or may not have motions and operators. Do these first. if (command.operator) { this.processOperator(cm, vim, command); } if (command.motion) { this.processMotion(cm, vim, command); } if (command.motion || command.operator) { this.evalInput(cm, vim); } actionArgs.repeat = repeat || 1; actionArgs.repeatIsExplicit = repeatIsExplicit; actionArgs.registerName = inputState.registerName; clearInputState(cm); vim.lastMotion = null; if (command.isEdit) { this.recordLastEdit(vim, inputState, command); } actions[command.action](cm, actionArgs, vim); }, processSearch: function(cm, vim, command) { if (!cm.getSearchCursor) { // Search depends on SearchCursor. return; } var forward = command.searchArgs.forward; var wholeWordOnly = command.searchArgs.wholeWordOnly; getSearchState(cm).setReversed(!forward); var promptPrefix = (forward) ? '/' : '?'; var originalQuery = getSearchState(cm).getQuery(); var originalScrollPos = cm.getScrollInfo(); function handleQuery(query, ignoreCase, smartCase) { vimGlobalState.searchHistoryController.pushInput(query); vimGlobalState.searchHistoryController.reset(); try { updateSearchQuery(cm, query, ignoreCase, smartCase); } catch (e) { showConfirm(cm, 'Invalid regex: ' + query); clearInputState(cm); return; } commandDispatcher.processMotion(cm, vim, { type: 'motion', motion: 'findNext', motionArgs: { forward: true, toJumplist: command.searchArgs.toJumplist } }); } function onPromptClose(query) { cm.scrollTo(originalScrollPos.left, originalScrollPos.top); handleQuery(query, true /** ignoreCase */, true /** smartCase */); var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isRecording) { logSearchQuery(macroModeState, query); } } function onPromptKeyUp(e, query, close) { var keyName = CodeMirror.keyName(e), up; if (keyName == 'Up' || keyName == 'Down') { up = keyName == 'Up' ? true : false; query = vimGlobalState.searchHistoryController.nextMatch(query, up) || ''; close(query); } else { if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') vimGlobalState.searchHistoryController.reset(); } var parsedQuery; try { parsedQuery = updateSearchQuery(cm, query, true /** ignoreCase */, true /** smartCase */); } catch (e) { // Swallow bad regexes for incremental search. } if (parsedQuery) { cm.scrollIntoView(findNext(cm, !forward, parsedQuery), 30); } else { clearSearchHighlight(cm); cm.scrollTo(originalScrollPos.left, originalScrollPos.top); } } function onPromptKeyDown(e, query, close) { var keyName = CodeMirror.keyName(e); if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || (keyName == 'Backspace' && query == '')) { vimGlobalState.searchHistoryController.pushInput(query); vimGlobalState.searchHistoryController.reset(); updateSearchQuery(cm, originalQuery); clearSearchHighlight(cm); cm.scrollTo(originalScrollPos.left, originalScrollPos.top); CodeMirror.e_stop(e); clearInputState(cm); close(); cm.focus(); } else if (keyName == 'Ctrl-U') { // Ctrl-U clears input. CodeMirror.e_stop(e); close(''); } } switch (command.searchArgs.querySrc) { case 'prompt': var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isPlaying) { var query = macroModeState.replaySearchQueries.shift(); handleQuery(query, true /** ignoreCase */, false /** smartCase */); } else { showPrompt(cm, { onClose: onPromptClose, prefix: promptPrefix, desc: searchPromptDesc, onKeyUp: onPromptKeyUp, onKeyDown: onPromptKeyDown }); } break; case 'wordUnderCursor': var word = expandWordUnderCursor(cm, false /** inclusive */, true /** forward */, false /** bigWord */, true /** noSymbol */); var isKeyword = true; if (!word) { word = expandWordUnderCursor(cm, false /** inclusive */, true /** forward */, false /** bigWord */, false /** noSymbol */); isKeyword = false; } if (!word) { return; } var query = cm.getLine(word.start.line).substring(word.start.ch, word.end.ch); if (isKeyword && wholeWordOnly) { query = '\\b' + query + '\\b'; } else { query = escapeRegex(query); } // cachedCursor is used to save the old position of the cursor // when * or # causes vim to seek for the nearest word and shift // the cursor before entering the motion. vimGlobalState.jumpList.cachedCursor = cm.getCursor(); cm.setCursor(word.start); handleQuery(query, true /** ignoreCase */, false /** smartCase */); break; } }, processEx: function(cm, vim, command) { function onPromptClose(input) { // Give the prompt some time to close so that if processCommand shows // an error, the elements don't overlap. vimGlobalState.exCommandHistoryController.pushInput(input); vimGlobalState.exCommandHistoryController.reset(); exCommandDispatcher.processCommand(cm, input); } function onPromptKeyDown(e, input, close) { var keyName = CodeMirror.keyName(e), up; if (keyName == 'Esc' || keyName == 'Ctrl-C' || keyName == 'Ctrl-[' || (keyName == 'Backspace' && input == '')) { vimGlobalState.exCommandHistoryController.pushInput(input); vimGlobalState.exCommandHistoryController.reset(); CodeMirror.e_stop(e); clearInputState(cm); close(); cm.focus(); } if (keyName == 'Up' || keyName == 'Down') { up = keyName == 'Up' ? true : false; input = vimGlobalState.exCommandHistoryController.nextMatch(input, up) || ''; close(input); } else if (keyName == 'Ctrl-U') { // Ctrl-U clears input. CodeMirror.e_stop(e); close(''); } else { if ( keyName != 'Left' && keyName != 'Right' && keyName != 'Ctrl' && keyName != 'Alt' && keyName != 'Shift') vimGlobalState.exCommandHistoryController.reset(); } } if (command.type == 'keyToEx') { // Handle user defined Ex to Ex mappings exCommandDispatcher.processCommand(cm, command.exArgs.input); } else { if (vim.visualMode) { showPrompt(cm, { onClose: onPromptClose, prefix: ':', value: '\'<,\'>', onKeyDown: onPromptKeyDown}); } else { showPrompt(cm, { onClose: onPromptClose, prefix: ':', onKeyDown: onPromptKeyDown}); } } }, evalInput: function(cm, vim) { // If the motion comand is set, execute both the operator and motion. // Otherwise return. var inputState = vim.inputState; var motion = inputState.motion; var motionArgs = inputState.motionArgs || {}; var operator = inputState.operator; var operatorArgs = inputState.operatorArgs || {}; var registerName = inputState.registerName; var sel = vim.sel; // TODO: Make sure cm and vim selections are identical outside visual mode. var origHead = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.head): cm.getCursor('head')); var origAnchor = copyCursor(vim.visualMode ? clipCursorToContent(cm, sel.anchor) : cm.getCursor('anchor')); var oldHead = copyCursor(origHead); var oldAnchor = copyCursor(origAnchor); var newHead, newAnchor; var repeat; if (operator) { this.recordLastEdit(vim, inputState); } if (inputState.repeatOverride !== undefined) { // If repeatOverride is specified, that takes precedence over the // input state's repeat. Used by Ex mode and can be user defined. repeat = inputState.repeatOverride; } else { repeat = inputState.getRepeat(); } if (repeat > 0 && motionArgs.explicitRepeat) { motionArgs.repeatIsExplicit = true; } else if (motionArgs.noRepeat || (!motionArgs.explicitRepeat && repeat === 0)) { repeat = 1; motionArgs.repeatIsExplicit = false; } if (inputState.selectedCharacter) { // If there is a character input, stick it in all of the arg arrays. motionArgs.selectedCharacter = operatorArgs.selectedCharacter = inputState.selectedCharacter; } motionArgs.repeat = repeat; clearInputState(cm); if (motion) { var motionResult = motions[motion](cm, origHead, motionArgs, vim); vim.lastMotion = motions[motion]; if (!motionResult) { return; } if (motionArgs.toJumplist) { if (!operator && cm.ace.curOp != null) cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace_patch var jumpList = vimGlobalState.jumpList; // if the current motion is # or *, use cachedCursor var cachedCursor = jumpList.cachedCursor; if (cachedCursor) { recordJumpPosition(cm, cachedCursor, motionResult); delete jumpList.cachedCursor; } else { recordJumpPosition(cm, origHead, motionResult); } } if (motionResult instanceof Array) { newAnchor = motionResult[0]; newHead = motionResult[1]; } else { newHead = motionResult; } // TODO: Handle null returns from motion commands better. if (!newHead) { newHead = copyCursor(origHead); } if (vim.visualMode) { if (!(vim.visualBlock && newHead.ch === Infinity)) { newHead = clipCursorToContent(cm, newHead, vim.visualBlock); } if (newAnchor) { newAnchor = clipCursorToContent(cm, newAnchor, true); } newAnchor = newAnchor || oldAnchor; sel.anchor = newAnchor; sel.head = newHead; updateCmSelection(cm); updateMark(cm, vim, '<', cursorIsBefore(newAnchor, newHead) ? newAnchor : newHead); updateMark(cm, vim, '>', cursorIsBefore(newAnchor, newHead) ? newHead : newAnchor); } else if (!operator) { newHead = clipCursorToContent(cm, newHead); cm.setCursor(newHead.line, newHead.ch); } } if (operator) { if (operatorArgs.lastSel) { // Replaying a visual mode operation newAnchor = oldAnchor; var lastSel = operatorArgs.lastSel; var lineOffset = Math.abs(lastSel.head.line - lastSel.anchor.line); var chOffset = Math.abs(lastSel.head.ch - lastSel.anchor.ch); if (lastSel.visualLine) { // Linewise Visual mode: The same number of lines. newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } else if (lastSel.visualBlock) { // Blockwise Visual mode: The same number of lines and columns. newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch + chOffset); } else if (lastSel.head.line == lastSel.anchor.line) { // Normal Visual mode within one line: The same number of characters. newHead = Pos(oldAnchor.line, oldAnchor.ch + chOffset); } else { // Normal Visual mode with several lines: The same number of lines, in the // last line the same number of characters as in the last line the last time. newHead = Pos(oldAnchor.line + lineOffset, oldAnchor.ch); } vim.visualMode = true; vim.visualLine = lastSel.visualLine; vim.visualBlock = lastSel.visualBlock; sel = vim.sel = { anchor: newAnchor, head: newHead }; updateCmSelection(cm); } else if (vim.visualMode) { operatorArgs.lastSel = { anchor: copyCursor(sel.anchor), head: copyCursor(sel.head), visualBlock: vim.visualBlock, visualLine: vim.visualLine }; } var curStart, curEnd, linewise, mode; var cmSel; if (vim.visualMode) { // Init visual op curStart = cursorMin(sel.head, sel.anchor); curEnd = cursorMax(sel.head, sel.anchor); linewise = vim.visualLine || operatorArgs.linewise; mode = vim.visualBlock ? 'block' : linewise ? 'line' : 'char'; cmSel = makeCmSelection(cm, { anchor: curStart, head: curEnd }, mode); if (linewise) { var ranges = cmSel.ranges; if (mode == 'block') { // Linewise operators in visual block mode extend to end of line for (var i = 0; i < ranges.length; i++) { ranges[i].head.ch = lineLength(cm, ranges[i].head.line); } } else if (mode == 'line') { ranges[0].head = Pos(ranges[0].head.line + 1, 0); } } } else { // Init motion op curStart = copyCursor(newAnchor || oldAnchor); curEnd = copyCursor(newHead || oldHead); if (cursorIsBefore(curEnd, curStart)) { var tmp = curStart; curStart = curEnd; curEnd = tmp; } linewise = motionArgs.linewise || operatorArgs.linewise; if (linewise) { // Expand selection to entire line. expandSelectionToLine(cm, curStart, curEnd); } else if (motionArgs.forward) { // Clip to trailing newlines only if the motion goes forward. clipToLine(cm, curStart, curEnd); } mode = 'char'; var exclusive = !motionArgs.inclusive || linewise; cmSel = makeCmSelection(cm, { anchor: curStart, head: curEnd }, mode, exclusive); } cm.setSelections(cmSel.ranges, cmSel.primary); vim.lastMotion = null; operatorArgs.repeat = repeat; // For indent in visual mode. operatorArgs.registerName = registerName; // Keep track of linewise as it affects how paste and change behave. operatorArgs.linewise = linewise; var operatorMoveTo = operators[operator]( cm, operatorArgs, cmSel.ranges, oldAnchor, newHead); if (vim.visualMode) { exitVisualMode(cm, operatorMoveTo != null); } if (operatorMoveTo) { cm.setCursor(operatorMoveTo); } } }, recordLastEdit: function(vim, inputState, actionCommand) { var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isPlaying) { return; } vim.lastEditInputState = inputState; vim.lastEditActionCommand = actionCommand; macroModeState.lastInsertModeChanges.changes = []; macroModeState.lastInsertModeChanges.expectCursorActivityForChange = false; } }; /** * typedef {Object{line:number,ch:number}} Cursor An object containing the * position of the cursor. */ // All of the functions below return Cursor objects. var motions = { moveToTopLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).top + motionArgs.repeat -1; return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToMiddleLine: function(cm) { var range = getUserVisibleLines(cm); var line = Math.floor((range.top + range.bottom) * 0.5); return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, moveToBottomLine: function(cm, _head, motionArgs) { var line = getUserVisibleLines(cm).bottom - motionArgs.repeat +1; return Pos(line, findFirstNonWhiteSpaceCharacter(cm.getLine(line))); }, expandToLine: function(_cm, head, motionArgs) { // Expands forward to end of line, and then to next line if repeat is // >1. Does not handle backward motion! var cur = head; return Pos(cur.line + motionArgs.repeat - 1, Infinity); }, findNext: function(cm, _head, motionArgs) { var state = getSearchState(cm); var query = state.getQuery(); if (!query) { return; } var prev = !motionArgs.forward; // If search is initiated with ? instead of /, negate direction. prev = (state.isReversed()) ? !prev : prev; highlightSearchMatches(cm, query); return findNext(cm, prev/** prev */, query, motionArgs.repeat); }, goToMark: function(cm, _head, motionArgs, vim) { var mark = vim.marks[motionArgs.selectedCharacter]; if (mark) { var pos = mark.find(); return motionArgs.linewise ? { line: pos.line, ch: findFirstNonWhiteSpaceCharacter(cm.getLine(pos.line)) } : pos; } return null; }, moveToOtherHighlightedEnd: function(cm, _head, motionArgs, vim) { if (vim.visualBlock && motionArgs.sameLine) { var sel = vim.sel; return [ clipCursorToContent(cm, Pos(sel.anchor.line, sel.head.ch)), clipCursorToContent(cm, Pos(sel.head.line, sel.anchor.ch)) ]; } else { return ([vim.sel.head, vim.sel.anchor]); } }, jumpToMark: function(cm, head, motionArgs, vim) { var best = head; for (var i = 0; i < motionArgs.repeat; i++) { var cursor = best; for (var key in vim.marks) { if (!isLowerCase(key)) { continue; } var mark = vim.marks[key].find(); var isWrongDirection = (motionArgs.forward) ? cursorIsBefore(mark, cursor) : cursorIsBefore(cursor, mark); if (isWrongDirection) { continue; } if (motionArgs.linewise && (mark.line == cursor.line)) { continue; } var equal = cursorEqual(cursor, best); var between = (motionArgs.forward) ? cursorIsBetween(cursor, mark, best) : cursorIsBetween(best, mark, cursor); if (equal || between) { best = mark; } } } if (motionArgs.linewise) { // Vim places the cursor on the first non-whitespace character of // the line if there is one, else it places the cursor at the end // of the line, regardless of whether a mark was found. best = Pos(best.line, findFirstNonWhiteSpaceCharacter(cm.getLine(best.line))); } return best; }, moveByCharacters: function(_cm, head, motionArgs) { var cur = head; var repeat = motionArgs.repeat; var ch = motionArgs.forward ? cur.ch + repeat : cur.ch - repeat; return Pos(cur.line, ch); }, moveByLines: function(cm, head, motionArgs, vim) { var cur = head; var endCh = cur.ch; // Depending what our last motion was, we may want to do different // things. If our last motion was moving vertically, we want to // preserve the HPos from our last horizontal move. If our last motion // was going to the end of a line, moving vertically we should go to // the end of the line, etc. switch (vim.lastMotion) { case this.moveByLines: case this.moveByDisplayLines: case this.moveByScroll: case this.moveToColumn: case this.moveToEol: endCh = vim.lastHPos; break; default: vim.lastHPos = endCh; } var repeat = motionArgs.repeat+(motionArgs.repeatOffset||0); var line = motionArgs.forward ? cur.line + repeat : cur.line - repeat; var first = cm.firstLine(); var last = cm.lastLine(); // Vim cancels linewise motions that start on an edge and move beyond // that edge. It does not cancel motions that do not start on an edge. if ((line < first && cur.line == first) || (line > last && cur.line == last)) { return; } // ace_patch{ var fold = cm.ace.session.getFoldLine(line); if (fold) { if (motionArgs.forward) { if (line > fold.start.row) line = fold.end.row + 1; } else { line = fold.start.row; } } // ace_patch} if (motionArgs.toFirstChar){ endCh=findFirstNonWhiteSpaceCharacter(cm.getLine(line)); vim.lastHPos = endCh; } vim.lastHSPos = cm.charCoords(Pos(line, endCh),'div').left; return Pos(line, endCh); }, moveByDisplayLines: function(cm, head, motionArgs, vim) { var cur = head; switch (vim.lastMotion) { case this.moveByDisplayLines: case this.moveByScroll: case this.moveByLines: case this.moveToColumn: case this.moveToEol: break; default: vim.lastHSPos = cm.charCoords(cur,'div').left; } var repeat = motionArgs.repeat; var res=cm.findPosV(cur,(motionArgs.forward ? repeat : -repeat),'line',vim.lastHSPos); if (res.hitSide) { if (motionArgs.forward) { var lastCharCoords = cm.charCoords(res, 'div'); var goalCoords = { top: lastCharCoords.top + 8, left: vim.lastHSPos }; var res = cm.coordsChar(goalCoords, 'div'); } else { var resCoords = cm.charCoords(Pos(cm.firstLine(), 0), 'div'); resCoords.left = vim.lastHSPos; res = cm.coordsChar(resCoords, 'div'); } } vim.lastHPos = res.ch; return res; }, moveByPage: function(cm, head, motionArgs) { // CodeMirror only exposes functions that move the cursor page down, so // doing this bad hack to move the cursor and move it back. evalInput // will move the cursor to where it should be in the end. var curStart = head; var repeat = motionArgs.repeat; return cm.findPosV(curStart, (motionArgs.forward ? repeat : -repeat), 'page'); }, moveByParagraph: function(cm, head, motionArgs) { var dir = motionArgs.forward ? 1 : -1; return findParagraph(cm, head, motionArgs.repeat, dir); }, moveByScroll: function(cm, head, motionArgs, vim) { var scrollbox = cm.getScrollInfo(); var curEnd = null; var repeat = motionArgs.repeat; if (!repeat) { repeat = scrollbox.clientHeight / (2 * cm.defaultTextHeight()); } var orig = cm.charCoords(head, 'local'); motionArgs.repeat = repeat; var curEnd = motions.moveByDisplayLines(cm, head, motionArgs, vim); if (!curEnd) { return null; } var dest = cm.charCoords(curEnd, 'local'); cm.scrollTo(null, scrollbox.top + dest.top - orig.top); return curEnd; }, moveByWords: function(cm, head, motionArgs) { return moveToWord(cm, head, motionArgs.repeat, !!motionArgs.forward, !!motionArgs.wordEnd, !!motionArgs.bigWord); }, moveTillCharacter: function(cm, _head, motionArgs) { var repeat = motionArgs.repeat; var curEnd = moveToCharacter(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter); var increment = motionArgs.forward ? -1 : 1; recordLastCharacterSearch(increment, motionArgs); if (!curEnd) return null; curEnd.ch += increment; return curEnd; }, moveToCharacter: function(cm, head, motionArgs) { var repeat = motionArgs.repeat; recordLastCharacterSearch(0, motionArgs); return moveToCharacter(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter) || head; }, moveToSymbol: function(cm, head, motionArgs) { var repeat = motionArgs.repeat; return findSymbol(cm, repeat, motionArgs.forward, motionArgs.selectedCharacter) || head; }, moveToColumn: function(cm, head, motionArgs, vim) { var repeat = motionArgs.repeat; // repeat is equivalent to which column we want to move to! vim.lastHPos = repeat - 1; vim.lastHSPos = cm.charCoords(head,'div').left; return moveToColumn(cm, repeat); }, moveToEol: function(cm, head, motionArgs, vim) { var cur = head; vim.lastHPos = Infinity; var retval= Pos(cur.line + motionArgs.repeat - 1, Infinity); var end=cm.clipPos(retval); end.ch--; vim.lastHSPos = cm.charCoords(end,'div').left; return retval; }, moveToFirstNonWhiteSpaceCharacter: function(cm, head) { // Go to the start of the line where the text begins, or the end for // whitespace-only lines var cursor = head; return Pos(cursor.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cursor.line))); }, moveToMatchedSymbol: function(cm, head) { var cursor = head; var line = cursor.line; var ch = cursor.ch; var lineText = cm.getLine(line); var symbol; do { symbol = lineText.charAt(ch++); if (symbol && isMatchableSymbol(symbol)) { var style = cm.getTokenTypeAt(Pos(line, ch)); if (style !== "string" && style !== "comment") { break; } } } while (symbol); if (symbol) { var matched = cm.findMatchingBracket(Pos(line, ch)); return matched.to; } else { return cursor; } }, moveToStartOfLine: function(_cm, head) { return Pos(head.line, 0); }, moveToLineOrEdgeOfDocument: function(cm, _head, motionArgs) { var lineNum = motionArgs.forward ? cm.lastLine() : cm.firstLine(); if (motionArgs.repeatIsExplicit) { lineNum = motionArgs.repeat - cm.getOption('firstLineNumber'); } return Pos(lineNum, findFirstNonWhiteSpaceCharacter(cm.getLine(lineNum))); }, textObjectManipulation: function(cm, head, motionArgs, vim) { // TODO: lots of possible exceptions that can be thrown here. Try da( // outside of a () block. // TODO: adding <> >< to this map doesn't work, presumably because // they're operators var mirroredPairs = {'(': ')', ')': '(', '{': '}', '}': '{', '[': ']', ']': '['}; var selfPaired = {'\'': true, '"': true}; var character = motionArgs.selectedCharacter; // 'b' refers to '()' block. // 'B' refers to '{}' block. if (character == 'b') { character = '('; } else if (character == 'B') { character = '{'; } // Inclusive is the difference between a and i // TODO: Instead of using the additional text object map to perform text // object operations, merge the map into the defaultKeyMap and use // motionArgs to define behavior. Define separate entries for 'aw', // 'iw', 'a[', 'i[', etc. var inclusive = !motionArgs.textObjectInner; var tmp; if (mirroredPairs[character]) { tmp = selectCompanionObject(cm, head, character, inclusive); } else if (selfPaired[character]) { tmp = findBeginningAndEnd(cm, head, character, inclusive); } else if (character === 'W') { tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, true /** bigWord */); } else if (character === 'w') { tmp = expandWordUnderCursor(cm, inclusive, true /** forward */, false /** bigWord */); } else if (character === 'p') { tmp = findParagraph(cm, head, motionArgs.repeat, 0, inclusive); motionArgs.linewise = true; if (vim.visualMode) { if (!vim.visualLine) { vim.visualLine = true; } } else { var operatorArgs = vim.inputState.operatorArgs; if (operatorArgs) { operatorArgs.linewise = true; } tmp.end.line--; } } else { // No text object defined for this, don't move. return null; } if (!cm.state.vim.visualMode) { return [tmp.start, tmp.end]; } else { return expandSelection(cm, tmp.start, tmp.end); } }, repeatLastCharacterSearch: function(cm, head, motionArgs) { var lastSearch = vimGlobalState.lastChararacterSearch; var repeat = motionArgs.repeat; var forward = motionArgs.forward === lastSearch.forward; var increment = (lastSearch.increment ? 1 : 0) * (forward ? -1 : 1); cm.moveH(-increment, 'char'); motionArgs.inclusive = forward ? true : false; var curEnd = moveToCharacter(cm, repeat, forward, lastSearch.selectedCharacter); if (!curEnd) { cm.moveH(increment, 'char'); return head; } curEnd.ch += increment; return curEnd; } }; function defineMotion(name, fn) { motions[name] = fn; } function fillArray(val, times) { var arr = []; for (var i = 0; i < times; i++) { arr.push(val); } return arr; } /** * An operator acts on a text selection. It receives the list of selections * as input. The corresponding CodeMirror selection is guaranteed to * match the input selection. */ var operators = { change: function(cm, args, ranges) { var finalHead, text; var vim = cm.state.vim; vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock = vim.visualBlock; if (!vim.visualMode) { var anchor = ranges[0].anchor, head = ranges[0].head; text = cm.getRange(anchor, head); var lastState = vim.lastEditInputState || {}; if (lastState.motion == "moveByWords" && !isWhiteSpaceString(text)) { // Exclude trailing whitespace if the range is not all whitespace. var match = (/\s+$/).exec(text); if (match && lastState.motionArgs && lastState.motionArgs.forward) { head = offsetCursor(head, 0, - match[0].length); text = text.slice(0, - match[0].length); } } var prevLineEnd = new Pos(anchor.line - 1, Number.MAX_VALUE); var wasLastLine = cm.firstLine() == cm.lastLine(); if (head.line > cm.lastLine() && args.linewise && !wasLastLine) { cm.replaceRange('', prevLineEnd, head); } else { cm.replaceRange('', anchor, head); } if (args.linewise) { // Push the next line back down, if there is a next line. if (!wasLastLine) { cm.setCursor(prevLineEnd); CodeMirror.commands.newlineAndIndent(cm); } // make sure cursor ends up at the end of the line. anchor.ch = Number.MAX_VALUE; } finalHead = anchor; } else { text = cm.getSelection(); var replacement = fillArray('', ranges.length); cm.replaceSelections(replacement); finalHead = cursorMin(ranges[0].head, ranges[0].anchor); } vimGlobalState.registerController.pushText( args.registerName, 'change', text, args.linewise, ranges.length > 1); actions.enterInsertMode(cm, {head: finalHead}, cm.state.vim); }, // delete is a javascript keyword. 'delete': function(cm, args, ranges) { var finalHead, text; var vim = cm.state.vim; if (!vim.visualBlock) { var anchor = ranges[0].anchor, head = ranges[0].head; if (args.linewise && head.line != cm.firstLine() && anchor.line == cm.lastLine() && anchor.line == head.line - 1) { // Special case for dd on last line (and first line). if (anchor.line == cm.firstLine()) { anchor.ch = 0; } else { anchor = Pos(anchor.line - 1, lineLength(cm, anchor.line - 1)); } } text = cm.getRange(anchor, head); cm.replaceRange('', anchor, head); finalHead = anchor; if (args.linewise) { finalHead = motions.moveToFirstNonWhiteSpaceCharacter(cm, anchor); } } else { text = cm.getSelection(); var replacement = fillArray('', ranges.length); cm.replaceSelections(replacement); finalHead = ranges[0].anchor; } vimGlobalState.registerController.pushText( args.registerName, 'delete', text, args.linewise, vim.visualBlock); return clipCursorToContent(cm, finalHead); }, indent: function(cm, args, ranges) { var vim = cm.state.vim; var startLine = ranges[0].anchor.line; var endLine = vim.visualBlock ? ranges[ranges.length - 1].anchor.line : ranges[0].head.line; // In visual mode, n> shifts the selection right n times, instead of // shifting n lines right once. var repeat = (vim.visualMode) ? args.repeat : 1; if (args.linewise) { // The only way to delete a newline is to delete until the start of // the next line, so in linewise mode evalInput will include the next // line. We don't want this in indent, so we go back a line. endLine--; } for (var i = startLine; i <= endLine; i++) { for (var j = 0; j < repeat; j++) { cm.indentLine(i, args.indentRight); } } return motions.moveToFirstNonWhiteSpaceCharacter(cm, ranges[0].anchor); }, changeCase: function(cm, args, ranges, oldAnchor, newHead) { var selections = cm.getSelections(); var swapped = []; var toLower = args.toLower; for (var j = 0; j < selections.length; j++) { var toSwap = selections[j]; var text = ''; if (toLower === true) { text = toSwap.toLowerCase(); } else if (toLower === false) { text = toSwap.toUpperCase(); } else { for (var i = 0; i < toSwap.length; i++) { var character = toSwap.charAt(i); text += isUpperCase(character) ? character.toLowerCase() : character.toUpperCase(); } } swapped.push(text); } cm.replaceSelections(swapped); if (args.shouldMoveCursor){ return newHead; } else if (!cm.state.vim.visualMode && args.linewise && ranges[0].anchor.line + 1 == ranges[0].head.line) { return motions.moveToFirstNonWhiteSpaceCharacter(cm, oldAnchor); } else if (args.linewise){ return oldAnchor; } else { return cursorMin(ranges[0].anchor, ranges[0].head); } }, yank: function(cm, args, ranges, oldAnchor) { var vim = cm.state.vim; var text = cm.getSelection(); var endPos = vim.visualMode ? cursorMin(vim.sel.anchor, vim.sel.head, ranges[0].head, ranges[0].anchor) : oldAnchor; vimGlobalState.registerController.pushText( args.registerName, 'yank', text, args.linewise, vim.visualBlock); return endPos; } }; function defineOperator(name, fn) { operators[name] = fn; } var actions = { jumpListWalk: function(cm, actionArgs, vim) { if (vim.visualMode) { return; } var repeat = actionArgs.repeat; var forward = actionArgs.forward; var jumpList = vimGlobalState.jumpList; var mark = jumpList.move(cm, forward ? repeat : -repeat); var markPos = mark ? mark.find() : undefined; markPos = markPos ? markPos : cm.getCursor(); cm.setCursor(markPos); cm.ace.curOp.command.scrollIntoView = "center-animate"; // ace_patch }, scroll: function(cm, actionArgs, vim) { if (vim.visualMode) { return; } var repeat = actionArgs.repeat || 1; var lineHeight = cm.defaultTextHeight(); var top = cm.getScrollInfo().top; var delta = lineHeight * repeat; var newPos = actionArgs.forward ? top + delta : top - delta; var cursor = copyCursor(cm.getCursor()); var cursorCoords = cm.charCoords(cursor, 'local'); if (actionArgs.forward) { if (newPos > cursorCoords.top) { cursor.line += (newPos - cursorCoords.top) / lineHeight; cursor.line = Math.ceil(cursor.line); cm.setCursor(cursor); cursorCoords = cm.charCoords(cursor, 'local'); cm.scrollTo(null, cursorCoords.top); } else { // Cursor stays within bounds. Just reposition the scroll window. cm.scrollTo(null, newPos); } } else { var newBottom = newPos + cm.getScrollInfo().clientHeight; if (newBottom < cursorCoords.bottom) { cursor.line -= (cursorCoords.bottom - newBottom) / lineHeight; cursor.line = Math.floor(cursor.line); cm.setCursor(cursor); cursorCoords = cm.charCoords(cursor, 'local'); cm.scrollTo( null, cursorCoords.bottom - cm.getScrollInfo().clientHeight); } else { // Cursor stays within bounds. Just reposition the scroll window. cm.scrollTo(null, newPos); } } }, scrollToCursor: function(cm, actionArgs) { var lineNum = cm.getCursor().line; var charCoords = cm.charCoords(Pos(lineNum, 0), 'local'); var height = cm.getScrollInfo().clientHeight; var y = charCoords.top; var lineHeight = charCoords.bottom - y; switch (actionArgs.position) { case 'center': y = y - (height / 2) + lineHeight; break; case 'bottom': y = y - height + lineHeight*1.4; break; case 'top': y = y + lineHeight*0.4; break; } cm.scrollTo(null, y); }, replayMacro: function(cm, actionArgs, vim) { var registerName = actionArgs.selectedCharacter; var repeat = actionArgs.repeat; var macroModeState = vimGlobalState.macroModeState; if (registerName == '@') { registerName = macroModeState.latestRegister; } while(repeat--){ executeMacroRegister(cm, vim, macroModeState, registerName); } }, enterMacroRecordMode: function(cm, actionArgs) { var macroModeState = vimGlobalState.macroModeState; var registerName = actionArgs.selectedCharacter; macroModeState.enterMacroRecordMode(cm, registerName); }, enterInsertMode: function(cm, actionArgs, vim) { if (cm.getOption('readOnly')) { return; } vim.insertMode = true; vim.insertModeRepeat = actionArgs && actionArgs.repeat || 1; var insertAt = (actionArgs) ? actionArgs.insertAt : null; var sel = vim.sel; var head = actionArgs.head || cm.getCursor('head'); var height = cm.listSelections().length; if (insertAt == 'eol') { head = Pos(head.line, lineLength(cm, head.line)); } else if (insertAt == 'charAfter') { head = offsetCursor(head, 0, 1); } else if (insertAt == 'firstNonBlank') { head = motions.moveToFirstNonWhiteSpaceCharacter(cm, head); } else if (insertAt == 'startOfSelectedArea') { if (!vim.visualBlock) { if (sel.head.line < sel.anchor.line) { head = sel.head; } else { head = Pos(sel.anchor.line, 0); } } else { head = Pos( Math.min(sel.head.line, sel.anchor.line), Math.min(sel.head.ch, sel.anchor.ch)); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'endOfSelectedArea') { if (!vim.visualBlock) { if (sel.head.line >= sel.anchor.line) { head = offsetCursor(sel.head, 0, 1); } else { head = Pos(sel.anchor.line, 0); } } else { head = Pos( Math.min(sel.head.line, sel.anchor.line), Math.max(sel.head.ch + 1, sel.anchor.ch)); height = Math.abs(sel.head.line - sel.anchor.line) + 1; } } else if (insertAt == 'inplace') { if (vim.visualMode){ return; } } cm.setOption('keyMap', 'vim-insert'); cm.setOption('disableInput', false); if (actionArgs && actionArgs.replace) { // Handle Replace-mode as a special case of insert mode. cm.toggleOverwrite(true); cm.setOption('keyMap', 'vim-replace'); CodeMirror.signal(cm, "vim-mode-change", {mode: "replace"}); } else { cm.setOption('keyMap', 'vim-insert'); CodeMirror.signal(cm, "vim-mode-change", {mode: "insert"}); } if (!vimGlobalState.macroModeState.isPlaying) { // Only record if not replaying. cm.on('change', onChange); CodeMirror.on(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); } if (vim.visualMode) { exitVisualMode(cm); } selectForInsert(cm, head, height); }, toggleVisualMode: function(cm, actionArgs, vim) { var repeat = actionArgs.repeat; var anchor = cm.getCursor(); var head; // TODO: The repeat should actually select number of characters/lines // equal to the repeat times the size of the previous visual // operation. if (!vim.visualMode) { // Entering visual mode vim.visualMode = true; vim.visualLine = !!actionArgs.linewise; vim.visualBlock = !!actionArgs.blockwise; head = clipCursorToContent( cm, Pos(anchor.line, anchor.ch + repeat - 1), true /** includeLineBreak */); vim.sel = { anchor: anchor, head: head }; CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); updateCmSelection(cm); updateMark(cm, vim, '<', cursorMin(anchor, head)); updateMark(cm, vim, '>', cursorMax(anchor, head)); } else if (vim.visualLine ^ actionArgs.linewise || vim.visualBlock ^ actionArgs.blockwise) { // Toggling between modes vim.visualLine = !!actionArgs.linewise; vim.visualBlock = !!actionArgs.blockwise; CodeMirror.signal(cm, "vim-mode-change", {mode: "visual", subMode: vim.visualLine ? "linewise" : vim.visualBlock ? "blockwise" : ""}); updateCmSelection(cm); } else { exitVisualMode(cm); } }, reselectLastSelection: function(cm, _actionArgs, vim) { var lastSelection = vim.lastSelection; if (vim.visualMode) { updateLastSelection(cm, vim); } if (lastSelection) { var anchor = lastSelection.anchorMark.find(); var head = lastSelection.headMark.find(); if (!anchor || !head) { // If the marks have been destroyed due to edits, do nothing. return; } vim.sel = { anchor: anchor, head: head }; vim.visualMode = true; vim.visualLine = lastSelection.visualLine; vim.visualBlock = lastSelection.visualBlock; updateCmSelection(cm); updateMark(cm, vim, '<', cursorMin(anchor, head)); updateMark(cm, vim, '>', cursorMax(anchor, head)); CodeMirror.signal(cm, 'vim-mode-change', { mode: 'visual', subMode: vim.visualLine ? 'linewise' : vim.visualBlock ? 'blockwise' : ''}); } }, joinLines: function(cm, actionArgs, vim) { var curStart, curEnd; if (vim.visualMode) { curStart = cm.getCursor('anchor'); curEnd = cm.getCursor('head'); if (cursorIsBefore(curEnd, curStart)) { var tmp = curEnd; curEnd = curStart; curStart = tmp; } curEnd.ch = lineLength(cm, curEnd.line) - 1; } else { // Repeat is the number of lines to join. Minimum 2 lines. var repeat = Math.max(actionArgs.repeat, 2); curStart = cm.getCursor(); curEnd = clipCursorToContent(cm, Pos(curStart.line + repeat - 1, Infinity)); } var finalCh = 0; for (var i = curStart.line; i < curEnd.line; i++) { finalCh = lineLength(cm, curStart.line); var tmp = Pos(curStart.line + 1, lineLength(cm, curStart.line + 1)); var text = cm.getRange(curStart, tmp); text = text.replace(/\n\s*/g, ' '); cm.replaceRange(text, curStart, tmp); } var curFinalPos = Pos(curStart.line, finalCh); if (vim.visualMode) { exitVisualMode(cm, false); } cm.setCursor(curFinalPos); }, newLineAndEnterInsertMode: function(cm, actionArgs, vim) { vim.insertMode = true; var insertAt = copyCursor(cm.getCursor()); if (insertAt.line === cm.firstLine() && !actionArgs.after) { // Special case for inserting newline before start of document. cm.replaceRange('\n', Pos(cm.firstLine(), 0)); cm.setCursor(cm.firstLine(), 0); } else { insertAt.line = (actionArgs.after) ? insertAt.line : insertAt.line - 1; insertAt.ch = lineLength(cm, insertAt.line); cm.setCursor(insertAt); var newlineFn = CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent; newlineFn(cm); } this.enterInsertMode(cm, { repeat: actionArgs.repeat }, vim); }, paste: function(cm, actionArgs, vim) { var cur = copyCursor(cm.getCursor()); var register = vimGlobalState.registerController.getRegister( actionArgs.registerName); var text = register.toString(); if (!text) { return; } if (actionArgs.matchIndent) { var tabSize = cm.getOption("tabSize"); // length that considers tabs and tabSize var whitespaceLength = function(str) { var tabs = (str.split("\t").length - 1); var spaces = (str.split(" ").length - 1); return tabs * tabSize + spaces * 1; }; var currentLine = cm.getLine(cm.getCursor().line); var indent = whitespaceLength(currentLine.match(/^\s*/)[0]); // chomp last newline b/c don't want it to match /^\s*/gm var chompedText = text.replace(/\n$/, ''); var wasChomped = text !== chompedText; var firstIndent = whitespaceLength(text.match(/^\s*/)[0]); var text = chompedText.replace(/^\s*/gm, function(wspace) { var newIndent = indent + (whitespaceLength(wspace) - firstIndent); if (newIndent < 0) { return ""; } else if (cm.getOption("indentWithTabs")) { var quotient = Math.floor(newIndent / tabSize); return Array(quotient + 1).join('\t'); } else { return Array(newIndent + 1).join(' '); } }); text += wasChomped ? "\n" : ""; } if (actionArgs.repeat > 1) { var text = Array(actionArgs.repeat + 1).join(text); } var linewise = register.linewise; var blockwise = register.blockwise; if (linewise && !blockwise) { if(vim.visualMode) { text = vim.visualLine ? text.slice(0, -1) : '\n' + text.slice(0, text.length - 1) + '\n'; } else if (actionArgs.after) { // Move the newline at the end to the start instead, and paste just // before the newline character of the line we are on right now. text = '\n' + text.slice(0, text.length - 1); cur.ch = lineLength(cm, cur.line); } else { cur.ch = 0; } } else { if (blockwise) { text = text.split('\n'); for (var i = 0; i < text.length; i++) { text[i] = (text[i] == '') ? ' ' : text[i]; } } cur.ch += actionArgs.after ? 1 : 0; } var curPosFinal; var idx; if (vim.visualMode) { // save the pasted text for reselection if the need arises vim.lastPastedText = text; var lastSelectionCurEnd; var selectedArea = getSelectedAreaRange(cm, vim); var selectionStart = selectedArea[0]; var selectionEnd = selectedArea[1]; var selectedText = cm.getSelection(); var selections = cm.listSelections(); var emptyStrings = new Array(selections.length).join('1').split('1'); // save the curEnd marker before it get cleared due to cm.replaceRange. if (vim.lastSelection) { lastSelectionCurEnd = vim.lastSelection.headMark.find(); } // push the previously selected text to unnamed register vimGlobalState.registerController.unnamedRegister.setText(selectedText); if (blockwise) { // first delete the selected text cm.replaceSelections(emptyStrings); // Set new selections as per the block length of the yanked text selectionEnd = Pos(selectionStart.line + text.length-1, selectionStart.ch); cm.setCursor(selectionStart); selectBlock(cm, selectionEnd); cm.replaceSelections(text); curPosFinal = selectionStart; } else if (vim.visualBlock) { cm.replaceSelections(emptyStrings); cm.setCursor(selectionStart); cm.replaceRange(text, selectionStart, selectionStart); curPosFinal = selectionStart; } else { cm.replaceRange(text, selectionStart, selectionEnd); curPosFinal = cm.posFromIndex(cm.indexFromPos(selectionStart) + text.length - 1); } // restore the the curEnd marker if(lastSelectionCurEnd) { vim.lastSelection.headMark = cm.setBookmark(lastSelectionCurEnd); } if (linewise) { curPosFinal.ch=0; } } else { if (blockwise) { cm.setCursor(cur); for (var i = 0; i < text.length; i++) { var line = cur.line+i; if (line > cm.lastLine()) { cm.replaceRange('\n', Pos(line, 0)); } var lastCh = lineLength(cm, line); if (lastCh < cur.ch) { extendLineToColumn(cm, line, cur.ch); } } cm.setCursor(cur); selectBlock(cm, Pos(cur.line + text.length-1, cur.ch)); cm.replaceSelections(text); curPosFinal = cur; } else { cm.replaceRange(text, cur); // Now fine tune the cursor to where we want it. if (linewise && actionArgs.after) { curPosFinal = Pos( cur.line + 1, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line + 1))); } else if (linewise && !actionArgs.after) { curPosFinal = Pos( cur.line, findFirstNonWhiteSpaceCharacter(cm.getLine(cur.line))); } else if (!linewise && actionArgs.after) { idx = cm.indexFromPos(cur); curPosFinal = cm.posFromIndex(idx + text.length - 1); } else { idx = cm.indexFromPos(cur); curPosFinal = cm.posFromIndex(idx + text.length); } } } if (vim.visualMode) { exitVisualMode(cm, false); } cm.setCursor(curPosFinal); }, undo: function(cm, actionArgs) { cm.operation(function() { repeatFn(cm, CodeMirror.commands.undo, actionArgs.repeat)(); cm.setCursor(cm.getCursor('anchor')); }); }, redo: function(cm, actionArgs) { repeatFn(cm, CodeMirror.commands.redo, actionArgs.repeat)(); }, setRegister: function(_cm, actionArgs, vim) { vim.inputState.registerName = actionArgs.selectedCharacter; }, setMark: function(cm, actionArgs, vim) { var markName = actionArgs.selectedCharacter; updateMark(cm, vim, markName, cm.getCursor()); }, replace: function(cm, actionArgs, vim) { var replaceWith = actionArgs.selectedCharacter; var curStart = cm.getCursor(); var replaceTo; var curEnd; var selections = cm.listSelections(); if (vim.visualMode) { curStart = cm.getCursor('start'); curEnd = cm.getCursor('end'); } else { var line = cm.getLine(curStart.line); replaceTo = curStart.ch + actionArgs.repeat; if (replaceTo > line.length) { replaceTo=line.length; } curEnd = Pos(curStart.line, replaceTo); } if (replaceWith=='\n') { if (!vim.visualMode) cm.replaceRange('', curStart, curEnd); // special case, where vim help says to replace by just one line-break (CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent)(cm); } else { var replaceWithStr = cm.getRange(curStart, curEnd); //replace all characters in range by selected, but keep linebreaks replaceWithStr = replaceWithStr.replace(/[^\n]/g, replaceWith); if (vim.visualBlock) { // Tabs are split in visua block before replacing var spaces = new Array(cm.getOption("tabSize")+1).join(' '); replaceWithStr = cm.getSelection(); replaceWithStr = replaceWithStr.replace(/\t/g, spaces).replace(/[^\n]/g, replaceWith).split('\n'); cm.replaceSelections(replaceWithStr); } else { cm.replaceRange(replaceWithStr, curStart, curEnd); } if (vim.visualMode) { curStart = cursorIsBefore(selections[0].anchor, selections[0].head) ? selections[0].anchor : selections[0].head; cm.setCursor(curStart); exitVisualMode(cm, false); } else { cm.setCursor(offsetCursor(curEnd, 0, -1)); } } }, incrementNumberToken: function(cm, actionArgs) { var cur = cm.getCursor(); var lineStr = cm.getLine(cur.line); var re = /-?\d+/g; var match; var start; var end; var numberStr; var token; while ((match = re.exec(lineStr)) !== null) { token = match[0]; start = match.index; end = start + token.length; if (cur.ch < end)break; } if (!actionArgs.backtrack && (end <= cur.ch))return; if (token) { var increment = actionArgs.increase ? 1 : -1; var number = parseInt(token) + (increment * actionArgs.repeat); var from = Pos(cur.line, start); var to = Pos(cur.line, end); numberStr = number.toString(); cm.replaceRange(numberStr, from, to); } else { return; } cm.setCursor(Pos(cur.line, start + numberStr.length - 1)); }, repeatLastEdit: function(cm, actionArgs, vim) { var lastEditInputState = vim.lastEditInputState; if (!lastEditInputState) { return; } var repeat = actionArgs.repeat; if (repeat && actionArgs.repeatIsExplicit) { vim.lastEditInputState.repeatOverride = repeat; } else { repeat = vim.lastEditInputState.repeatOverride || repeat; } repeatLastEdit(cm, vim, repeat, false /** repeatForInsert */); }, exitInsertMode: exitInsertMode }; function defineAction(name, fn) { actions[name] = fn; } /* * Below are miscellaneous utility functions used by vim.js */ /** * Clips cursor to ensure that line is within the buffer's range * If includeLineBreak is true, then allow cur.ch == lineLength. */ function clipCursorToContent(cm, cur, includeLineBreak) { var line = Math.min(Math.max(cm.firstLine(), cur.line), cm.lastLine() ); var maxCh = lineLength(cm, line) - 1; maxCh = (includeLineBreak) ? maxCh + 1 : maxCh; var ch = Math.min(Math.max(0, cur.ch), maxCh); return Pos(line, ch); } function copyArgs(args) { var ret = {}; for (var prop in args) { if (args.hasOwnProperty(prop)) { ret[prop] = args[prop]; } } return ret; } function offsetCursor(cur, offsetLine, offsetCh) { if (typeof offsetLine === 'object') { offsetCh = offsetLine.ch; offsetLine = offsetLine.line; } return Pos(cur.line + offsetLine, cur.ch + offsetCh); } function getOffset(anchor, head) { return { line: head.line - anchor.line, ch: head.line - anchor.line }; } function commandMatches(keys, keyMap, context, inputState) { // Partial matches are not applied. They inform the key handler // that the current key sequence is a subsequence of a valid key // sequence, so that the key buffer is not cleared. var match, partial = [], full = []; for (var i = 0; i < keyMap.length; i++) { var command = keyMap[i]; if (context == 'insert' && command.context != 'insert' || command.context && command.context != context || inputState.operator && command.type == 'action' || !(match = commandMatch(keys, command.keys))) { continue; } if (match == 'partial') { partial.push(command); } if (match == 'full') { full.push(command); } } return { partial: partial.length && partial, full: full.length && full }; } function commandMatch(pressed, mapped) { if (mapped.slice(-11) == '') { // Last character matches anything. var prefixLen = mapped.length - 11; var pressedPrefix = pressed.slice(0, prefixLen); var mappedPrefix = mapped.slice(0, prefixLen); return pressedPrefix == mappedPrefix && pressed.length > prefixLen ? 'full' : mappedPrefix.indexOf(pressedPrefix) == 0 ? 'partial' : false; } else { return pressed == mapped ? 'full' : mapped.indexOf(pressed) == 0 ? 'partial' : false; } } function lastChar(keys) { var match = /^.*(<[\w\-]+>)$/.exec(keys); var selectedCharacter = match ? match[1] : keys.slice(-1); if (selectedCharacter.length > 1){ switch(selectedCharacter){ case '': selectedCharacter='\n'; break; case '': selectedCharacter=' '; break; default: break; } } return selectedCharacter; } function repeatFn(cm, fn, repeat) { return function() { for (var i = 0; i < repeat; i++) { fn(cm); } }; } function copyCursor(cur) { return Pos(cur.line, cur.ch); } function cursorEqual(cur1, cur2) { return cur1.ch == cur2.ch && cur1.line == cur2.line; } function cursorIsBefore(cur1, cur2) { if (cur1.line < cur2.line) { return true; } if (cur1.line == cur2.line && cur1.ch < cur2.ch) { return true; } return false; } function cursorMin(cur1, cur2) { if (arguments.length > 2) { cur2 = cursorMin.apply(undefined, Array.prototype.slice.call(arguments, 1)); } return cursorIsBefore(cur1, cur2) ? cur1 : cur2; } function cursorMax(cur1, cur2) { if (arguments.length > 2) { cur2 = cursorMax.apply(undefined, Array.prototype.slice.call(arguments, 1)); } return cursorIsBefore(cur1, cur2) ? cur2 : cur1; } function cursorIsBetween(cur1, cur2, cur3) { // returns true if cur2 is between cur1 and cur3. var cur1before2 = cursorIsBefore(cur1, cur2); var cur2before3 = cursorIsBefore(cur2, cur3); return cur1before2 && cur2before3; } function lineLength(cm, lineNum) { return cm.getLine(lineNum).length; } function trim(s) { if (s.trim) { return s.trim(); } return s.replace(/^\s+|\s+$/g, ''); } function escapeRegex(s) { return s.replace(/([.?*+$\[\]\/\\(){}|\-])/g, '\\$1'); } function extendLineToColumn(cm, lineNum, column) { var endCh = lineLength(cm, lineNum); var spaces = new Array(column-endCh+1).join(' '); cm.setCursor(Pos(lineNum, endCh)); cm.replaceRange(spaces, cm.getCursor()); } // This functions selects a rectangular block // of text with selectionEnd as any of its corner // Height of block: // Difference in selectionEnd.line and first/last selection.line // Width of the block: // Distance between selectionEnd.ch and any(first considered here) selection.ch function selectBlock(cm, selectionEnd) { var selections = [], ranges = cm.listSelections(); var head = copyCursor(cm.clipPos(selectionEnd)); var isClipped = !cursorEqual(selectionEnd, head); var curHead = cm.getCursor('head'); var primIndex = getIndex(ranges, curHead); var wasClipped = cursorEqual(ranges[primIndex].head, ranges[primIndex].anchor); var max = ranges.length - 1; var index = max - primIndex > primIndex ? max : 0; var base = ranges[index].anchor; var firstLine = Math.min(base.line, head.line); var lastLine = Math.max(base.line, head.line); var baseCh = base.ch, headCh = head.ch; var dir = ranges[index].head.ch - baseCh; var newDir = headCh - baseCh; if (dir > 0 && newDir <= 0) { baseCh++; if (!isClipped) { headCh--; } } else if (dir < 0 && newDir >= 0) { baseCh--; if (!wasClipped) { headCh++; } } else if (dir < 0 && newDir == -1) { baseCh--; headCh++; } for (var line = firstLine; line <= lastLine; line++) { var range = {anchor: new Pos(line, baseCh), head: new Pos(line, headCh)}; selections.push(range); } primIndex = head.line == lastLine ? selections.length - 1 : 0; cm.setSelections(selections); selectionEnd.ch = headCh; base.ch = baseCh; return base; } function selectForInsert(cm, head, height) { var sel = []; for (var i = 0; i < height; i++) { var lineHead = offsetCursor(head, i, 0); sel.push({anchor: lineHead, head: lineHead}); } cm.setSelections(sel, 0); } // getIndex returns the index of the cursor in the selections. function getIndex(ranges, cursor, end) { for (var i = 0; i < ranges.length; i++) { var atAnchor = end != 'head' && cursorEqual(ranges[i].anchor, cursor); var atHead = end != 'anchor' && cursorEqual(ranges[i].head, cursor); if (atAnchor || atHead) { return i; } } return -1; } function getSelectedAreaRange(cm, vim) { var lastSelection = vim.lastSelection; var getCurrentSelectedAreaRange = function() { var selections = cm.listSelections(); var start = selections[0]; var end = selections[selections.length-1]; var selectionStart = cursorIsBefore(start.anchor, start.head) ? start.anchor : start.head; var selectionEnd = cursorIsBefore(end.anchor, end.head) ? end.head : end.anchor; return [selectionStart, selectionEnd]; }; var getLastSelectedAreaRange = function() { var selectionStart = cm.getCursor(); var selectionEnd = cm.getCursor(); var block = lastSelection.visualBlock; if (block) { var width = block.width; var height = block.height; selectionEnd = Pos(selectionStart.line + height, selectionStart.ch + width); var selections = []; // selectBlock creates a 'proper' rectangular block. // We do not want that in all cases, so we manually set selections. for (var i = selectionStart.line; i < selectionEnd.line; i++) { var anchor = Pos(i, selectionStart.ch); var head = Pos(i, selectionEnd.ch); var range = {anchor: anchor, head: head}; selections.push(range); } cm.setSelections(selections); } else { var start = lastSelection.anchorMark.find(); var end = lastSelection.headMark.find(); var line = end.line - start.line; var ch = end.ch - start.ch; selectionEnd = {line: selectionEnd.line + line, ch: line ? selectionEnd.ch : ch + selectionEnd.ch}; if (lastSelection.visualLine) { selectionStart = Pos(selectionStart.line, 0); selectionEnd = Pos(selectionEnd.line, lineLength(cm, selectionEnd.line)); } cm.setSelection(selectionStart, selectionEnd); } return [selectionStart, selectionEnd]; }; if (!vim.visualMode) { // In case of replaying the action. return getLastSelectedAreaRange(); } else { return getCurrentSelectedAreaRange(); } } // Updates the previous selection with the current selection's values. This // should only be called in visual mode. function updateLastSelection(cm, vim) { var anchor = vim.sel.anchor; var head = vim.sel.head; // To accommodate the effect of lastPastedText in the last selection if (vim.lastPastedText) { head = cm.posFromIndex(cm.indexFromPos(anchor) + vim.lastPastedText.length); vim.lastPastedText = null; } vim.lastSelection = {'anchorMark': cm.setBookmark(anchor), 'headMark': cm.setBookmark(head), 'anchor': copyCursor(anchor), 'head': copyCursor(head), 'visualMode': vim.visualMode, 'visualLine': vim.visualLine, 'visualBlock': vim.visualBlock}; } function expandSelection(cm, start, end) { var sel = cm.state.vim.sel; var head = sel.head; var anchor = sel.anchor; var tmp; if (cursorIsBefore(end, start)) { tmp = end; end = start; start = tmp; } if (cursorIsBefore(head, anchor)) { head = cursorMin(start, head); anchor = cursorMax(anchor, end); } else { anchor = cursorMin(start, anchor); head = cursorMax(head, end); head = offsetCursor(head, 0, -1); if (head.ch == -1 && head.line != cm.firstLine()) { head = Pos(head.line - 1, lineLength(cm, head.line - 1)); } } return [anchor, head]; } /** * Updates the CodeMirror selection to match the provided vim selection. * If no arguments are given, it uses the current vim selection state. */ function updateCmSelection(cm, sel, mode) { var vim = cm.state.vim; sel = sel || vim.sel; var mode = mode || vim.visualLine ? 'line' : vim.visualBlock ? 'block' : 'char'; var cmSel = makeCmSelection(cm, sel, mode); cm.setSelections(cmSel.ranges, cmSel.primary); updateFakeCursor(cm); } function makeCmSelection(cm, sel, mode, exclusive) { var head = copyCursor(sel.head); var anchor = copyCursor(sel.anchor); if (mode == 'char') { var headOffset = !exclusive && !cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; var anchorOffset = cursorIsBefore(sel.head, sel.anchor) ? 1 : 0; head = offsetCursor(sel.head, 0, headOffset); anchor = offsetCursor(sel.anchor, 0, anchorOffset); return { ranges: [{anchor: anchor, head: head}], primary: 0 }; } else if (mode == 'line') { if (!cursorIsBefore(sel.head, sel.anchor)) { anchor.ch = 0; var lastLine = cm.lastLine(); if (head.line > lastLine) { head.line = lastLine; } head.ch = lineLength(cm, head.line); } else { head.ch = 0; anchor.ch = lineLength(cm, anchor.line); } return { ranges: [{anchor: anchor, head: head}], primary: 0 }; } else if (mode == 'block') { var top = Math.min(anchor.line, head.line), left = Math.min(anchor.ch, head.ch), bottom = Math.max(anchor.line, head.line), right = Math.max(anchor.ch, head.ch) + 1; var height = bottom - top + 1; var primary = head.line == top ? 0 : height - 1; var ranges = []; for (var i = 0; i < height; i++) { ranges.push({ anchor: Pos(top + i, left), head: Pos(top + i, right) }); } return { ranges: ranges, primary: primary }; } } function getHead(cm) { var cur = cm.getCursor('head'); if (cm.getSelection().length == 1) { // Small corner case when only 1 character is selected. The "real" // head is the left of head and anchor. cur = cursorMin(cur, cm.getCursor('anchor')); } return cur; } /** * If moveHead is set to false, the CodeMirror selection will not be * touched. The caller assumes the responsibility of putting the cursor * in the right place. */ function exitVisualMode(cm, moveHead) { var vim = cm.state.vim; if (moveHead !== false) { cm.setCursor(clipCursorToContent(cm, vim.sel.head)); } updateLastSelection(cm, vim); vim.visualMode = false; vim.visualLine = false; vim.visualBlock = false; CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); if (vim.fakeCursor) { vim.fakeCursor.clear(); } } // Remove any trailing newlines from the selection. For // example, with the caret at the start of the last word on the line, // 'dw' should word, but not the newline, while 'w' should advance the // caret to the first character of the next line. function clipToLine(cm, curStart, curEnd) { var selection = cm.getRange(curStart, curEnd); // Only clip if the selection ends with trailing newline + whitespace if (/\n\s*$/.test(selection)) { var lines = selection.split('\n'); // We know this is all whitepsace. lines.pop(); // Cases: // 1. Last word is an empty line - do not clip the trailing '\n' // 2. Last word is not an empty line - clip the trailing '\n' var line; // Find the line containing the last word, and clip all whitespace up // to it. for (var line = lines.pop(); lines.length > 0 && line && isWhiteSpaceString(line); line = lines.pop()) { curEnd.line--; curEnd.ch = 0; } // If the last word is not an empty line, clip an additional newline if (line) { curEnd.line--; curEnd.ch = lineLength(cm, curEnd.line); } else { curEnd.ch = 0; } } } // Expand the selection to line ends. function expandSelectionToLine(_cm, curStart, curEnd) { curStart.ch = 0; curEnd.ch = 0; curEnd.line++; } function findFirstNonWhiteSpaceCharacter(text) { if (!text) { return 0; } var firstNonWS = text.search(/\S/); return firstNonWS == -1 ? text.length : firstNonWS; } function expandWordUnderCursor(cm, inclusive, _forward, bigWord, noSymbol) { var cur = getHead(cm); var line = cm.getLine(cur.line); var idx = cur.ch; // Seek to first word or non-whitespace character, depending on if // noSymbol is true. var test = noSymbol ? wordCharTest[0] : bigWordCharTest [0]; while (!test(line.charAt(idx))) { idx++; if (idx >= line.length) { return null; } } if (bigWord) { test = bigWordCharTest[0]; } else { test = wordCharTest[0]; if (!test(line.charAt(idx))) { test = wordCharTest[1]; } } var end = idx, start = idx; while (test(line.charAt(end)) && end < line.length) { end++; } while (test(line.charAt(start)) && start >= 0) { start--; } start++; if (inclusive) { // If present, include all whitespace after word. // Otherwise, include all whitespace before word, except indentation. var wordEnd = end; while (/\s/.test(line.charAt(end)) && end < line.length) { end++; } if (wordEnd == end) { var wordStart = start; while (/\s/.test(line.charAt(start - 1)) && start > 0) { start--; } if (!start) { start = wordStart; } } } return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; } function recordJumpPosition(cm, oldCur, newCur) { if (!cursorEqual(oldCur, newCur)) { vimGlobalState.jumpList.add(cm, oldCur, newCur); } } function recordLastCharacterSearch(increment, args) { vimGlobalState.lastChararacterSearch.increment = increment; vimGlobalState.lastChararacterSearch.forward = args.forward; vimGlobalState.lastChararacterSearch.selectedCharacter = args.selectedCharacter; } var symbolToMode = { '(': 'bracket', ')': 'bracket', '{': 'bracket', '}': 'bracket', '[': 'section', ']': 'section', '*': 'comment', '/': 'comment', 'm': 'method', 'M': 'method', '#': 'preprocess' }; var findSymbolModes = { bracket: { isComplete: function(state) { if (state.nextCh === state.symb) { state.depth++; if (state.depth >= 1)return true; } else if (state.nextCh === state.reverseSymb) { state.depth--; } return false; } }, section: { init: function(state) { state.curMoveThrough = true; state.symb = (state.forward ? ']' : '[') === state.symb ? '{' : '}'; }, isComplete: function(state) { return state.index === 0 && state.nextCh === state.symb; } }, comment: { isComplete: function(state) { var found = state.lastCh === '*' && state.nextCh === '/'; state.lastCh = state.nextCh; return found; } }, // TODO: The original Vim implementation only operates on level 1 and 2. // The current implementation doesn't check for code block level and // therefore it operates on any levels. method: { init: function(state) { state.symb = (state.symb === 'm' ? '{' : '}'); state.reverseSymb = state.symb === '{' ? '}' : '{'; }, isComplete: function(state) { if (state.nextCh === state.symb)return true; return false; } }, preprocess: { init: function(state) { state.index = 0; }, isComplete: function(state) { if (state.nextCh === '#') { var token = state.lineText.match(/#(\w+)/)[1]; if (token === 'endif') { if (state.forward && state.depth === 0) { return true; } state.depth++; } else if (token === 'if') { if (!state.forward && state.depth === 0) { return true; } state.depth--; } if (token === 'else' && state.depth === 0)return true; } return false; } } }; function findSymbol(cm, repeat, forward, symb) { var cur = copyCursor(cm.getCursor()); var increment = forward ? 1 : -1; var endLine = forward ? cm.lineCount() : -1; var curCh = cur.ch; var line = cur.line; var lineText = cm.getLine(line); var state = { lineText: lineText, nextCh: lineText.charAt(curCh), lastCh: null, index: curCh, symb: symb, reverseSymb: (forward ? { ')': '(', '}': '{' } : { '(': ')', '{': '}' })[symb], forward: forward, depth: 0, curMoveThrough: false }; var mode = symbolToMode[symb]; if (!mode)return cur; var init = findSymbolModes[mode].init; var isComplete = findSymbolModes[mode].isComplete; if (init) { init(state); } while (line !== endLine && repeat) { state.index += increment; state.nextCh = state.lineText.charAt(state.index); if (!state.nextCh) { line += increment; state.lineText = cm.getLine(line) || ''; if (increment > 0) { state.index = 0; } else { var lineLen = state.lineText.length; state.index = (lineLen > 0) ? (lineLen-1) : 0; } state.nextCh = state.lineText.charAt(state.index); } if (isComplete(state)) { cur.line = line; cur.ch = state.index; repeat--; } } if (state.nextCh || state.curMoveThrough) { return Pos(line, state.index); } return cur; } /** * Returns the boundaries of the next word. If the cursor in the middle of * the word, then returns the boundaries of the current word, starting at * the cursor. If the cursor is at the start/end of a word, and we are going * forward/backward, respectively, find the boundaries of the next word. * * @param {CodeMirror} cm CodeMirror object. * @param {Cursor} cur The cursor position. * @param {boolean} forward True to search forward. False to search * backward. * @param {boolean} bigWord True if punctuation count as part of the word. * False if only [a-zA-Z0-9] characters count as part of the word. * @param {boolean} emptyLineIsWord True if empty lines should be treated * as words. * @return {Object{from:number, to:number, line: number}} The boundaries of * the word, or null if there are no more words. */ function findWord(cm, cur, forward, bigWord, emptyLineIsWord) { var lineNum = cur.line; var pos = cur.ch; var line = cm.getLine(lineNum); var dir = forward ? 1 : -1; var charTests = bigWord ? bigWordCharTest: wordCharTest; if (emptyLineIsWord && line == '') { lineNum += dir; line = cm.getLine(lineNum); if (!isLine(cm, lineNum)) { return null; } pos = (forward) ? 0 : line.length; } while (true) { if (emptyLineIsWord && line == '') { return { from: 0, to: 0, line: lineNum }; } var stop = (dir > 0) ? line.length : -1; var wordStart = stop, wordEnd = stop; // Find bounds of next word. while (pos != stop) { var foundWord = false; for (var i = 0; i < charTests.length && !foundWord; ++i) { if (charTests[i](line.charAt(pos))) { wordStart = pos; // Advance to end of word. while (pos != stop && charTests[i](line.charAt(pos))) { pos += dir; } wordEnd = pos; foundWord = wordStart != wordEnd; if (wordStart == cur.ch && lineNum == cur.line && wordEnd == wordStart + dir) { // We started at the end of a word. Find the next one. continue; } else { return { from: Math.min(wordStart, wordEnd + 1), to: Math.max(wordStart, wordEnd), line: lineNum }; } } } if (!foundWord) { pos += dir; } } // Advance to next/prev line. lineNum += dir; if (!isLine(cm, lineNum)) { return null; } line = cm.getLine(lineNum); pos = (dir > 0) ? 0 : line.length; } // Should never get here. throw new Error('The impossible happened.'); } /** * @param {CodeMirror} cm CodeMirror object. * @param {Pos} cur The position to start from. * @param {int} repeat Number of words to move past. * @param {boolean} forward True to search forward. False to search * backward. * @param {boolean} wordEnd True to move to end of word. False to move to * beginning of word. * @param {boolean} bigWord True if punctuation count as part of the word. * False if only alphabet characters count as part of the word. * @return {Cursor} The position the cursor should move to. */ function moveToWord(cm, cur, repeat, forward, wordEnd, bigWord) { var curStart = copyCursor(cur); var words = []; if (forward && !wordEnd || !forward && wordEnd) { repeat++; } // For 'e', empty lines are not considered words, go figure. var emptyLineIsWord = !(forward && wordEnd); for (var i = 0; i < repeat; i++) { var word = findWord(cm, cur, forward, bigWord, emptyLineIsWord); if (!word) { var eodCh = lineLength(cm, cm.lastLine()); words.push(forward ? {line: cm.lastLine(), from: eodCh, to: eodCh} : {line: 0, from: 0, to: 0}); break; } words.push(word); cur = Pos(word.line, forward ? (word.to - 1) : word.from); } var shortCircuit = words.length != repeat; var firstWord = words[0]; var lastWord = words.pop(); if (forward && !wordEnd) { // w if (!shortCircuit && (firstWord.from != curStart.ch || firstWord.line != curStart.line)) { // We did not start in the middle of a word. Discard the extra word at the end. lastWord = words.pop(); } return Pos(lastWord.line, lastWord.from); } else if (forward && wordEnd) { return Pos(lastWord.line, lastWord.to - 1); } else if (!forward && wordEnd) { // ge if (!shortCircuit && (firstWord.to != curStart.ch || firstWord.line != curStart.line)) { // We did not start in the middle of a word. Discard the extra word at the end. lastWord = words.pop(); } return Pos(lastWord.line, lastWord.to); } else { // b return Pos(lastWord.line, lastWord.from); } } function moveToCharacter(cm, repeat, forward, character) { var cur = cm.getCursor(); var start = cur.ch; var idx; for (var i = 0; i < repeat; i ++) { var line = cm.getLine(cur.line); idx = charIdxInLine(start, line, character, forward, true); if (idx == -1) { return null; } start = idx; } return Pos(cm.getCursor().line, idx); } function moveToColumn(cm, repeat) { // repeat is always >= 1, so repeat - 1 always corresponds // to the column we want to go to. var line = cm.getCursor().line; return clipCursorToContent(cm, Pos(line, repeat - 1)); } function updateMark(cm, vim, markName, pos) { if (!inArray(markName, validMarks)) { return; } if (vim.marks[markName]) { vim.marks[markName].clear(); } vim.marks[markName] = cm.setBookmark(pos); } function charIdxInLine(start, line, character, forward, includeChar) { // Search for char in line. // motion_options: {forward, includeChar} // If includeChar = true, include it too. // If forward = true, search forward, else search backwards. // If char is not found on this line, do nothing var idx; if (forward) { idx = line.indexOf(character, start + 1); if (idx != -1 && !includeChar) { idx -= 1; } } else { idx = line.lastIndexOf(character, start - 1); if (idx != -1 && !includeChar) { idx += 1; } } return idx; } function findParagraph(cm, head, repeat, dir, inclusive) { var line = head.line; var min = cm.firstLine(); var max = cm.lastLine(); var start, end, i = line; function isEmpty(i) { return !/\S/.test(cm.getLine(i)); } // ace_patch function isBoundary(i, dir, any) { if (any) { return isEmpty(i) != isEmpty(i + dir); } return !isEmpty(i) && isEmpty(i + dir); } function skipFold(i) { dir = dir > 0 ? 1 : -1; var foldLine = cm.ace.session.getFoldLine(i); if (foldLine) { if (i + dir > foldLine.start.row && i + dir < foldLine.end.row) dir = (dir > 0 ? foldLine.end.row : foldLine.start.row) - i; } } if (dir) { while (min <= i && i <= max && repeat > 0) { skipFold(i); if (isBoundary(i, dir)) { repeat--; } i += dir; } return new Pos(i, 0); } var vim = cm.state.vim; if (vim.visualLine && isBoundary(line, 1, true)) { var anchor = vim.sel.anchor; if (isBoundary(anchor.line, -1, true)) { if (!inclusive || anchor.line != line) { line += 1; } } } var startState = isEmpty(line); for (i = line; i <= max && repeat; i++) { if (isBoundary(i, 1, true)) { if (!inclusive || isEmpty(i) != startState) { repeat--; } } } end = new Pos(i, 0); // select boundary before paragraph for the last one if (i > max && !startState) { startState = true; } else { inclusive = false; } for (i = line; i > min; i--) { if (!inclusive || isEmpty(i) == startState || i == line) { if (isBoundary(i, -1, true)) { break; } } } start = new Pos(i, 0); return { start: start, end: end }; } // TODO: perhaps this finagling of start and end positions belonds // in codmirror/replaceRange? function selectCompanionObject(cm, head, symb, inclusive) { var cur = head, start, end; var bracketRegexp = ({ '(': /[()]/, ')': /[()]/, '[': /[[\]]/, ']': /[[\]]/, '{': /[{}]/, '}': /[{}]/})[symb]; var openSym = ({ '(': '(', ')': '(', '[': '[', ']': '[', '{': '{', '}': '{'})[symb]; var curChar = cm.getLine(cur.line).charAt(cur.ch); // Due to the behavior of scanForBracket, we need to add an offset if the // cursor is on a matching open bracket. var offset = curChar === openSym ? 1 : 0; start = cm.scanForBracket(Pos(cur.line, cur.ch + offset), -1, null, {'bracketRegex': bracketRegexp}); end = cm.scanForBracket(Pos(cur.line, cur.ch + offset), 1, null, {'bracketRegex': bracketRegexp}); if (!start || !end) { return { start: cur, end: cur }; } start = start.pos; end = end.pos; if ((start.line == end.line && start.ch > end.ch) || (start.line > end.line)) { var tmp = start; start = end; end = tmp; } if (inclusive) { end.ch += 1; } else { start.ch += 1; } return { start: start, end: end }; } // Takes in a symbol and a cursor and tries to simulate text objects that // have identical opening and closing symbols // TODO support across multiple lines function findBeginningAndEnd(cm, head, symb, inclusive) { var cur = copyCursor(head); var line = cm.getLine(cur.line); var chars = line.split(''); var start, end, i, len; var firstIndex = chars.indexOf(symb); // the decision tree is to always look backwards for the beginning first, // but if the cursor is in front of the first instance of the symb, // then move the cursor forward if (cur.ch < firstIndex) { cur.ch = firstIndex; // Why is this line even here??? // cm.setCursor(cur.line, firstIndex+1); } // otherwise if the cursor is currently on the closing symbol else if (firstIndex < cur.ch && chars[cur.ch] == symb) { end = cur.ch; // assign end to the current cursor --cur.ch; // make sure to look backwards } // if we're currently on the symbol, we've got a start if (chars[cur.ch] == symb && !end) { start = cur.ch + 1; // assign start to ahead of the cursor } else { // go backwards to find the start for (i = cur.ch; i > -1 && !start; i--) { if (chars[i] == symb) { start = i + 1; } } } // look forwards for the end symbol if (start && !end) { for (i = start, len = chars.length; i < len && !end; i++) { if (chars[i] == symb) { end = i; } } } // nothing found if (!start || !end) { return { start: cur, end: cur }; } // include the symbols if (inclusive) { --start; ++end; } return { start: Pos(cur.line, start), end: Pos(cur.line, end) }; } // Search functions defineOption('pcre', true, 'boolean'); function SearchState() {} SearchState.prototype = { getQuery: function() { return vimGlobalState.query; }, setQuery: function(query) { vimGlobalState.query = query; }, getOverlay: function() { return this.searchOverlay; }, setOverlay: function(overlay) { this.searchOverlay = overlay; }, isReversed: function() { return vimGlobalState.isReversed; }, setReversed: function(reversed) { vimGlobalState.isReversed = reversed; }, getScrollbarAnnotate: function() { return this.annotate; }, setScrollbarAnnotate: function(annotate) { this.annotate = annotate; } }; function getSearchState(cm) { var vim = cm.state.vim; return vim.searchState_ || (vim.searchState_ = new SearchState()); } function dialog(cm, template, shortText, onClose, options) { if (cm.openDialog) { cm.openDialog(template, onClose, { bottom: true, value: options.value, onKeyDown: options.onKeyDown, onKeyUp: options.onKeyUp, selectValueOnOpen: false}); } else { onClose(prompt(shortText, '')); } } function splitBySlash(argString) { var slashes = findUnescapedSlashes(argString) || []; if (!slashes.length) return []; var tokens = []; // in case of strings like foo/bar if (slashes[0] !== 0) return; for (var i = 0; i < slashes.length; i++) { if (typeof slashes[i] == 'number') tokens.push(argString.substring(slashes[i] + 1, slashes[i+1])); } return tokens; } function findUnescapedSlashes(str) { var escapeNextChar = false; var slashes = []; for (var i = 0; i < str.length; i++) { var c = str.charAt(i); if (!escapeNextChar && c == '/') { slashes.push(i); } escapeNextChar = !escapeNextChar && (c == '\\'); } return slashes; } // Translates a search string from ex (vim) syntax into javascript form. function translateRegex(str) { // When these match, add a '\' if unescaped or remove one if escaped. var specials = '|(){'; // Remove, but never add, a '\' for these. var unescape = '}'; var escapeNextChar = false; var out = []; for (var i = -1; i < str.length; i++) { var c = str.charAt(i) || ''; var n = str.charAt(i+1) || ''; var specialComesNext = (n && specials.indexOf(n) != -1); if (escapeNextChar) { if (c !== '\\' || !specialComesNext) { out.push(c); } escapeNextChar = false; } else { if (c === '\\') { escapeNextChar = true; // Treat the unescape list as special for removing, but not adding '\'. if (n && unescape.indexOf(n) != -1) { specialComesNext = true; } // Not passing this test means removing a '\'. if (!specialComesNext || n === '\\') { out.push(c); } } else { out.push(c); if (specialComesNext && n !== '\\') { out.push('\\'); } } } } return out.join(''); } // Translates the replace part of a search and replace from ex (vim) syntax into // javascript form. Similar to translateRegex, but additionally fixes back references // (translates '\[0..9]' to '$[0..9]') and follows different rules for escaping '$'. var charUnescapes = {'\\n': '\n', '\\r': '\r', '\\t': '\t'}; function translateRegexReplace(str) { var escapeNextChar = false; var out = []; for (var i = -1; i < str.length; i++) { var c = str.charAt(i) || ''; var n = str.charAt(i+1) || ''; if (charUnescapes[c + n]) { out.push(charUnescapes[c+n]); i++; } else if (escapeNextChar) { // At any point in the loop, escapeNextChar is true if the previous // character was a '\' and was not escaped. out.push(c); escapeNextChar = false; } else { if (c === '\\') { escapeNextChar = true; if ((isNumber(n) || n === '$')) { out.push('$'); } else if (n !== '/' && n !== '\\') { out.push('\\'); } } else { if (c === '$') { out.push('$'); } out.push(c); if (n === '/') { out.push('\\'); } } } } return out.join(''); } // Unescape \ and / in the replace part, for PCRE mode. var unescapes = {'\\/': '/', '\\\\': '\\', '\\n': '\n', '\\r': '\r', '\\t': '\t'}; function unescapeRegexReplace(str) { var stream = new CodeMirror.StringStream(str); var output = []; while (!stream.eol()) { // Search for \. while (stream.peek() && stream.peek() != '\\') { output.push(stream.next()); } var matched = false; for (var matcher in unescapes) { if (stream.match(matcher, true)) { matched = true; output.push(unescapes[matcher]); break; } } if (!matched) { // Don't change anything output.push(stream.next()); } } return output.join(''); } /** * Extract the regular expression from the query and return a Regexp object. * Returns null if the query is blank. * If ignoreCase is passed in, the Regexp object will have the 'i' flag set. * If smartCase is passed in, and the query contains upper case letters, * then ignoreCase is overridden, and the 'i' flag will not be set. * If the query contains the /i in the flag part of the regular expression, * then both ignoreCase and smartCase are ignored, and 'i' will be passed * through to the Regex object. */ function parseQuery(query, ignoreCase, smartCase) { // First update the last search register var lastSearchRegister = vimGlobalState.registerController.getRegister('/'); lastSearchRegister.setText(query); // Check if the query is already a regex. if (query instanceof RegExp) { return query; } // First try to extract regex + flags from the input. If no flags found, // extract just the regex. IE does not accept flags directly defined in // the regex string in the form /regex/flags var slashes = findUnescapedSlashes(query); var regexPart; var forceIgnoreCase; if (!slashes.length) { // Query looks like 'regexp' regexPart = query; } else { // Query looks like 'regexp/...' regexPart = query.substring(0, slashes[0]); var flagsPart = query.substring(slashes[0]); forceIgnoreCase = (flagsPart.indexOf('i') != -1); } if (!regexPart) { return null; } if (!getOption('pcre')) { regexPart = translateRegex(regexPart); } if (smartCase) { ignoreCase = (/^[^A-Z]*$/).test(regexPart); } var regexp = new RegExp(regexPart, (ignoreCase || forceIgnoreCase) ? 'i' : undefined); return regexp; } function showConfirm(cm, text) { if (cm.openNotification) { cm.openNotification('' + text + '', {bottom: true, duration: 5000}); } else { alert(text); } } function makePrompt(prefix, desc) { var raw = ''; if (prefix) { raw += '' + prefix + ''; } raw += ' ' + ''; if (desc) { raw += ''; raw += desc; raw += ''; } return raw; } var searchPromptDesc = '(Javascript regexp)'; function showPrompt(cm, options) { var shortText = (options.prefix || '') + ' ' + (options.desc || ''); var prompt = makePrompt(options.prefix, options.desc); dialog(cm, prompt, shortText, options.onClose, options); } function regexEqual(r1, r2) { if (r1 instanceof RegExp && r2 instanceof RegExp) { var props = ['global', 'multiline', 'ignoreCase', 'source']; for (var i = 0; i < props.length; i++) { var prop = props[i]; if (r1[prop] !== r2[prop]) { return false; } } return true; } return false; } // Returns true if the query is valid. function updateSearchQuery(cm, rawQuery, ignoreCase, smartCase) { if (!rawQuery) { return; } var state = getSearchState(cm); var query = parseQuery(rawQuery, !!ignoreCase, !!smartCase); if (!query) { return; } highlightSearchMatches(cm, query); if (regexEqual(query, state.getQuery())) { return query; } state.setQuery(query); return query; } function searchOverlay(query) { if (query.source.charAt(0) == '^') { var matchSol = true; } return { token: function(stream) { if (matchSol && !stream.sol()) { stream.skipToEnd(); return; } var match = stream.match(query, false); if (match) { if (match[0].length == 0) { // Matched empty string, skip to next. stream.next(); return 'searching'; } if (!stream.sol()) { // Backtrack 1 to match \b stream.backUp(1); if (!query.exec(stream.next() + match[0])) { stream.next(); return null; } } stream.match(query); return 'searching'; } while (!stream.eol()) { stream.next(); if (stream.match(query, false)) break; } }, query: query }; } function highlightSearchMatches(cm, query) { var searchState = getSearchState(cm); var overlay = searchState.getOverlay(); if (!overlay || query != overlay.query) { if (overlay) { cm.removeOverlay(overlay); } overlay = searchOverlay(query); cm.addOverlay(overlay); if (cm.showMatchesOnScrollbar) { if (searchState.getScrollbarAnnotate()) { searchState.getScrollbarAnnotate().clear(); } searchState.setScrollbarAnnotate(cm.showMatchesOnScrollbar(query)); } searchState.setOverlay(overlay); } } function findNext(cm, prev, query, repeat) { if (repeat === undefined) { repeat = 1; } return cm.operation(function() { var pos = cm.getCursor(); var cursor = cm.getSearchCursor(query, pos); for (var i = 0; i < repeat; i++) { var found = cursor.find(prev); if (i == 0 && found && cursorEqual(cursor.from(), pos)) { found = cursor.find(prev); } if (!found) { // SearchCursor may have returned null because it hit EOF, wrap // around and try again. cursor = cm.getSearchCursor(query, (prev) ? Pos(cm.lastLine()) : Pos(cm.firstLine(), 0) ); if (!cursor.find(prev)) { return; } } } return cursor.from(); }); } function clearSearchHighlight(cm) { var state = getSearchState(cm); cm.removeOverlay(getSearchState(cm).getOverlay()); state.setOverlay(null); if (state.getScrollbarAnnotate()) { state.getScrollbarAnnotate().clear(); state.setScrollbarAnnotate(null); } } /** * Check if pos is in the specified range, INCLUSIVE. * Range can be specified with 1 or 2 arguments. * If the first range argument is an array, treat it as an array of line * numbers. Match pos against any of the lines. * If the first range argument is a number, * if there is only 1 range argument, check if pos has the same line * number * if there are 2 range arguments, then check if pos is in between the two * range arguments. */ function isInRange(pos, start, end) { if (typeof pos != 'number') { // Assume it is a cursor position. Get the line number. pos = pos.line; } if (start instanceof Array) { return inArray(pos, start); } else { if (end) { return (pos >= start && pos <= end); } else { return pos == start; } } } function getUserVisibleLines(cm) { // ace_patch{ var renderer = cm.ace.renderer; return { top: renderer.getFirstFullyVisibleRow(), bottom: renderer.getLastFullyVisibleRow() } // ace_patch} } var ExCommandDispatcher = function() { this.buildCommandMap_(); }; ExCommandDispatcher.prototype = { processCommand: function(cm, input, opt_params) { var that = this; cm.operation(function () { cm.curOp.isVimOp = true; that._processCommand(cm, input, opt_params); }); }, _processCommand: function(cm, input, opt_params) { var vim = cm.state.vim; var commandHistoryRegister = vimGlobalState.registerController.getRegister(':'); var previousCommand = commandHistoryRegister.toString(); if (vim.visualMode) { exitVisualMode(cm); } var inputStream = new CodeMirror.StringStream(input); // update ": with the latest command whether valid or invalid commandHistoryRegister.setText(input); var params = opt_params || {}; params.input = input; try { this.parseInput_(cm, inputStream, params); } catch(e) { showConfirm(cm, e); throw e; } var command; var commandName; if (!params.commandName) { // If only a line range is defined, move to the line. if (params.line !== undefined) { commandName = 'move'; } } else { command = this.matchCommand_(params.commandName); if (command) { commandName = command.name; if (command.excludeFromCommandHistory) { commandHistoryRegister.setText(previousCommand); } this.parseCommandArgs_(inputStream, params, command); if (command.type == 'exToKey') { // Handle Ex to Key mapping. for (var i = 0; i < command.toKeys.length; i++) { CodeMirror.Vim.handleKey(cm, command.toKeys[i], 'mapping'); } return; } else if (command.type == 'exToEx') { // Handle Ex to Ex mapping. this.processCommand(cm, command.toInput); return; } } } if (!commandName) { showConfirm(cm, 'Not an editor command ":' + input + '"'); return; } try { exCommands[commandName](cm, params); // Possibly asynchronous commands (e.g. substitute, which might have a // user confirmation), are responsible for calling the callback when // done. All others have it taken care of for them here. if ((!command || !command.possiblyAsync) && params.callback) { params.callback(); } } catch(e) { showConfirm(cm, e); throw e; } }, parseInput_: function(cm, inputStream, result) { inputStream.eatWhile(':'); // Parse range. if (inputStream.eat('%')) { result.line = cm.firstLine(); result.lineEnd = cm.lastLine(); } else { result.line = this.parseLineSpec_(cm, inputStream); if (result.line !== undefined && inputStream.eat(',')) { result.lineEnd = this.parseLineSpec_(cm, inputStream); } } // Parse command name. var commandMatch = inputStream.match(/^(\w+)/); if (commandMatch) { result.commandName = commandMatch[1]; } else { result.commandName = inputStream.match(/.*/)[0]; } return result; }, parseLineSpec_: function(cm, inputStream) { var numberMatch = inputStream.match(/^(\d+)/); if (numberMatch) { return parseInt(numberMatch[1], 10) - 1; } switch (inputStream.next()) { case '.': return cm.getCursor().line; case '$': return cm.lastLine(); case '\'': var mark = cm.state.vim.marks[inputStream.next()]; if (mark && mark.find()) { return mark.find().line; } throw new Error('Mark not set'); default: inputStream.backUp(1); return undefined; } }, parseCommandArgs_: function(inputStream, params, command) { if (inputStream.eol()) { return; } params.argString = inputStream.match(/.*/)[0]; // Parse command-line arguments var delim = command.argDelimiter || /\s+/; var args = trim(params.argString).split(delim); if (args.length && args[0]) { params.args = args; } }, matchCommand_: function(commandName) { // Return the command in the command map that matches the shortest // prefix of the passed in command name. The match is guaranteed to be // unambiguous if the defaultExCommandMap's shortNames are set up // correctly. (see @code{defaultExCommandMap}). for (var i = commandName.length; i > 0; i--) { var prefix = commandName.substring(0, i); if (this.commandMap_[prefix]) { var command = this.commandMap_[prefix]; if (command.name.indexOf(commandName) === 0) { return command; } } } return null; }, buildCommandMap_: function() { this.commandMap_ = {}; for (var i = 0; i < defaultExCommandMap.length; i++) { var command = defaultExCommandMap[i]; var key = command.shortName || command.name; this.commandMap_[key] = command; } }, map: function(lhs, rhs, ctx) { if (lhs != ':' && lhs.charAt(0) == ':') { if (ctx) { throw Error('Mode not supported for ex mappings'); } var commandName = lhs.substring(1); if (rhs != ':' && rhs.charAt(0) == ':') { // Ex to Ex mapping this.commandMap_[commandName] = { name: commandName, type: 'exToEx', toInput: rhs.substring(1), user: true }; } else { // Ex to key mapping this.commandMap_[commandName] = { name: commandName, type: 'exToKey', toKeys: rhs, user: true }; } } else { if (rhs != ':' && rhs.charAt(0) == ':') { // Key to Ex mapping. var mapping = { keys: lhs, type: 'keyToEx', exArgs: { input: rhs.substring(1) }, user: true}; if (ctx) { mapping.context = ctx; } defaultKeymap.unshift(mapping); } else { // Key to key mapping var mapping = { keys: lhs, type: 'keyToKey', toKeys: rhs, user: true }; if (ctx) { mapping.context = ctx; } defaultKeymap.unshift(mapping); } } }, unmap: function(lhs, ctx) { if (lhs != ':' && lhs.charAt(0) == ':') { // Ex to Ex or Ex to key mapping if (ctx) { throw Error('Mode not supported for ex mappings'); } var commandName = lhs.substring(1); if (this.commandMap_[commandName] && this.commandMap_[commandName].user) { delete this.commandMap_[commandName]; return; } } else { // Key to Ex or key to key mapping var keys = lhs; for (var i = 0; i < defaultKeymap.length; i++) { if (keys == defaultKeymap[i].keys && defaultKeymap[i].context === ctx && defaultKeymap[i].user) { defaultKeymap.splice(i, 1); return; } } } // throw Error('No such mapping.'); } }; var exCommands = { colorscheme: function(cm, params) { if (!params.args || params.args.length < 1) { showConfirm(cm, cm.getOption('theme')); return; } cm.setOption('theme', params.args[0]); }, map: function(cm, params, ctx) { var mapArgs = params.args; if (!mapArgs || mapArgs.length < 2) { if (cm) { showConfirm(cm, 'Invalid mapping: ' + params.input); } return; } exCommandDispatcher.map(mapArgs[0], mapArgs[1], ctx); }, imap: function(cm, params) { this.map(cm, params, 'insert'); }, nmap: function(cm, params) { this.map(cm, params, 'normal'); }, vmap: function(cm, params) { this.map(cm, params, 'visual'); }, unmap: function(cm, params, ctx) { var mapArgs = params.args; if (!mapArgs || mapArgs.length < 1) { if (cm) { showConfirm(cm, 'No such mapping: ' + params.input); } return; } exCommandDispatcher.unmap(mapArgs[0], ctx); }, move: function(cm, params) { commandDispatcher.processCommand(cm, cm.state.vim, { type: 'motion', motion: 'moveToLineOrEdgeOfDocument', motionArgs: { forward: false, explicitRepeat: true, linewise: true }, repeatOverride: params.line+1}); }, set: function(cm, params) { var setArgs = params.args; // Options passed through to the setOption/getOption calls. May be passed in by the // local/global versions of the set command var setCfg = params.setCfg || {}; if (!setArgs || setArgs.length < 1) { if (cm) { showConfirm(cm, 'Invalid mapping: ' + params.input); } return; } var expr = setArgs[0].split('='); var optionName = expr[0]; var value = expr[1]; var forceGet = false; if (optionName.charAt(optionName.length - 1) == '?') { // If post-fixed with ?, then the set is actually a get. if (value) { throw Error('Trailing characters: ' + params.argString); } optionName = optionName.substring(0, optionName.length - 1); forceGet = true; } if (value === undefined && optionName.substring(0, 2) == 'no') { // To set boolean options to false, the option name is prefixed with // 'no'. optionName = optionName.substring(2); value = false; } var optionIsBoolean = options[optionName] && options[optionName].type == 'boolean'; if (optionIsBoolean && value == undefined) { // Calling set with a boolean option sets it to true. value = true; } // If no value is provided, then we assume this is a get. if (!optionIsBoolean && value === undefined || forceGet) { var oldValue = getOption(optionName, cm, setCfg); if (oldValue === true || oldValue === false) { showConfirm(cm, ' ' + (oldValue ? '' : 'no') + optionName); } else { showConfirm(cm, ' ' + optionName + '=' + oldValue); } } else { setOption(optionName, value, cm, setCfg); } }, setlocal: function (cm, params) { // setCfg is passed through to setOption params.setCfg = {scope: 'local'}; this.set(cm, params); }, setglobal: function (cm, params) { // setCfg is passed through to setOption params.setCfg = {scope: 'global'}; this.set(cm, params); }, registers: function(cm, params) { var regArgs = params.args; var registers = vimGlobalState.registerController.registers; var regInfo = '----------Registers----------

    '; if (!regArgs) { for (var registerName in registers) { var text = registers[registerName].toString(); if (text.length) { regInfo += '"' + registerName + ' ' + text + '
    '; } } } else { var registerName; regArgs = regArgs.join(''); for (var i = 0; i < regArgs.length; i++) { registerName = regArgs.charAt(i); if (!vimGlobalState.registerController.isValidRegister(registerName)) { continue; } var register = registers[registerName] || new Register(); regInfo += '"' + registerName + ' ' + register.toString() + '
    '; } } showConfirm(cm, regInfo); }, sort: function(cm, params) { var reverse, ignoreCase, unique, number; function parseArgs() { if (params.argString) { var args = new CodeMirror.StringStream(params.argString); if (args.eat('!')) { reverse = true; } if (args.eol()) { return; } if (!args.eatSpace()) { return 'Invalid arguments'; } var opts = args.match(/[a-z]+/); if (opts) { opts = opts[0]; ignoreCase = opts.indexOf('i') != -1; unique = opts.indexOf('u') != -1; var decimal = opts.indexOf('d') != -1 && 1; var hex = opts.indexOf('x') != -1 && 1; var octal = opts.indexOf('o') != -1 && 1; if (decimal + hex + octal > 1) { return 'Invalid arguments'; } number = decimal && 'decimal' || hex && 'hex' || octal && 'octal'; } if (args.match(/\/.*\//)) { return 'patterns not supported'; } } } var err = parseArgs(); if (err) { showConfirm(cm, err + ': ' + params.argString); return; } var lineStart = params.line || cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); if (lineStart == lineEnd) { return; } var curStart = Pos(lineStart, 0); var curEnd = Pos(lineEnd, lineLength(cm, lineEnd)); var text = cm.getRange(curStart, curEnd).split('\n'); var numberRegex = (number == 'decimal') ? /(-?)([\d]+)/ : (number == 'hex') ? /(-?)(?:0x)?([0-9a-f]+)/i : (number == 'octal') ? /([0-7]+)/ : null; var radix = (number == 'decimal') ? 10 : (number == 'hex') ? 16 : (number == 'octal') ? 8 : null; var numPart = [], textPart = []; if (number) { for (var i = 0; i < text.length; i++) { if (numberRegex.exec(text[i])) { numPart.push(text[i]); } else { textPart.push(text[i]); } } } else { textPart = text; } function compareFn(a, b) { if (reverse) { var tmp; tmp = a; a = b; b = tmp; } if (ignoreCase) { a = a.toLowerCase(); b = b.toLowerCase(); } var anum = number && numberRegex.exec(a); var bnum = number && numberRegex.exec(b); if (!anum) { return a < b ? -1 : 1; } anum = parseInt((anum[1] + anum[2]).toLowerCase(), radix); bnum = parseInt((bnum[1] + bnum[2]).toLowerCase(), radix); return anum - bnum; } numPart.sort(compareFn); textPart.sort(compareFn); text = (!reverse) ? textPart.concat(numPart) : numPart.concat(textPart); if (unique) { // Remove duplicate lines var textOld = text; var lastLine; text = []; for (var i = 0; i < textOld.length; i++) { if (textOld[i] != lastLine) { text.push(textOld[i]); } lastLine = textOld[i]; } } cm.replaceRange(text.join('\n'), curStart, curEnd); }, global: function(cm, params) { // a global command is of the form // :[range]g/pattern/[cmd] // argString holds the string /pattern/[cmd] var argString = params.argString; if (!argString) { showConfirm(cm, 'Regular Expression missing from global'); return; } // range is specified here var lineStart = (params.line !== undefined) ? params.line : cm.firstLine(); var lineEnd = params.lineEnd || params.line || cm.lastLine(); // get the tokens from argString var tokens = splitBySlash(argString); var regexPart = argString, cmd; if (tokens.length) { regexPart = tokens[0]; cmd = tokens.slice(1, tokens.length).join('/'); } if (regexPart) { // If regex part is empty, then use the previous query. Otherwise // use the regex part as the new query. try { updateSearchQuery(cm, regexPart, true /** ignoreCase */, true /** smartCase */); } catch (e) { showConfirm(cm, 'Invalid regex: ' + regexPart); return; } } // now that we have the regexPart, search for regex matches in the // specified range of lines var query = getSearchState(cm).getQuery(); var matchedLines = [], content = ''; for (var i = lineStart; i <= lineEnd; i++) { var matched = query.test(cm.getLine(i)); if (matched) { matchedLines.push(i+1); content+= cm.getLine(i) + '
    '; } } // if there is no [cmd], just display the list of matched lines if (!cmd) { showConfirm(cm, content); return; } var index = 0; var nextCommand = function() { if (index < matchedLines.length) { var command = matchedLines[index] + cmd; exCommandDispatcher.processCommand(cm, command, { callback: nextCommand }); } index++; }; nextCommand(); }, substitute: function(cm, params) { if (!cm.getSearchCursor) { throw new Error('Search feature not available. Requires searchcursor.js or ' + 'any other getSearchCursor implementation.'); } var argString = params.argString; var tokens = argString ? splitBySlash(argString) : []; var regexPart, replacePart = '', trailing, flagsPart, count; var confirm = false; // Whether to confirm each replace. var global = false; // True to replace all instances on a line, false to replace only 1. if (tokens.length) { regexPart = tokens[0]; replacePart = tokens[1]; if (replacePart !== undefined) { if (getOption('pcre')) { replacePart = unescapeRegexReplace(replacePart); } else { replacePart = translateRegexReplace(replacePart); } vimGlobalState.lastSubstituteReplacePart = replacePart; } trailing = tokens[2] ? tokens[2].split(' ') : []; } else { // either the argString is empty or its of the form ' hello/world' // actually splitBySlash returns a list of tokens // only if the string starts with a '/' if (argString && argString.length) { showConfirm(cm, 'Substitutions should be of the form ' + ':s/pattern/replace/'); return; } } // After the 3rd slash, we can have flags followed by a space followed // by count. if (trailing) { flagsPart = trailing[0]; count = parseInt(trailing[1]); if (flagsPart) { if (flagsPart.indexOf('c') != -1) { confirm = true; flagsPart.replace('c', ''); } if (flagsPart.indexOf('g') != -1) { global = true; flagsPart.replace('g', ''); } regexPart = regexPart + '/' + flagsPart; } } if (regexPart) { // If regex part is empty, then use the previous query. Otherwise use // the regex part as the new query. try { updateSearchQuery(cm, regexPart, true /** ignoreCase */, true /** smartCase */); } catch (e) { showConfirm(cm, 'Invalid regex: ' + regexPart); return; } } replacePart = replacePart || vimGlobalState.lastSubstituteReplacePart; if (replacePart === undefined) { showConfirm(cm, 'No previous substitute regular expression'); return; } var state = getSearchState(cm); var query = state.getQuery(); var lineStart = (params.line !== undefined) ? params.line : cm.getCursor().line; var lineEnd = params.lineEnd || lineStart; if (lineStart == cm.firstLine() && lineEnd == cm.lastLine()) { lineEnd = Infinity; } if (count) { lineStart = lineEnd; lineEnd = lineStart + count - 1; } var startPos = clipCursorToContent(cm, Pos(lineStart, 0)); var cursor = cm.getSearchCursor(query, startPos); doReplace(cm, confirm, global, lineStart, lineEnd, cursor, query, replacePart, params.callback); }, redo: CodeMirror.commands.redo, undo: CodeMirror.commands.undo, write: function(cm) { if (CodeMirror.commands.save) { // If a save command is defined, call it. CodeMirror.commands.save(cm); } else { // Saves to text area if no save command is defined. cm.save(); } }, nohlsearch: function(cm) { clearSearchHighlight(cm); }, delmarks: function(cm, params) { if (!params.argString || !trim(params.argString)) { showConfirm(cm, 'Argument required'); return; } var state = cm.state.vim; var stream = new CodeMirror.StringStream(trim(params.argString)); while (!stream.eol()) { stream.eatSpace(); // Record the streams position at the beginning of the loop for use // in error messages. var count = stream.pos; if (!stream.match(/[a-zA-Z]/, false)) { showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); return; } var sym = stream.next(); // Check if this symbol is part of a range if (stream.match('-', true)) { // This symbol is part of a range. // The range must terminate at an alphabetic character. if (!stream.match(/[a-zA-Z]/, false)) { showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); return; } var startMark = sym; var finishMark = stream.next(); // The range must terminate at an alphabetic character which // shares the same case as the start of the range. if (isLowerCase(startMark) && isLowerCase(finishMark) || isUpperCase(startMark) && isUpperCase(finishMark)) { var start = startMark.charCodeAt(0); var finish = finishMark.charCodeAt(0); if (start >= finish) { showConfirm(cm, 'Invalid argument: ' + params.argString.substring(count)); return; } // Because marks are always ASCII values, and we have // determined that they are the same case, we can use // their char codes to iterate through the defined range. for (var j = 0; j <= finish - start; j++) { var mark = String.fromCharCode(start + j); delete state.marks[mark]; } } else { showConfirm(cm, 'Invalid argument: ' + startMark + '-'); return; } } else { // This symbol is a valid mark, and is not part of a range. delete state.marks[sym]; } } } }; var exCommandDispatcher = new ExCommandDispatcher(); /** * @param {CodeMirror} cm CodeMirror instance we are in. * @param {boolean} confirm Whether to confirm each replace. * @param {Cursor} lineStart Line to start replacing from. * @param {Cursor} lineEnd Line to stop replacing at. * @param {RegExp} query Query for performing matches with. * @param {string} replaceWith Text to replace matches with. May contain $1, * $2, etc for replacing captured groups using Javascript replace. * @param {function()} callback A callback for when the replace is done. */ function doReplace(cm, confirm, global, lineStart, lineEnd, searchCursor, query, replaceWith, callback) { // Set up all the functions. cm.state.vim.exMode = true; var done = false; var lastPos = searchCursor.from(); function replaceAll() { cm.operation(function() { while (!done) { replace(); next(); } stop(); }); } function replace() { var text = cm.getRange(searchCursor.from(), searchCursor.to()); var newText = text.replace(query, replaceWith); searchCursor.replace(newText); } function next() { // The below only loops to skip over multiple occurrences on the same // line when 'global' is not true. while(searchCursor.findNext() && isInRange(searchCursor.from(), lineStart, lineEnd)) { if (!global && lastPos && searchCursor.from().line == lastPos.line) { continue; } cm.scrollIntoView(searchCursor.from(), 30); cm.setSelection(searchCursor.from(), searchCursor.to()); lastPos = searchCursor.from(); done = false; return; } done = true; } function stop(close) { if (close) { close(); } cm.focus(); if (lastPos) { cm.setCursor(lastPos); var vim = cm.state.vim; vim.exMode = false; vim.lastHPos = vim.lastHSPos = lastPos.ch; } if (callback) { callback(); } } function onPromptKeyDown(e, _value, close) { // Swallow all keys. CodeMirror.e_stop(e); var keyName = CodeMirror.keyName(e); switch (keyName) { case 'Y': replace(); next(); break; case 'N': next(); break; case 'A': // replaceAll contains a call to close of its own. We don't want it // to fire too early or multiple times. var savedCallback = callback; callback = undefined; cm.operation(replaceAll); callback = savedCallback; break; case 'L': replace(); // fall through and exit. case 'Q': case 'Esc': case 'Ctrl-C': case 'Ctrl-[': stop(close); break; } if (done) { stop(close); } return true; } // Actually do replace. next(); if (done) { showConfirm(cm, 'No matches for ' + query.source); return; } if (!confirm) { replaceAll(); if (callback) { callback(); } return; } showPrompt(cm, { prefix: 'replace with ' + replaceWith + ' (y/n/a/q/l)', onKeyDown: onPromptKeyDown }); } CodeMirror.keyMap.vim = { attach: attachVimMap, detach: detachVimMap, call: cmKey }; function exitInsertMode(cm) { var vim = cm.state.vim; var macroModeState = vimGlobalState.macroModeState; var insertModeChangeRegister = vimGlobalState.registerController.getRegister('.'); var isPlaying = macroModeState.isPlaying; var lastChange = macroModeState.lastInsertModeChanges; // In case of visual block, the insertModeChanges are not saved as a // single word, so we convert them to a single word // so as to update the ". register as expected in real vim. var text = []; if (!isPlaying) { var selLength = lastChange.inVisualBlock ? vim.lastSelection.visualBlock.height : 1; var changes = lastChange.changes; var text = []; var i = 0; // In case of multiple selections in blockwise visual, // the inserted text, for example: 'foo', is stored as // 'f', 'f', InsertModeKey 'o', 'o', 'o', 'o'. (if you have a block with 2 lines). // We push the contents of the changes array as per the following: // 1. In case of InsertModeKey, just increment by 1. // 2. In case of a character, jump by selLength (2 in the example). while (i < changes.length) { // This loop will convert 'ffoooo' to 'foo'. text.push(changes[i]); if (changes[i] instanceof InsertModeKey) { i++; } else { i+= selLength; } } lastChange.changes = text; cm.off('change', onChange); CodeMirror.off(cm.getInputField(), 'keydown', onKeyEventTargetKeyDown); } if (!isPlaying && vim.insertModeRepeat > 1) { // Perform insert mode repeat for commands like 3,a and 3,o. repeatLastEdit(cm, vim, vim.insertModeRepeat - 1, true /** repeatForInsert */); vim.lastEditInputState.repeatOverride = vim.insertModeRepeat; } delete vim.insertModeRepeat; vim.insertMode = false; cm.setCursor(cm.getCursor().line, cm.getCursor().ch-1); cm.setOption('keyMap', 'vim'); cm.setOption('disableInput', true); lastChange.overwrite = cm.state.overwrite; cm.toggleOverwrite(false); // exit replace mode if we were in it. // update the ". register before exiting insert mode insertModeChangeRegister.setText(lastChange.changes.join('')); CodeMirror.signal(cm, "vim-mode-change", {mode: "normal"}); if (macroModeState.isRecording) { logInsertModeChange(macroModeState); } } function _mapCommand(command) { defaultKeymap.unshift(command); } function mapCommand(keys, type, name, args, extra) { var command = {keys: keys, type: type}; command[type] = name; command[type + "Args"] = args; for (var key in extra) command[key] = extra[key]; _mapCommand(command); } // The timeout in milliseconds for the two-character ESC keymap should be // adjusted according to your typing speed to prevent false positives. defineOption('insertModeEscKeysTimeout', 200, 'number'); CodeMirror.keyMap['vim-insert'] = { // TODO: override navigation keys so that Esc will cancel automatic // indentation from o, O, i_ 'Ctrl-N': 'autocomplete', 'Ctrl-P': 'autocomplete', 'Enter': function(cm) { var fn = CodeMirror.commands.newlineAndIndentContinueComment || CodeMirror.commands.newlineAndIndent; fn(cm); }, fallthrough: ['default'], attach: attachVimMap, detach: detachVimMap, call: cmKey }; CodeMirror.keyMap['vim-replace'] = { 'Backspace': 'goCharLeft', fallthrough: ['vim-insert'], attach: attachVimMap, detach: detachVimMap, call: cmKey }; function executeMacroRegister(cm, vim, macroModeState, registerName) { var register = vimGlobalState.registerController.getRegister(registerName); if (registerName == ':') { // Read-only register containing last Ex command. if (register.keyBuffer[0]) { exCommandDispatcher.processCommand(cm, register.keyBuffer[0]); } macroModeState.isPlaying = false; return; } var keyBuffer = register.keyBuffer; var imc = 0; macroModeState.isPlaying = true; macroModeState.replaySearchQueries = register.searchQueries.slice(0); for (var i = 0; i < keyBuffer.length; i++) { var text = keyBuffer[i]; var match, key; while (text) { // Pull off one command key, which is either a single character // or a special sequence wrapped in '<' and '>', e.g. ''. match = (/<\w+-.+?>|<\w+>|./).exec(text); key = match[0]; text = text.substring(match.index + key.length); CodeMirror.Vim.handleKey(cm, key, 'macro'); if (vim.insertMode) { var changes = register.insertModeChanges[imc++].changes; vimGlobalState.macroModeState.lastInsertModeChanges.changes = changes; repeatInsertModeChanges(cm, changes, 1); exitInsertMode(cm); } } } macroModeState.isPlaying = false; } function logKey(macroModeState, key) { if (macroModeState.isPlaying) { return; } var registerName = macroModeState.latestRegister; var register = vimGlobalState.registerController.getRegister(registerName); if (register) { register.pushText(key); } } function logInsertModeChange(macroModeState) { if (macroModeState.isPlaying) { return; } var registerName = macroModeState.latestRegister; var register = vimGlobalState.registerController.getRegister(registerName); if (register && register.pushInsertModeChanges) { register.pushInsertModeChanges(macroModeState.lastInsertModeChanges); } } function logSearchQuery(macroModeState, query) { if (macroModeState.isPlaying) { return; } var registerName = macroModeState.latestRegister; var register = vimGlobalState.registerController.getRegister(registerName); if (register && register.pushSearchQuery) { register.pushSearchQuery(query); } } /** * Listens for changes made in insert mode. * Should only be active in insert mode. */ function onChange(_cm, changeObj) { var macroModeState = vimGlobalState.macroModeState; var lastChange = macroModeState.lastInsertModeChanges; if (!macroModeState.isPlaying) { while(changeObj) { lastChange.expectCursorActivityForChange = true; if (changeObj.origin == '+input' || changeObj.origin == 'paste' || changeObj.origin === undefined /* only in testing */) { var text = changeObj.text.join('\n'); if (lastChange.maybeReset) { lastChange.changes = []; lastChange.maybeReset = false; } lastChange.changes.push(text); } // Change objects may be chained with next. changeObj = changeObj.next; } } } /** * Listens for any kind of cursor activity on CodeMirror. */ function onCursorActivity(cm) { var vim = cm.state.vim; if (vim.insertMode) { // Tracking cursor activity in insert mode (for macro support). var macroModeState = vimGlobalState.macroModeState; if (macroModeState.isPlaying) { return; } var lastChange = macroModeState.lastInsertModeChanges; if (lastChange.expectCursorActivityForChange) { lastChange.expectCursorActivityForChange = false; } else { // Cursor moved outside the context of an edit. Reset the change. lastChange.maybeReset = true; } } else if (!cm.curOp.isVimOp) { handleExternalSelection(cm, vim); } if (vim.visualMode) { updateFakeCursor(cm); } } function updateFakeCursor(cm) { var vim = cm.state.vim; var from = clipCursorToContent(cm, copyCursor(vim.sel.head)); var to = offsetCursor(from, 0, 1); if (vim.fakeCursor) { vim.fakeCursor.clear(); } vim.fakeCursor = cm.markText(from, to, {className: 'cm-animate-fat-cursor'}); } function handleExternalSelection(cm, vim) { var anchor = cm.getCursor('anchor'); var head = cm.getCursor('head'); // Enter or exit visual mode to match mouse selection. if (vim.visualMode && !cm.somethingSelected()) { exitVisualMode(cm, false); } else if (!vim.visualMode && !vim.insertMode && cm.somethingSelected()) { vim.visualMode = true; vim.visualLine = false; CodeMirror.signal(cm, "vim-mode-change", {mode: "visual"}); } if (vim.visualMode) { // Bind CodeMirror selection model to vim selection model. // Mouse selections are considered visual characterwise. var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; head = offsetCursor(head, 0, headOffset); anchor = offsetCursor(anchor, 0, anchorOffset); vim.sel = { anchor: anchor, head: head }; updateMark(cm, vim, '<', cursorMin(head, anchor)); updateMark(cm, vim, '>', cursorMax(head, anchor)); } else if (!vim.insertMode) { // Reset lastHPos if selection was modified by something outside of vim mode e.g. by mouse. vim.lastHPos = cm.getCursor().ch; } } /** Wrapper for special keys pressed in insert mode */ function InsertModeKey(keyName) { this.keyName = keyName; } /** * Handles raw key down events from the text area. * - Should only be active in insert mode. * - For recording deletes in insert mode. */ function onKeyEventTargetKeyDown(e) { var macroModeState = vimGlobalState.macroModeState; var lastChange = macroModeState.lastInsertModeChanges; var keyName = CodeMirror.keyName(e); if (!keyName) { return; } function onKeyFound() { if (lastChange.maybeReset) { lastChange.changes = []; lastChange.maybeReset = false; } lastChange.changes.push(new InsertModeKey(keyName)); return true; } if (keyName.indexOf('Delete') != -1 || keyName.indexOf('Backspace') != -1) { CodeMirror.lookupKey(keyName, 'vim-insert', onKeyFound); } } /** * Repeats the last edit, which includes exactly 1 command and at most 1 * insert. Operator and motion commands are read from lastEditInputState, * while action commands are read from lastEditActionCommand. * * If repeatForInsert is true, then the function was called by * exitInsertMode to repeat the insert mode changes the user just made. The * corresponding enterInsertMode call was made with a count. */ function repeatLastEdit(cm, vim, repeat, repeatForInsert) { var macroModeState = vimGlobalState.macroModeState; macroModeState.isPlaying = true; var isAction = !!vim.lastEditActionCommand; var cachedInputState = vim.inputState; function repeatCommand() { if (isAction) { commandDispatcher.processAction(cm, vim, vim.lastEditActionCommand); } else { commandDispatcher.evalInput(cm, vim); } } function repeatInsert(repeat) { if (macroModeState.lastInsertModeChanges.changes.length > 0) { // For some reason, repeat cw in desktop VIM does not repeat // insert mode changes. Will conform to that behavior. repeat = !vim.lastEditActionCommand ? 1 : repeat; var changeObject = macroModeState.lastInsertModeChanges; repeatInsertModeChanges(cm, changeObject.changes, repeat, changeObject.overwrite); } } vim.inputState = vim.lastEditInputState; if (isAction && vim.lastEditActionCommand.interlaceInsertRepeat) { // o and O repeat have to be interlaced with insert repeats so that the // insertions appear on separate lines instead of the last line. for (var i = 0; i < repeat; i++) { repeatCommand(); repeatInsert(1); } } else { if (!repeatForInsert) { // Hack to get the cursor to end up at the right place. If I is // repeated in insert mode repeat, cursor will be 1 insert // change set left of where it should be. repeatCommand(); } repeatInsert(repeat); } vim.inputState = cachedInputState; if (vim.insertMode && !repeatForInsert) { // Don't exit insert mode twice. If repeatForInsert is set, then we // were called by an exitInsertMode call lower on the stack. exitInsertMode(cm); } macroModeState.isPlaying = false; } function repeatInsertModeChanges(cm, changes, repeat, overwrite) { function keyHandler(binding) { if (typeof binding == 'string') { CodeMirror.commands[binding](cm); } else { binding(cm); } return true; } var head = cm.getCursor('head'); var inVisualBlock = vimGlobalState.macroModeState.lastInsertModeChanges.inVisualBlock; if (inVisualBlock) { // Set up block selection again for repeating the changes. var vim = cm.state.vim; var lastSel = vim.lastSelection; var offset = getOffset(lastSel.anchor, lastSel.head); selectForInsert(cm, head, offset.line + 1); repeat = cm.listSelections().length; cm.setCursor(head); } for (var i = 0; i < repeat; i++) { if (inVisualBlock) { cm.setCursor(offsetCursor(head, i, 0)); } for (var j = 0; j < changes.length; j++) { var change = changes[j]; if (change instanceof InsertModeKey) { CodeMirror.lookupKey(change.keyName, 'vim-insert', keyHandler); } else { var cur = cm.getCursor(); var end = cur; if (overwrite && !/\n/.test(change)) { end = offsetCursor(cur, 0, change.length); } cm.replaceRange(change, cur, end); } } } if (inVisualBlock) { cm.setCursor(offsetCursor(head, 0, 1)); } } resetVimGlobalState(); //}; // Initialize Vim and make it available as an API. CodeMirror.Vim = Vim(); Vim = CodeMirror.Vim; var specialKey = {'return':'CR',backspace:'BS','delete':'Del',esc:'Esc', left:'Left',right:'Right',up:'Up',down:'Down',space: 'Space', home:'Home',end:'End',pageup:'PageUp',pagedown:'PageDown', enter: 'CR' }; function lookupKey(hashId, key, e) { if (key.length > 1 && key[0] == "n") { key = key.replace("numpad", ""); } key = specialKey[key] || key; var name = ''; if (e.ctrlKey) { name += 'C-'; } if (e.altKey) { name += 'A-'; } if (e.shiftKey) { name += 'S-'; } name += key; if (name.length > 1) { name = '<' + name + '>'; } return name; } var handleKey = Vim.handleKey.bind(Vim); Vim.handleKey = function(cm, key, origin) { return cm.operation(function() { return handleKey(cm, key, origin); }, true); } function cloneVimState(state) { var n = new state.constructor(); Object.keys(state).forEach(function(key) { var o = state[key]; if (Array.isArray(o)) o = o.slice(); else if (o && typeof o == "object" && o.constructor != Object) o = cloneVimState(o); n[key] = o; }); if (state.sel) { n.sel = { head: state.sel.head && copyCursor(state.sel.head), anchor: state.sel.anchor && copyCursor(state.sel.anchor) }; } return n; } function multiSelectHandleKey(cm, key, origin) { var isHandled = false; var vim = Vim.maybeInitVimState_(cm); var visualBlock = vim.visualBlock || vim.wasInVisualBlock; if (vim.wasInVisualBlock && !cm.ace.inMultiSelectMode) { vim.wasInVisualBlock = false; } else if (cm.ace.inMultiSelectMode && vim.visualBlock) { vim.wasInVisualBlock = true; } if (key == '' && !vim.insertMode && !vim.visualMode && cm.ace.inMultiSelectMode) { cm.ace.exitMultiSelectMode(); } else if (visualBlock || !cm.ace.inMultiSelectMode || cm.ace.inVirtualSelectionMode) { isHandled = Vim.handleKey(cm, key, origin); } else { var old = cloneVimState(vim); cm.operation(function() { cm.ace.forEachSelection(function() { var sel = cm.ace.selection; cm.state.vim.lastHPos = sel.$desiredColumn == null ? sel.lead.column : sel.$desiredColumn; var head = cm.getCursor("head"); var anchor = cm.getCursor("anchor"); var headOffset = !cursorIsBefore(head, anchor) ? -1 : 0; var anchorOffset = cursorIsBefore(head, anchor) ? -1 : 0; head = offsetCursor(head, 0, headOffset); anchor = offsetCursor(anchor, 0, anchorOffset); cm.state.vim.sel.head = head; cm.state.vim.sel.anchor = anchor; isHandled = handleKey(cm, key, origin); sel.$desiredColumn = cm.state.vim.lastHPos == -1 ? null : cm.state.vim.lastHPos; if (cm.virtualSelectionMode()) { cm.state.vim = cloneVimState(old); } }); if (cm.curOp.cursorActivity && !isHandled) cm.curOp.cursorActivity = false; }, true); } return isHandled; } exports.CodeMirror = CodeMirror; var getVim = Vim.maybeInitVimState_; exports.handler = { $id: "ace/keyboard/vim", drawCursor: function(style, pixelPos, config, sel, session) { var vim = this.state.vim || {}; var w = config.characterWidth; var h = config.lineHeight; var top = pixelPos.top; var left = pixelPos.left; if (!vim.insertMode) { var isbackwards = !sel.cursor ? session.selection.isBackwards() || session.selection.isEmpty() : Range.comparePoints(sel.cursor, sel.start) <= 0; if (!isbackwards && left > w) left -= w; } if (!vim.insertMode && vim.status) { h = h / 2; top += h; } style.left = left + "px"; style.top = top + "px"; style.width = w + "px"; style.height = h + "px"; }, handleKeyboard: function(data, hashId, key, keyCode, e) { var editor = data.editor; var cm = editor.state.cm; var vim = getVim(cm); if (keyCode == -1) return; if (key == "c" && hashId == 1) { // key == "ctrl-c" if (!useragent.isMac && editor.getCopyText()) { editor.once("copy", function() { editor.selection.clearSelection(); }); return {command: "null", passEvent: true}; } } else if (!vim.insertMode) { if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) { hashId = -1; key = data.inputChar; } } if (hashId == -1 || hashId & 1 || hashId === 0 && key.length > 1) { var insertMode = vim.insertMode; var name = lookupKey(hashId, key, e || {}); if (vim.status == null) vim.status = ""; var isHandled = multiSelectHandleKey(cm, name, 'user'); vim = getVim(cm); // may be changed by multiSelectHandleKey if (isHandled && vim.status != null) vim.status += name; else if (vim.status == null) vim.status = ""; cm._signal("changeStatus"); if (!isHandled && (hashId != -1 || insertMode)) return; return {command: "null", passEvent: !isHandled}; } }, attach: function(editor) { if (!editor.state) editor.state = {}; var cm = new CodeMirror(editor); editor.state.cm = cm; editor.$vimModeHandler = this; CodeMirror.keyMap.vim.attach(cm); getVim(cm).status = null; cm.on('vim-command-done', function() { if (cm.virtualSelectionMode()) return; getVim(cm).status = null; cm.ace._signal("changeStatus"); cm.ace.session.markUndoGroup(); }); cm.on("changeStatus", function() { cm.ace.renderer.updateCursor(); cm.ace._signal("changeStatus"); }); cm.on("vim-mode-change", function() { if (cm.virtualSelectionMode()) return; cm.ace.renderer.setStyle("normal-mode", !getVim(cm).insertMode); cm._signal("changeStatus"); }); cm.ace.renderer.setStyle("normal-mode", !getVim(cm).insertMode); editor.renderer.$cursorLayer.drawCursor = this.drawCursor.bind(cm); // renderVirtualNumbers.attach(editor); this.updateMacCompositionHandlers(editor, true); }, detach: function(editor) { var cm = editor.state.cm; CodeMirror.keyMap.vim.detach(cm); cm.destroy(); editor.state.cm = null; editor.$vimModeHandler = null; editor.renderer.$cursorLayer.drawCursor = null; editor.renderer.setStyle("normal-mode", false); // renderVirtualNumbers.detach(editor); this.updateMacCompositionHandlers(editor, false); }, getStatusText: function(editor) { var cm = editor.state.cm; var vim = getVim(cm); if (vim.insertMode) return "INSERT"; var status = ""; if (vim.visualMode) { status += "VISUAL"; if (vim.visualLine) status += " LINE"; if (vim.visualBlock) status += " BLOCK"; } if (vim.status) status += (status ? " " : "") + vim.status; return status; }, // workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true` handleMacRepeat: function(data, hashId, key) { if (hashId == -1) { // record key data.inputChar = key; data.lastEvent = "input"; } else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) { // check for repeated keypress if (data.lastEvent == "input") { data.lastEvent = "input1"; } else if (data.lastEvent == "input1") { // simulate textinput return true; } } else { // reset data.$lastHash = hashId; data.$lastKey = key; data.lastEvent = "keypress"; } }, // on mac, with some keyboard layouts (e.g swedish) ^ starts composition, we don't need it in normal mode updateMacCompositionHandlers: function(editor, enable) { var onCompositionUpdateOverride = function(text) { var cm = editor.state.cm; var vim = getVim(cm); if (!vim.insertMode) { var el = this.textInput.getElement(); el.blur(); el.focus(); el.value = text; } else { this.onCompositionUpdateOrig(text); } }; var onCompositionStartOverride = function(text) { var cm = editor.state.cm; var vim = getVim(cm); if (!vim.insertMode) { this.onCompositionStartOrig(text); } }; if (enable) { if (!editor.onCompositionUpdateOrig) { editor.onCompositionUpdateOrig = editor.onCompositionUpdate; editor.onCompositionUpdate = onCompositionUpdateOverride; editor.onCompositionStartOrig = editor.onCompositionStart; editor.onCompositionStart = onCompositionStartOverride; } } else { if (editor.onCompositionUpdateOrig) { editor.onCompositionUpdate = editor.onCompositionUpdateOrig; editor.onCompositionUpdateOrig = null; editor.onCompositionStart = editor.onCompositionStartOrig; editor.onCompositionStartOrig = null; } } } }; var renderVirtualNumbers = { getText: function(session, row) { return (Math.abs(session.selection.lead.row - row) || (row + 1 + (row < 9? "\xb7" : "" ))) + ""; }, getWidth: function(session, lastLineNumber, config) { return session.getLength().toString().length * config.characterWidth; }, update: function(e, editor) { editor.renderer.$loop.schedule(editor.renderer.CHANGE_GUTTER); }, attach: function(editor) { editor.renderer.$gutterLayer.$renderer = this; editor.on("changeSelection", this.update); }, detach: function(editor) { editor.renderer.$gutterLayer.$renderer = null; editor.off("changeSelection", this.update); } }; Vim.defineOption({ name: "wrap", set: function(value, cm) { if (cm) {cm.ace.setOption("wrap", value)} }, type: "boolean" }, false); Vim.defineEx('write', 'w', function() { console.log(':write is not implemented') }); defaultKeymap.push( { keys: 'zc', type: 'action', action: 'fold', actionArgs: { open: false } }, { keys: 'zC', type: 'action', action: 'fold', actionArgs: { open: false, all: true } }, { keys: 'zo', type: 'action', action: 'fold', actionArgs: { open: true } }, { keys: 'zO', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'za', type: 'action', action: 'fold', actionArgs: { toggle: true } }, { keys: 'zA', type: 'action', action: 'fold', actionArgs: { toggle: true, all: true } }, { keys: 'zf', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: 'zd', type: 'action', action: 'fold', actionArgs: { open: true, all: true } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAbove" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelow" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorAboveSkipCurrent" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "addCursorBelowSkipCurrent" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreBefore" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectMoreAfter" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextBefore" } }, { keys: '', type: 'action', action: 'aceCommand', actionArgs: { name: "selectNextAfter" } } ); actions.aceCommand = function(cm, actionArgs, vim) { cm.vimCmd = actionArgs; if (cm.ace.inVirtualSelectionMode) cm.ace.on("beforeEndOperation", delayedExecAceCommand); else delayedExecAceCommand(null, cm.ace); }; function delayedExecAceCommand(op, ace) { ace.off("beforeEndOperation", delayedExecAceCommand); var cmd = ace.state.cm.vimCmd; if (cmd) { ace.execCommand(cmd.exec ? cmd : cmd.name, cmd.args); } ace.curOp = ace.prevOp; } actions.fold = function(cm, actionArgs, vim) { cm.ace.execCommand(['toggleFoldWidget', 'toggleFoldWidget', 'foldOther', 'unfoldall' ][(actionArgs.all ? 2 : 0) + (actionArgs.open ? 1 : 0)]); }; exports.handler.defaultKeymap = defaultKeymap; exports.handler.actions = actions; exports.Vim = Vim; Vim.map("Y", "yy", "normal"); }); ================================================ FILE: lib/ace/keyboard/vim_test.js ================================================ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { var EditSession = require("./../edit_session").EditSession; var Editor = require("./../editor").Editor; var UndoManager = require("./../undomanager").UndoManager; var MockRenderer = require("./../test/mockrenderer").MockRenderer; var JavaScriptMode = require("./../mode/javascript").Mode; var VirtualRenderer = require("./../virtual_renderer").VirtualRenderer; var assert = require("./../test/assertions"); var keys = require("./../lib/keys"); var vim = require("./vim"); var el = document.createElement("div"); el.style.position = "fixed"; el.style.left = "20px"; el.style.top = "30px"; el.style.width = "500px"; el.style.height = "300px"; document.body.appendChild(el); if (window.name == "nodejs") return console.log("Skipping test: This test only runs in the browser"); var renderer = new VirtualRenderer(el); editor = new Editor(renderer);//(new MockRenderer()); editor.session.setUndoManager(new UndoManager()); editor.session.setUseWorker(false); editor.session.setMode(new JavaScriptMode()); function CodeMirror(place, opts) { if (opts.value != null) editor.session.setValue(opts.value); editor.setOption("indentedSoftWrap", false); editor.setOption("wrap", opts.lineWrapping); editor.setOption("useSoftTabs", !opts.indentWithTabs); editor.setKeyboardHandler(null); editor.setKeyboardHandler(vim.handler); var cm = editor.state.cm; cm.setOption("tabSize", opts.tabSize || 4); cm.setOption("indentUnit", opts.indentUnit || 2); cm.setSize = function(w, h) { var changed = false; if (w && editor.w != w) { changed = true; el.style.width = (editor.w = w) + "px"; } if (h && editor.h != h) { changed = true; el.style.height = (editor.h = h) + "px"; } if (changed) editor.resize(true); }; cm.setSize(500, 300); return cm; } CodeMirror.defineMode = function() {} for (var key in vim.CodeMirror) CodeMirror[key] = vim.CodeMirror[key]; var editor; var i = 0; function test(name, fn) { // if (name != 'vim_search_history') return // for (i = 0; i < 1000; i++) // exports["test " + name + i] = fn; // vim_ex_global_confirm if (i++ < 0 || /- /.test(name)) exports["test " + name] = function() {}; else exports["test " + name] = fn; } function expectFail(fn) { try { fn(); } catch(expected) {}; throw new Error("Expected to throw an error"); } vim.CodeMirror.Vim.unmap("Y"); vim.CodeMirror.Vim.defineEx('write', 'w', function(cm) { CodeMirror.commands.save(cm); }); // cm.setBookmark({ch: 5, line: 0}) // cm.setBookmark({ch: 4, line: 0}) // cm.replaceRange("x-", {ch: 4, line: 0}, {ch: 5, line: 0}); [editor.$vimModeHandler.cm.marks[0].find(),editor.$vimModeHandler.cm.marks[1].find()] var lineText, verbose, phantom; var Pos = CodeMirror.Pos; var place = document.createElement("div"); var eqPos = assert.deepEqual; var eq = assert.equal; var is = assert.ok; CodeMirror.Vim.suppressErrorLogging = true; var code = '' + ' wOrd1 (#%\n' + ' word3] \n' + 'aopop pop 0 1 2 3 4\n' + ' (a) [b] {c} \n' + 'int getchar(void) {\n' + ' static char buf[BUFSIZ];\n' + ' static char *bufp = buf;\n' + ' if (n == 0) { /* buffer is empty */\n' + ' n = read(0, buf, sizeof buf);\n' + ' bufp = buf;\n' + ' }\n' + '\n' + ' return (--n >= 0) ? (unsigned char) *bufp++ : EOF;\n' + ' \n' + '}\n'; var lines = (function() { lineText = code.split('\n'); var ret = []; for (var i = 0; i < lineText.length; i++) { ret[i] = { line: i, length: lineText[i].length, lineText: lineText[i], textStart: /^\s*/.exec(lineText[i])[0].length }; } return ret; })(); var endOfDocument = makeCursor(lines.length - 1, lines[lines.length - 1].length); var wordLine = lines[0]; var bigWordLine = lines[1]; var charLine = lines[2]; var bracesLine = lines[3]; var seekBraceLine = lines[4]; var word1 = { start: { line: wordLine.line, ch: 1 }, end: { line: wordLine.line, ch: 5 } }; var word2 = { start: { line: wordLine.line, ch: word1.end.ch + 2 }, end: { line: wordLine.line, ch: word1.end.ch + 4 } }; var word3 = { start: { line: bigWordLine.line, ch: 1 }, end: { line: bigWordLine.line, ch: 5 } }; var bigWord1 = word1; var bigWord2 = word2; var bigWord3 = { start: { line: bigWordLine.line, ch: 1 }, end: { line: bigWordLine.line, ch: 7 } }; var bigWord4 = { start: { line: bigWordLine.line, ch: bigWord1.end.ch + 3 }, end: { line: bigWordLine.line, ch: bigWord1.end.ch + 7 } }; var oChars = [ { line: charLine.line, ch: 1 }, { line: charLine.line, ch: 3 }, { line: charLine.line, ch: 7 } ]; var pChars = [ { line: charLine.line, ch: 2 }, { line: charLine.line, ch: 4 }, { line: charLine.line, ch: 6 }, { line: charLine.line, ch: 8 } ]; var numChars = [ { line: charLine.line, ch: 10 }, { line: charLine.line, ch: 12 }, { line: charLine.line, ch: 14 }, { line: charLine.line, ch: 16 }, { line: charLine.line, ch: 18 }]; var parens1 = { start: { line: bracesLine.line, ch: 1 }, end: { line: bracesLine.line, ch: 3 } }; var squares1 = { start: { line: bracesLine.line, ch: 5 }, end: { line: bracesLine.line, ch: 7 } }; var curlys1 = { start: { line: bracesLine.line, ch: 9 }, end: { line: bracesLine.line, ch: 11 } }; var seekOutside = { start: { line: seekBraceLine.line, ch: 1 }, end: { line: seekBraceLine.line, ch: 16 } }; var seekInside = { start: { line: seekBraceLine.line, ch: 14 }, end: { line: seekBraceLine.line, ch: 11 } }; function copyCursor(cur) { return { ch: cur.ch, line: cur.line }; } function forEach(arr, func) { for (var i = 0; i < arr.length; i++) { func(arr[i], i, arr); } } function testVim(name, run, opts, expectedFail) { var vimOpts = { lineNumbers: true, vimMode: true, showCursorWhenSelecting: true, value: code }; for (var prop in opts) { if (opts.hasOwnProperty(prop)) { vimOpts[prop] = opts[prop]; } } return test('vim_' + name, function() { var place = document.getElementById("testground"); var cm = CodeMirror(place, vimOpts); var vim = CodeMirror.Vim.maybeInitVimState_(cm); function doKeysFn(cm) { return function(args) { if (args instanceof Array) { arguments = args; } for (var i = 0; i < arguments.length; i++) { var result = CodeMirror.Vim.handleKey(cm, arguments[i]); if (!result && cm.state.vim.insertMode) { cm.replaceSelections(fillArray(arguments[i], cm.listSelections().length)); } } } } function doInsertModeKeysFn(cm) { return function(args) { if (args instanceof Array) { arguments = args; } function executeHandler(handler) { if (typeof handler == 'string') { CodeMirror.commands[handler](cm); } else { handler(cm); } return true; } for (var i = 0; i < arguments.length; i++) { var key = arguments[i]; // Find key in keymap and handle. var handled = CodeMirror.lookupKey(key, 'vim-insert', executeHandler); // Record for insert mode. if (handled == "handled" && cm.state.vim.insertMode && arguments[i] != 'Esc') { var lastChange = CodeMirror.Vim.getVimGlobalState_().macroModeState.lastInsertModeChanges; if (lastChange && (key.indexOf('Delete') != -1 || key.indexOf('Backspace') != -1)) { lastChange.changes.push(new CodeMirror.Vim.InsertModeKey(key)); } } } } } function doExFn(cm) { return function(command) { cm.openDialog = helpers.fakeOpenDialog(command); helpers.doKeys(':'); } } function assertCursorAtFn(cm) { return function(line, ch) { var pos; if (ch == null && typeof line.line == 'number') { pos = line; } else { pos = makeCursor(line, ch); } eqPos(pos, cm.getCursor()); } } function fakeOpenDialog(result) { return function(text, callback) { return callback(result); } } function fakeOpenNotification(matcher) { return function(text) { matcher(text); } } var helpers = { doKeys: doKeysFn(cm), // Warning: Only emulates keymap events, not character insertions. Use // replaceRange to simulate character insertions. // Keys are in CodeMirror format, NOT vim format. doInsertModeKeys: doInsertModeKeysFn(cm), doEx: doExFn(cm), assertCursorAt: assertCursorAtFn(cm), fakeOpenDialog: fakeOpenDialog, fakeOpenNotification: fakeOpenNotification, getRegisterController: function() { return CodeMirror.Vim.getRegisterController(); } } CodeMirror.Vim.resetVimGlobalState_(); var successful = false; var savedOpenNotification = cm.openNotification; var savedOpenDialog = cm.openDialog; try { run(cm, vim, helpers); successful = true; } finally { cm.openNotification = savedOpenNotification; cm.openDialog = savedOpenDialog; // ace_patch } }); } testVim('qq@q', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'q', 'l', 'l', 'q'); helpers.assertCursorAt(0,2); helpers.doKeys('@', 'q'); helpers.assertCursorAt(0,4); }, { value: ' '}); testVim('@@', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'q', 'l', 'l', 'q'); helpers.assertCursorAt(0,2); helpers.doKeys('@', 'q'); helpers.assertCursorAt(0,4); helpers.doKeys('@', '@'); helpers.assertCursorAt(0,6); }, { value: ' '}); var jumplistScene = ''+ 'word\n'+ '(word)\n'+ '{word\n'+ 'word.\n'+ '\n'+ 'word search\n'+ '}word\n'+ 'word\n'+ 'word\n'; function testJumplist(name, keys, endPos, startPos, dialog) { endPos = makeCursor(endPos[0], endPos[1]); startPos = makeCursor(startPos[0], startPos[1]); testVim(name, function(cm, vim, helpers) { CodeMirror.Vim.resetVimGlobalState_(); if(dialog)cm.openDialog = helpers.fakeOpenDialog('word'); cm.setCursor(startPos); helpers.doKeys.apply(null, keys); helpers.assertCursorAt(endPos); }, {value: jumplistScene}); } testJumplist('jumplist_H', ['H', ''], [5,2], [5,2]); testJumplist('jumplist_M', ['M', ''], [2,2], [2,2]); testJumplist('jumplist_L', ['L', ''], [2,2], [2,2]); testJumplist('jumplist_[[', ['[', '[', ''], [5,2], [5,2]); testJumplist('jumplist_]]', [']', ']', ''], [2,2], [2,2]); testJumplist('jumplist_G', ['G', ''], [5,2], [5,2]); testJumplist('jumplist_gg', ['g', 'g', ''], [5,2], [5,2]); testJumplist('jumplist_%', ['%', ''], [1,5], [1,5]); testJumplist('jumplist_{', ['{', ''], [1,5], [1,5]); testJumplist('jumplist_}', ['}', ''], [1,5], [1,5]); testJumplist('jumplist_\'', ['m', 'a', 'h', '\'', 'a', 'h', ''], [1,0], [1,5]); testJumplist('jumplist_`', ['m', 'a', 'h', '`', 'a', 'h', ''], [1,5], [1,5]); testJumplist('jumplist_*_cachedCursor', ['*', ''], [1,3], [1,3]); testJumplist('jumplist_#_cachedCursor', ['#', ''], [1,3], [1,3]); testJumplist('jumplist_n', ['#', 'n', ''], [1,1], [2,3]); testJumplist('jumplist_N', ['#', 'N', ''], [1,1], [2,3]); testJumplist('jumplist_repeat_', ['*', '*', '*', '3', ''], [2,3], [2,3]); testJumplist('jumplist_repeat_', ['*', '*', '*', '3', '', '2', ''], [5,0], [2,3]); testJumplist('jumplist_repeated_motion', ['3', '*', ''], [2,3], [2,3]); testJumplist('jumplist_/', ['/', ''], [2,3], [2,3], 'dialog'); testJumplist('jumplist_?', ['?', ''], [2,3], [2,3], 'dialog'); testJumplist('jumplist_skip_delted_mark', ['*', 'n', 'n', 'k', 'd', 'k', '', '', ''], [0,2], [0,2]); testJumplist('jumplist_skip_delted_mark', ['*', 'n', 'n', 'k', 'd', 'k', '', '', ''], [1,0], [0,2]); /** * @param name Name of the test * @param keys An array of keys or a string with a single key to simulate. * @param endPos The expected end position of the cursor. * @param startPos The position the cursor should start at, defaults to 0, 0. */ function testMotion(name, keys, endPos, startPos) { testVim(name, function(cm, vim, helpers) { if (!startPos) { startPos = { line: 0, ch: 0 }; } cm.setCursor(startPos); helpers.doKeys(keys); helpers.assertCursorAt(endPos); }); } function makeCursor(line, ch) { return { line: line, ch: ch }; } function offsetCursor(cur, offsetLine, offsetCh) { return { line: cur.line + offsetLine, ch: cur.ch + offsetCh }; } // Motion tests testMotion('|', '|', makeCursor(0, 0), makeCursor(0,4)); testMotion('|_repeat', ['3', '|'], makeCursor(0, 2), makeCursor(0,4)); testMotion('h', 'h', makeCursor(0, 0), word1.start); testMotion('h_repeat', ['3', 'h'], offsetCursor(word1.end, 0, -3), word1.end); testMotion('l', 'l', makeCursor(0, 1)); testMotion('l_repeat', ['2', 'l'], makeCursor(0, 2)); testMotion('j', 'j', offsetCursor(word1.end, 1, 0), word1.end); testMotion('j_repeat', ['2', 'j'], offsetCursor(word1.end, 2, 0), word1.end); testMotion('j_repeat_clip', ['1000', 'j'], endOfDocument); testMotion('k', 'k', offsetCursor(word3.end, -1, 0), word3.end); testMotion('k_repeat', ['2', 'k'], makeCursor(0, 4), makeCursor(2, 4)); testMotion('k_repeat_clip', ['1000', 'k'], makeCursor(0, 4), makeCursor(2, 4)); testMotion('w', 'w', word1.start); testMotion('w_multiple_newlines_no_space', 'w', makeCursor(12, 2), makeCursor(11, 2)); testMotion('w_multiple_newlines_with_space', 'w', makeCursor(14, 0), makeCursor(12, 51)); testMotion('w_repeat', ['2', 'w'], word2.start); testMotion('w_wrap', ['w'], word3.start, word2.start); testMotion('w_endOfDocument', 'w', endOfDocument, endOfDocument); testMotion('w_start_to_end', ['1000', 'w'], endOfDocument, makeCursor(0, 0)); testMotion('W', 'W', bigWord1.start); testMotion('W_repeat', ['2', 'W'], bigWord3.start, bigWord1.start); testMotion('e', 'e', word1.end); testMotion('e_repeat', ['2', 'e'], word2.end); testMotion('e_wrap', 'e', word3.end, word2.end); testMotion('e_endOfDocument', 'e', endOfDocument, endOfDocument); testMotion('e_start_to_end', ['1000', 'e'], endOfDocument, makeCursor(0, 0)); testMotion('b', 'b', word3.start, word3.end); testMotion('b_repeat', ['2', 'b'], word2.start, word3.end); testMotion('b_wrap', 'b', word2.start, word3.start); testMotion('b_startOfDocument', 'b', makeCursor(0, 0), makeCursor(0, 0)); testMotion('b_end_to_start', ['1000', 'b'], makeCursor(0, 0), endOfDocument); testMotion('ge', ['g', 'e'], word2.end, word3.end); testMotion('ge_repeat', ['2', 'g', 'e'], word1.end, word3.start); testMotion('ge_wrap', ['g', 'e'], word2.end, word3.start); testMotion('ge_startOfDocument', ['g', 'e'], makeCursor(0, 0), makeCursor(0, 0)); testMotion('ge_end_to_start', ['1000', 'g', 'e'], makeCursor(0, 0), endOfDocument); testMotion('gg', ['g', 'g'], makeCursor(lines[0].line, lines[0].textStart), makeCursor(3, 1)); testMotion('gg_repeat', ['3', 'g', 'g'], makeCursor(lines[2].line, lines[2].textStart)); testMotion('G', 'G', makeCursor(lines[lines.length - 1].line, lines[lines.length - 1].textStart), makeCursor(3, 1)); testMotion('G_repeat', ['3', 'G'], makeCursor(lines[2].line, lines[2].textStart)); // TODO: Make the test code long enough to test Ctrl-F and Ctrl-B. testMotion('0', '0', makeCursor(0, 0), makeCursor(0, 8)); testMotion('^', '^', makeCursor(0, lines[0].textStart), makeCursor(0, 8)); testMotion('+', '+', makeCursor(1, lines[1].textStart), makeCursor(0, 8)); testMotion('-', '-', makeCursor(0, lines[0].textStart), makeCursor(1, 4)); testMotion('_', ['6','_'], makeCursor(5, lines[5].textStart), makeCursor(0, 8)); testMotion('$', '$', makeCursor(0, lines[0].length - 1), makeCursor(0, 1)); testMotion('$_repeat', ['2', '$'], makeCursor(1, lines[1].length - 1), makeCursor(0, 3)); testMotion('f', ['f', 'p'], pChars[0], makeCursor(charLine.line, 0)); testMotion('f_repeat', ['2', 'f', 'p'], pChars[2], pChars[0]); testMotion('f_num', ['f', '2'], numChars[2], makeCursor(charLine.line, 0)); testMotion('t', ['t','p'], offsetCursor(pChars[0], 0, -1), makeCursor(charLine.line, 0)); testMotion('t_repeat', ['2', 't', 'p'], offsetCursor(pChars[2], 0, -1), pChars[0]); testMotion('F', ['F', 'p'], pChars[0], pChars[1]); testMotion('F_repeat', ['2', 'F', 'p'], pChars[0], pChars[2]); testMotion('T', ['T', 'p'], offsetCursor(pChars[0], 0, 1), pChars[1]); testMotion('T_repeat', ['2', 'T', 'p'], offsetCursor(pChars[0], 0, 1), pChars[2]); testMotion('%_parens', ['%'], parens1.end, parens1.start); testMotion('%_squares', ['%'], squares1.end, squares1.start); testMotion('%_braces', ['%'], curlys1.end, curlys1.start); testMotion('%_seek_outside', ['%'], seekOutside.end, seekOutside.start); testMotion('%_seek_inside', ['%'], seekInside.end, seekInside.start); testVim('%_seek_skip', function(cm, vim, helpers) { cm.setCursor(0,0); helpers.doKeys(['%']); helpers.assertCursorAt(0,9); }, {value:'01234"("()'}); testVim('%_skip_string', function(cm, vim, helpers) { cm.setCursor(0,0); helpers.doKeys(['%']); helpers.assertCursorAt(0,4); cm.setCursor(0,2); helpers.doKeys(['%']); helpers.assertCursorAt(0,0); }, {value:'(")")'}); testVim('%_skip_comment', function(cm, vim, helpers) { cm.setCursor(0,0); helpers.doKeys(['%']); helpers.assertCursorAt(0,6); cm.setCursor(0,3); helpers.doKeys(['%']); helpers.assertCursorAt(0,0); }, {value:'(/*)*/)'}); // Make sure that moving down after going to the end of a line always leaves you // at the end of a line, but preserves the offset in other cases testVim('Changing lines after Eol operation', function(cm, vim, helpers) { cm.setCursor(0,0); helpers.doKeys(['$']); helpers.doKeys(['j']); // After moving to Eol and then down, we should be at Eol of line 2 helpers.assertCursorAt({ line: 1, ch: lines[1].length - 1 }); helpers.doKeys(['j']); // After moving down, we should be at Eol of line 3 helpers.assertCursorAt({ line: 2, ch: lines[2].length - 1 }); helpers.doKeys(['h']); helpers.doKeys(['j']); // After moving back one space and then down, since line 4 is shorter than line 2, we should // be at Eol of line 2 - 1 helpers.assertCursorAt({ line: 3, ch: lines[3].length - 1 }); helpers.doKeys(['j']); helpers.doKeys(['j']); // After moving down again, since line 3 has enough characters, we should be back to the // same place we were at on line 1 helpers.assertCursorAt({ line: 5, ch: lines[2].length - 2 }); }); //making sure gj and gk recover from clipping testVim('gj_gk_clipping', function(cm,vim,helpers){ cm.setCursor(0, 1); helpers.doKeys('g','j','g','j'); helpers.assertCursorAt(2, 1); helpers.doKeys('g','k','g','k'); helpers.assertCursorAt(0, 1); },{value: 'line 1\n\nline 2'}); //testing a mix of j/k and gj/gk testVim('j_k_and_gj_gk', function(cm,vim,helpers){ cm.setSize(120); cm.setCursor(0, 0); //go to the last character on the first line helpers.doKeys('$'); //move up/down on the column within the wrapped line //side-effect: cursor is not locked to eol anymore helpers.doKeys('g','k'); var cur=cm.getCursor(); eq(cur.line,0); is((cur.ch<176),'gk didn\'t move cursor back (1)'); helpers.doKeys('g','j'); helpers.assertCursorAt(0, 176); //should move to character 177 on line 2 (j/k preserve character index within line) helpers.doKeys('j'); //due to different line wrapping, the cursor can be on a different screen-x now //gj and gk preserve screen-x on movement, much like moveV helpers.doKeys('3','g','k'); cur=cm.getCursor(); eq(cur.line,1); is((cur.ch<176),'gk didn\'t move cursor back (2)'); helpers.doKeys('g','j','2','g','j'); //should return to the same character-index helpers.doKeys('k'); helpers.assertCursorAt(0, 176); },{ lineWrapping:true, value: 'This line is intentially long to test movement of gj and gk over wrapped lines. I will start on the end of this line, then make a step up and back to set the origin for j and k.\nThis line is supposed to be even longer than the previous. I will jump here and make another wiggle with gj and gk, before I jump back to the line above. Both wiggles should not change my cursor\'s target character but both j/k and gj/gk change each other\'s reference position.'}); testVim('gj_gk', function(cm, vim, helpers) { if (phantom) return; cm.setSize(120); // Test top of document edge case. cm.setCursor(0, 4); helpers.doKeys('g', 'j'); helpers.doKeys('10', 'g', 'k'); helpers.assertCursorAt(0, 4); // Test moving down preserves column position. helpers.doKeys('g', 'j'); var pos1 = cm.getCursor(); var expectedPos2 = { line: 0, ch: (pos1.ch - 4) * 2 + 4}; helpers.doKeys('g', 'j'); helpers.assertCursorAt(expectedPos2); // Move to the last character cm.setCursor(0, 0); // Move left to reset HSPos helpers.doKeys('h'); // Test bottom of document edge case. helpers.doKeys('100', 'g', 'j'); var endingPos = cm.getCursor(); is(endingPos != 0, 'gj should not be on wrapped line 0'); var topLeftCharCoords = cm.charCoords(makeCursor(0, 0)); var endingCharCoords = cm.charCoords(endingPos); is(topLeftCharCoords.left == endingCharCoords.left, 'gj should end up on column 0'); },{ lineNumbers: false, lineWrapping:true, value: 'Thislineisintentiallylongtotestmovementofgjandgkoverwrappedlines.' }); testVim('}', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('}'); helpers.assertCursorAt(1, 0); cm.setCursor(0, 0); helpers.doKeys('2', '}'); helpers.assertCursorAt(4, 0); cm.setCursor(0, 0); helpers.doKeys('6', '}'); helpers.assertCursorAt(5, 0); }, { value: 'a\n\nb\nc\n\nd' }); testVim('{', function(cm, vim, helpers) { cm.setCursor(5, 0); helpers.doKeys('{'); helpers.assertCursorAt(4, 0); cm.setCursor(5, 0); helpers.doKeys('2', '{'); helpers.assertCursorAt(1, 0); cm.setCursor(5, 0); helpers.doKeys('6', '{'); helpers.assertCursorAt(0, 0); }, { value: 'a\n\nb\nc\n\nd' }); testVim('paragraph_motions', function(cm, vim, helpers) { cm.setCursor(10, 0); helpers.doKeys('{'); helpers.assertCursorAt(4, 0); helpers.doKeys('{'); helpers.assertCursorAt(0, 0); helpers.doKeys('2', '}'); helpers.assertCursorAt(7, 0); helpers.doKeys('2', '}'); helpers.assertCursorAt(16, 0); cm.setCursor(9, 0); helpers.doKeys('}'); helpers.assertCursorAt(14, 0); cm.setCursor(6, 0); helpers.doKeys('}'); helpers.assertCursorAt(7, 0); // ip inside empty space cm.setCursor(10, 0); helpers.doKeys('v', 'i', 'p'); eqPos(Pos(7, 0), cm.getCursor('anchor')); eqPos(Pos(12, 0), cm.getCursor('head')); helpers.doKeys('i', 'p'); eqPos(Pos(7, 0), cm.getCursor('anchor')); eqPos(Pos(13, 1), cm.getCursor('head')); helpers.doKeys('2', 'i', 'p'); eqPos(Pos(7, 0), cm.getCursor('anchor')); eqPos(Pos(16, 1), cm.getCursor('head')); // should switch to visualLine mode cm.setCursor(14, 0); helpers.doKeys('', 'v', 'i', 'p'); helpers.assertCursorAt(14, 0); cm.setCursor(14, 0); helpers.doKeys('', 'V', 'i', 'p'); eqPos(Pos(16, 1), cm.getCursor('head')); // ap inside empty space cm.setCursor(10, 0); helpers.doKeys('', 'v', 'a', 'p'); eqPos(Pos(7, 0), cm.getCursor('anchor')); eqPos(Pos(13, 1), cm.getCursor('head')); helpers.doKeys('a', 'p'); eqPos(Pos(7, 0), cm.getCursor('anchor')); eqPos(Pos(16, 1), cm.getCursor('head')); cm.setCursor(13, 0); helpers.doKeys('v', 'a', 'p'); eqPos(Pos(13, 0), cm.getCursor('anchor')); eqPos(Pos(14, 0), cm.getCursor('head')); cm.setCursor(16, 0); helpers.doKeys('v', 'a', 'p'); eqPos(Pos(14, 0), cm.getCursor('anchor')); eqPos(Pos(16, 1), cm.getCursor('head')); cm.setCursor(0, 0); helpers.doKeys('v', 'a', 'p'); eqPos(Pos(0, 0), cm.getCursor('anchor')); eqPos(Pos(4, 0), cm.getCursor('head')); cm.setCursor(0, 0); helpers.doKeys('d', 'i', 'p'); var register = helpers.getRegisterController().getRegister(); eq('a\na\n', register.toString()); is(register.linewise); helpers.doKeys('3', 'j', 'p'); helpers.doKeys('y', 'i', 'p'); is(register.linewise); eq('b\na\na\nc\n', register.toString()); }, { value: 'a\na\n\n\n\nb\nc\n\n\n\n\n\n\nd\n\ne\nf' }); // Operator tests testVim('dl', function(cm, vim, helpers) { var curStart = makeCursor(0, 0); cm.setCursor(curStart); helpers.doKeys('d', 'l'); eq('word1 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' ', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1 ' }); testVim('dl_eol', function(cm, vim, helpers) { cm.setCursor(0, 6); helpers.doKeys('d', 'l'); eq(' word1', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' ', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 5); }, { value: ' word1 ' }); testVim('dl_repeat', function(cm, vim, helpers) { var curStart = makeCursor(0, 0); cm.setCursor(curStart); helpers.doKeys('2', 'd', 'l'); eq('ord1 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' w', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1 ' }); testVim('dh', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys('d', 'h'); eq(' wrd1 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('o', register.toString()); is(!register.linewise); eqPos(offsetCursor(curStart, 0 , -1), cm.getCursor()); }, { value: ' word1 ' }); testVim('dj', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys('d', 'j'); eq(' word3', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' word1\nword2\n', register.toString()); is(register.linewise); helpers.assertCursorAt(0, 1); }, { value: ' word1\nword2\n word3' }); testVim('dj_end_of_document', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys('d', 'j'); eq(' word1 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 3); }, { value: ' word1 ' }); testVim('dk', function(cm, vim, helpers) { var curStart = makeCursor(1, 3); cm.setCursor(curStart); helpers.doKeys('d', 'k'); eq(' word3', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' word1\nword2\n', register.toString()); is(register.linewise); helpers.assertCursorAt(0, 1); }, { value: ' word1\nword2\n word3' }); testVim('dk_start_of_document', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys('d', 'k'); eq(' word1 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 3); }, { value: ' word1 ' }); testVim('dw_space', function(cm, vim, helpers) { var curStart = makeCursor(0, 0); cm.setCursor(curStart); helpers.doKeys('d', 'w'); eq('word1 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(' ', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1 ' }); testVim('dw_word', function(cm, vim, helpers) { var curStart = makeCursor(0, 1); cm.setCursor(curStart); helpers.doKeys('d', 'w'); eq(' word2', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1 ', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1 word2' }); testVim('dw_unicode_word', function(cm, vim, helpers) { helpers.doKeys('d', 'w'); eq(cm.getValue().length, 10); helpers.doKeys('d', 'w'); eq(cm.getValue().length, 6); helpers.doKeys('d', 'w'); eq(cm.getValue().length, 5); helpers.doKeys('d', 'e'); eq(cm.getValue().length, 2); }, { value: ' \u0562\u0561\u0580\u0587\xbbe\xb5g ' }); testVim('dw_only_word', function(cm, vim, helpers) { // Test that if there is only 1 word left, dw deletes till the end of the // line. cm.setCursor(0, 1); helpers.doKeys('d', 'w'); eq(' ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1 ', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 0); }, { value: ' word1 ' }); testVim('dw_eol', function(cm, vim, helpers) { // Assert that dw does not delete the newline if last word to delete is at end // of line. cm.setCursor(0, 1); helpers.doKeys('d', 'w'); eq(' \nword2', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 0); }, { value: ' word1\nword2' }); testVim('dw_eol_with_multiple_newlines', function(cm, vim, helpers) { // Assert that dw does not delete the newline if last word to delete is at end // of line and it is followed by multiple newlines. cm.setCursor(0, 1); helpers.doKeys('d', 'w'); eq(' \n\nword2', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 0); }, { value: ' word1\n\nword2' }); testVim('dw_empty_line_followed_by_whitespace', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'w'); eq(' \nword', cm.getValue()); }, { value: '\n \nword' }); testVim('dw_empty_line_followed_by_word', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'w'); eq('word', cm.getValue()); }, { value: '\nword' }); testVim('dw_empty_line_followed_by_empty_line', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'w'); eq('\n', cm.getValue()); }, { value: '\n\n' }); testVim('dw_whitespace_followed_by_whitespace', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'w'); eq('\n \n', cm.getValue()); }, { value: ' \n \n' }); testVim('dw_whitespace_followed_by_empty_line', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'w'); eq('\n\n', cm.getValue()); }, { value: ' \n\n' }); testVim('dw_word_whitespace_word', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'w'); eq('\n \nword2', cm.getValue()); }, { value: 'word1\n \nword2'}) testVim('dw_end_of_document', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('d', 'w'); eq('\nab', cm.getValue()); }, { value: '\nabc' }); testVim('dw_repeat', function(cm, vim, helpers) { // Assert that dw does delete newline if it should go to the next line, and // that repeat works properly. cm.setCursor(0, 1); helpers.doKeys('d', '2', 'w'); eq(' ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1\nword2', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 0); }, { value: ' word1\nword2' }); testVim('de_word_start_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'e'); eq('\n\n', cm.getValue()); }, { value: 'word\n\n' }); testVim('de_word_end_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doKeys('d', 'e'); eq('wor', cm.getValue()); }, { value: 'word\n\n\n' }); testVim('de_whitespace_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'e'); eq('', cm.getValue()); }, { value: ' \n\n\n' }); testVim('de_end_of_document', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('d', 'e'); eq('\nab', cm.getValue()); }, { value: '\nabc' }); testVim('db_empty_lines', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('d', 'b'); eq('\n\n', cm.getValue()); }, { value: '\n\n\n' }); testVim('db_word_start_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('d', 'b'); eq('\nword', cm.getValue()); }, { value: '\n\nword' }); testVim('db_word_end_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(2, 3); helpers.doKeys('d', 'b'); eq('\n\nd', cm.getValue()); }, { value: '\n\nword' }); testVim('db_whitespace_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('d', 'b'); eq('', cm.getValue()); }, { value: '\n \n' }); testVim('db_start_of_document', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'b'); eq('abc\n', cm.getValue()); }, { value: 'abc\n' }); testVim('dge_empty_lines', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doKeys('d', 'g', 'e'); // Note: In real VIM the result should be '', but it's not quite consistent, // since 2 newlines are deleted. But in the similar case of word\n\n, only // 1 newline is deleted. We'll diverge from VIM's behavior since it's much // easier this way. eq('\n', cm.getValue()); }, { value: '\n\n' }); testVim('dge_word_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doKeys('d', 'g', 'e'); eq('wor\n', cm.getValue()); }, { value: 'word\n\n'}); testVim('dge_whitespace_and_empty_lines', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('d', 'g', 'e'); eq('', cm.getValue()); }, { value: '\n \n' }); testVim('dge_start_of_document', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('d', 'g', 'e'); eq('bc\n', cm.getValue()); }, { value: 'abc\n' }); testVim('d_inclusive', function(cm, vim, helpers) { // Assert that when inclusive is set, the character the cursor is on gets // deleted too. var curStart = makeCursor(0, 1); cm.setCursor(curStart); helpers.doKeys('d', 'e'); eq(' ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1 ' }); testVim('d_reverse', function(cm, vim, helpers) { // Test that deleting in reverse works. cm.setCursor(1, 0); helpers.doKeys('d', 'b'); eq(' word2 ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1\n', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 1); }, { value: ' word1\nword2 ' }); testVim('dd', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedBuffer = cm.getRange({ line: 0, ch: 0 }, { line: 1, ch: 0 }); var expectedLineCount = cm.lineCount() - 1; helpers.doKeys('d', 'd'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); helpers.assertCursorAt(0, lines[1].textStart); }); testVim('dd_prefix_repeat', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedBuffer = cm.getRange({ line: 0, ch: 0 }, { line: 2, ch: 0 }); var expectedLineCount = cm.lineCount() - 2; helpers.doKeys('2', 'd', 'd'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); helpers.assertCursorAt(0, lines[2].textStart); }); testVim('dd_motion_repeat', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedBuffer = cm.getRange({ line: 0, ch: 0 }, { line: 2, ch: 0 }); var expectedLineCount = cm.lineCount() - 2; helpers.doKeys('d', '2', 'd'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); helpers.assertCursorAt(0, lines[2].textStart); }); testVim('dd_multiply_repeat', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedBuffer = cm.getRange({ line: 0, ch: 0 }, { line: 6, ch: 0 }); var expectedLineCount = cm.lineCount() - 6; helpers.doKeys('2', 'd', '3', 'd'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); helpers.assertCursorAt(0, lines[6].textStart); }); testVim('dd_lastline', function(cm, vim, helpers) { cm.setCursor(cm.lineCount(), 0); var expectedLineCount = cm.lineCount() - 1; helpers.doKeys('d', 'd'); eq(expectedLineCount, cm.lineCount()); helpers.assertCursorAt(cm.lineCount() - 1, 0); }); testVim('dd_only_line', function(cm, vim, helpers) { cm.setCursor(0, 0); var expectedRegister = cm.getValue() + "\n"; helpers.doKeys('d','d'); eq(1, cm.lineCount()); eq('', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq(expectedRegister, register.toString()); }, { value: "thisistheonlyline" }); // Yank commands should behave the exact same as d commands, expect that nothing // gets deleted. testVim('yw_repeat', function(cm, vim, helpers) { // Assert that yw does yank newline if it should go to the next line, and // that repeat works properly. var curStart = makeCursor(0, 1); cm.setCursor(curStart); helpers.doKeys('y', '2', 'w'); eq(' word1\nword2', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1\nword2', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1\nword2' }); testVim('yy_multiply_repeat', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); var expectedBuffer = cm.getRange({ line: 0, ch: 0 }, { line: 6, ch: 0 }); var expectedLineCount = cm.lineCount(); helpers.doKeys('2', 'y', '3', 'y'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); eqPos(curStart, cm.getCursor()); }); // Change commands behave like d commands except that it also enters insert // mode. In addition, when the change is linewise, an additional newline is // inserted so that insert mode starts on that line. testVim('cw', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('c', '2', 'w'); eq(' word3', cm.getValue()); helpers.assertCursorAt(0, 0); }, { value: 'word1 word2 word3'}); testVim('cw_repeat', function(cm, vim, helpers) { // Assert that cw does delete newline if it should go to the next line, and // that repeat works properly. var curStart = makeCursor(0, 1); cm.setCursor(curStart); helpers.doKeys('c', '2', 'w'); eq(' ', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('word1\nword2', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); eq('vim-insert', cm.getOption('keyMap')); }, { value: ' word1\nword2' }); testVim('cc_multiply_repeat', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedBuffer = cm.getRange({ line: 0, ch: 0 }, { line: 6, ch: 0 }); var expectedLineCount = cm.lineCount() - 5; helpers.doKeys('2', 'c', '3', 'c'); eq(expectedLineCount, cm.lineCount()); var register = helpers.getRegisterController().getRegister(); eq(expectedBuffer, register.toString()); is(register.linewise); eq('vim-insert', cm.getOption('keyMap')); }); testVim('ct', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('c', 't', 'w'); eq(' word1 word3', cm.getValue()); helpers.doKeys('', 'c', '|'); eq(' word3', cm.getValue()); helpers.assertCursorAt(0, 0); helpers.doKeys('', '2', 'u', 'w', 'h'); helpers.doKeys('c', '2', 'g', 'e'); eq(' wordword3', cm.getValue()); }, { value: ' word1 word2 word3'}); testVim('cc_should_not_append_to_document', function(cm, vim, helpers) { var expectedLineCount = cm.lineCount(); cm.setCursor(cm.lastLine(), 0); helpers.doKeys('c', 'c'); eq(expectedLineCount, cm.lineCount()); }); function fillArray(val, times) { var arr = []; for (var i = 0; i < times; i++) { arr.push(val); } return arr; } testVim('c_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', '2', 'j', 'l', 'l', 'l', 'c'); var replacement = fillArray('hello', 3); cm.replaceSelections(replacement); eq('1hello\n5hello\nahellofg', cm.getValue()); helpers.doKeys(''); cm.setCursor(2, 3); helpers.doKeys('', '2', 'k', 'h', 'C'); replacement = fillArray('world', 3); cm.replaceSelections(replacement); eq('1hworld\n5hworld\nahworld', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); testVim('c_visual_block_replay', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', '2', 'j', 'l', 'c'); var replacement = fillArray('fo', 3); cm.replaceSelections(replacement); eq('1fo4\n5fo8\nafodefg', cm.getValue()); helpers.doKeys(''); cm.setCursor(0, 0); helpers.doKeys('.'); eq('foo4\nfoo8\nfoodefg', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); testVim('d_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', '2', 'j', 'l', 'l', 'l', 'd'); eq('1\n5\nafg', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); testVim('D_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', '2', 'j', 'l', 'D'); eq('1\n5\na', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); testVim('s_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', '2', 'j', 'l', 'l', 'l', 's'); var replacement = fillArray('hello{', 3); cm.replaceSelections(replacement); eq('1hello{\n5hello{\nahello{fg\n', cm.getValue()); helpers.doKeys(''); cm.setCursor(2, 3); helpers.doKeys('', '1', 'k', 'h', 'S'); replacement = fillArray('world', 1); cm.replaceSelections(replacement); eq('1hello{\n world\n', cm.getValue()); }, {value: '1234\n5678\nabcdefg\n'}); // Swapcase commands edit in place and do not modify registers. testVim('g~w_repeat', function(cm, vim, helpers) { // Assert that dw does delete newline if it should go to the next line, and // that repeat works properly. var curStart = makeCursor(0, 1); cm.setCursor(curStart); helpers.doKeys('g', '~', '2', 'w'); eq(' WORD1\nWORD2', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1\nword2' }); testVim('g~g~', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); var expectedLineCount = cm.lineCount(); var expectedValue = cm.getValue().toUpperCase(); helpers.doKeys('2', 'g', '~', '3', 'g', '~'); eq(expectedValue, cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); }, { value: ' word1\nword2\nword3\nword4\nword5\nword6' }); testVim('gu_and_gU', function(cm, vim, helpers) { var curStart = makeCursor(0, 7); var value = cm.getValue(); cm.setCursor(curStart); helpers.doKeys('2', 'g', 'U', 'w'); eq(cm.getValue(), 'wa wb xX WC wd'); eqPos(curStart, cm.getCursor()); helpers.doKeys('2', 'g', 'u', 'w'); eq(cm.getValue(), value); helpers.doKeys('2', 'g', 'U', 'B'); eq(cm.getValue(), 'wa WB Xx wc wd'); eqPos(makeCursor(0, 3), cm.getCursor()); cm.setCursor(makeCursor(0, 4)); helpers.doKeys('g', 'u', 'i', 'w'); eq(cm.getValue(), 'wa wb Xx wc wd'); eqPos(makeCursor(0, 3), cm.getCursor()); // TODO: support gUgU guu // eqPos(makeCursor(0, 0), cm.getCursor()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); }, { value: 'wa wb xx wc wd' }); testVim('visual_block_~', function(cm, vim, helpers) { cm.setCursor(1, 1); helpers.doKeys('', 'l', 'l', 'j', '~'); helpers.assertCursorAt(1, 1); eq('hello\nwoRLd\naBCDe', cm.getValue()); cm.setCursor(2, 0); helpers.doKeys('v', 'l', 'l', '~'); helpers.assertCursorAt(2, 0); eq('hello\nwoRLd\nAbcDe', cm.getValue()); },{value: 'hello\nwOrld\nabcde' }); testVim('._swapCase_visualBlock', function(cm, vim, helpers) { helpers.doKeys('', 'j', 'j', 'l', '~'); cm.setCursor(0, 3); helpers.doKeys('.'); eq('HelLO\nWorLd\nAbcdE', cm.getValue()); },{value: 'hEllo\nwOrlD\naBcDe' }); testVim('._delete_visualBlock', function(cm, vim, helpers) { helpers.doKeys('', 'j', 'x'); eq('ive\ne\nsome\nsugar', cm.getValue()); helpers.doKeys('.'); eq('ve\n\nsome\nsugar', cm.getValue()); helpers.doKeys('j', 'j', '.'); eq('ve\n\nome\nugar', cm.getValue()); helpers.doKeys('u', '', '.'); eq('ve\n\nme\ngar', cm.getValue()); },{value: 'give\nme\nsome\nsugar' }); testVim('>{motion}', function(cm, vim, helpers) { cm.setCursor(1, 3); var expectedLineCount = cm.lineCount(); var expectedValue = ' word1\n word2\nword3 '; helpers.doKeys('>', 'k'); eq(expectedValue, cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 3); }, { value: ' word1\nword2\nword3 ', indentUnit: 2 }); testVim('>>', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedLineCount = cm.lineCount(); var expectedValue = ' word1\n word2\nword3 '; helpers.doKeys('2', '>', '>'); eq(expectedValue, cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 3); }, { value: ' word1\nword2\nword3 ', indentUnit: 2 }); testVim('<{motion}', function(cm, vim, helpers) { cm.setCursor(1, 3); var expectedLineCount = cm.lineCount(); var expectedValue = ' word1\nword2\nword3 '; helpers.doKeys('<', 'k'); eq(expectedValue, cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 1); }, { value: ' word1\n word2\nword3 ', indentUnit: 2 }); testVim('<<', function(cm, vim, helpers) { cm.setCursor(0, 3); var expectedLineCount = cm.lineCount(); var expectedValue = ' word1\nword2\nword3 '; helpers.doKeys('2', '<', '<'); eq(expectedValue, cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 1); }, { value: ' word1\n word2\nword3 ', indentUnit: 2 }); // Edit tests function testEdit(name, before, pos, edit, after) { return testVim(name, function(cm, vim, helpers) { var ch = before.search(pos) var line = before.substring(0, ch).split('\n').length - 1; if (line) { ch = before.substring(0, ch).split('\n').pop().length; } cm.setCursor(line, ch); helpers.doKeys.apply(this, edit.split('')); eq(after, cm.getValue()); }, {value: before}); } // These Delete tests effectively cover word-wise Change, Visual & Yank. // Tabs are used as differentiated whitespace to catch edge cases. // Normal word: testEdit('diw_mid_spc', 'foo \tbAr\t baz', /A/, 'diw', 'foo \t\t baz'); testEdit('daw_mid_spc', 'foo \tbAr\t baz', /A/, 'daw', 'foo \tbaz'); testEdit('diw_mid_punct', 'foo \tbAr.\t baz', /A/, 'diw', 'foo \t.\t baz'); testEdit('daw_mid_punct', 'foo \tbAr.\t baz', /A/, 'daw', 'foo.\t baz'); testEdit('diw_mid_punct2', 'foo \t,bAr.\t baz', /A/, 'diw', 'foo \t,.\t baz'); testEdit('daw_mid_punct2', 'foo \t,bAr.\t baz', /A/, 'daw', 'foo \t,.\t baz'); testEdit('diw_start_spc', 'bAr \tbaz', /A/, 'diw', ' \tbaz'); testEdit('daw_start_spc', 'bAr \tbaz', /A/, 'daw', 'baz'); testEdit('diw_start_punct', 'bAr. \tbaz', /A/, 'diw', '. \tbaz'); testEdit('daw_start_punct', 'bAr. \tbaz', /A/, 'daw', '. \tbaz'); testEdit('diw_end_spc', 'foo \tbAr', /A/, 'diw', 'foo \t'); testEdit('daw_end_spc', 'foo \tbAr', /A/, 'daw', 'foo'); testEdit('diw_end_punct', 'foo \tbAr.', /A/, 'diw', 'foo \t.'); testEdit('daw_end_punct', 'foo \tbAr.', /A/, 'daw', 'foo.'); // Big word: testEdit('diW_mid_spc', 'foo \tbAr\t baz', /A/, 'diW', 'foo \t\t baz'); testEdit('daW_mid_spc', 'foo \tbAr\t baz', /A/, 'daW', 'foo \tbaz'); testEdit('diW_mid_punct', 'foo \tbAr.\t baz', /A/, 'diW', 'foo \t\t baz'); testEdit('daW_mid_punct', 'foo \tbAr.\t baz', /A/, 'daW', 'foo \tbaz'); testEdit('diW_mid_punct2', 'foo \t,bAr.\t baz', /A/, 'diW', 'foo \t\t baz'); testEdit('daW_mid_punct2', 'foo \t,bAr.\t baz', /A/, 'daW', 'foo \tbaz'); testEdit('diW_start_spc', 'bAr\t baz', /A/, 'diW', '\t baz'); testEdit('daW_start_spc', 'bAr\t baz', /A/, 'daW', 'baz'); testEdit('diW_start_punct', 'bAr.\t baz', /A/, 'diW', '\t baz'); testEdit('daW_start_punct', 'bAr.\t baz', /A/, 'daW', 'baz'); testEdit('diW_end_spc', 'foo \tbAr', /A/, 'diW', 'foo \t'); testEdit('daW_end_spc', 'foo \tbAr', /A/, 'daW', 'foo'); testEdit('diW_end_punct', 'foo \tbAr.', /A/, 'diW', 'foo \t'); testEdit('daW_end_punct', 'foo \tbAr.', /A/, 'daW', 'foo'); // Deleting text objects // Open and close on same line testEdit('di(_open_spc', 'foo (bAr) baz', /\(/, 'di(', 'foo () baz'); testEdit('di)_open_spc', 'foo (bAr) baz', /\(/, 'di)', 'foo () baz'); testEdit('dib_open_spc', 'foo (bAr) baz', /\(/, 'dib', 'foo () baz'); testEdit('da(_open_spc', 'foo (bAr) baz', /\(/, 'da(', 'foo baz'); testEdit('da)_open_spc', 'foo (bAr) baz', /\(/, 'da)', 'foo baz'); testEdit('di(_middle_spc', 'foo (bAr) baz', /A/, 'di(', 'foo () baz'); testEdit('di)_middle_spc', 'foo (bAr) baz', /A/, 'di)', 'foo () baz'); testEdit('da(_middle_spc', 'foo (bAr) baz', /A/, 'da(', 'foo baz'); testEdit('da)_middle_spc', 'foo (bAr) baz', /A/, 'da)', 'foo baz'); testEdit('di(_close_spc', 'foo (bAr) baz', /\)/, 'di(', 'foo () baz'); testEdit('di)_close_spc', 'foo (bAr) baz', /\)/, 'di)', 'foo () baz'); testEdit('da(_close_spc', 'foo (bAr) baz', /\)/, 'da(', 'foo baz'); testEdit('da)_close_spc', 'foo (bAr) baz', /\)/, 'da)', 'foo baz'); // delete around and inner b. testEdit('dab_on_(_should_delete_around_()block', 'o( in(abc) )', /\(a/, 'dab', 'o( in )'); // delete around and inner B. testEdit('daB_on_{_should_delete_around_{}block', 'o{ in{abc} }', /{a/, 'daB', 'o{ in }'); testEdit('diB_on_{_should_delete_inner_{}block', 'o{ in{abc} }', /{a/, 'diB', 'o{ in{} }'); testEdit('da{_on_{_should_delete_inner_block', 'o{ in{abc} }', /{a/, 'da{', 'o{ in }'); testEdit('di[_on_(_should_not_delete', 'foo (bAr) baz', /\(/, 'di[', 'foo (bAr) baz'); testEdit('di[_on_)_should_not_delete', 'foo (bAr) baz', /\)/, 'di[', 'foo (bAr) baz'); testEdit('da[_on_(_should_not_delete', 'foo (bAr) baz', /\(/, 'da[', 'foo (bAr) baz'); testEdit('da[_on_)_should_not_delete', 'foo (bAr) baz', /\)/, 'da[', 'foo (bAr) baz'); testMotion('di(_outside_should_stay', ['d', 'i', '('], { line: 0, ch: 0}, { line: 0, ch: 0}); // Open and close on different lines, equally indented testEdit('di{_middle_spc', 'a{\n\tbar\n}b', /r/, 'di{', 'a{}b'); testEdit('di}_middle_spc', 'a{\n\tbar\n}b', /r/, 'di}', 'a{}b'); testEdit('da{_middle_spc', 'a{\n\tbar\n}b', /r/, 'da{', 'ab'); testEdit('da}_middle_spc', 'a{\n\tbar\n}b', /r/, 'da}', 'ab'); testEdit('daB_middle_spc', 'a{\n\tbar\n}b', /r/, 'daB', 'ab'); // open and close on diff lines, open indented less than close testEdit('di{_middle_spc', 'a{\n\tbar\n\t}b', /r/, 'di{', 'a{}b'); testEdit('di}_middle_spc', 'a{\n\tbar\n\t}b', /r/, 'di}', 'a{}b'); testEdit('da{_middle_spc', 'a{\n\tbar\n\t}b', /r/, 'da{', 'ab'); testEdit('da}_middle_spc', 'a{\n\tbar\n\t}b', /r/, 'da}', 'ab'); // open and close on diff lines, open indented more than close testEdit('di[_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'di[', 'a\t[]b'); testEdit('di]_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'di]', 'a\t[]b'); testEdit('da[_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'da[', 'a\tb'); testEdit('da]_middle_spc', 'a\t[\n\tbar\n]b', /r/, 'da]', 'a\tb'); function testSelection(name, before, pos, keys, sel) { return testVim(name, function(cm, vim, helpers) { var ch = before.search(pos) var line = before.substring(0, ch).split('\n').length - 1; if (line) { ch = before.substring(0, ch).split('\n').pop().length; } cm.setCursor(line, ch); helpers.doKeys.apply(this, keys.split('')); eq(sel, cm.getSelection()); }, {value: before}); } testSelection('viw_middle_spc', 'foo \tbAr\t baz', /A/, 'viw', 'bAr'); testSelection('vaw_middle_spc', 'foo \tbAr\t baz', /A/, 'vaw', 'bAr\t '); testSelection('viw_middle_punct', 'foo \tbAr,\t baz', /A/, 'viw', 'bAr'); testSelection('vaW_middle_punct', 'foo \tbAr,\t baz', /A/, 'vaW', 'bAr,\t '); testSelection('viw_start_spc', 'foo \tbAr\t baz', /b/, 'viw', 'bAr'); testSelection('viw_end_spc', 'foo \tbAr\t baz', /r/, 'viw', 'bAr'); testSelection('viw_eol', 'foo \tbAr', /r/, 'viw', 'bAr'); testSelection('vi{_middle_spc', 'a{\n\tbar\n\t}b', /r/, 'vi{', '\n\tbar\n\t'); testSelection('va{_middle_spc', 'a{\n\tbar\n\t}b', /r/, 'va{', '{\n\tbar\n\t}'); testVim('mouse_select', function(cm, vim, helpers) { cm.setSelection(Pos(0, 2), Pos(0, 4), {origin: '*mouse'}); is(cm.state.vim.visualMode); is(!cm.state.vim.visualLine); is(!cm.state.vim.visualBlock); helpers.doKeys(''); is(!cm.somethingSelected()); helpers.doKeys('g', 'v'); eq('cd', cm.getSelection()); }, {value: 'abcdef'}); // Operator-motion tests testVim('D', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doKeys('D'); eq(' wo\nword2\n word3', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('rd1', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 2); }, { value: ' word1\nword2\n word3' }); testVim('C', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys('C'); eq(' wo\nword2\n word3', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('rd1', register.toString()); is(!register.linewise); eqPos(curStart, cm.getCursor()); eq('vim-insert', cm.getOption('keyMap')); }, { value: ' word1\nword2\n word3' }); testVim('Y', function(cm, vim, helpers) { var curStart = makeCursor(0, 3); cm.setCursor(curStart); helpers.doKeys('Y'); eq(' word1\nword2\n word3', cm.getValue()); var register = helpers.getRegisterController().getRegister(); eq('rd1', register.toString()); is(!register.linewise); helpers.assertCursorAt(0, 3); }, { value: ' word1\nword2\n word3' }); testVim('~', function(cm, vim, helpers) { helpers.doKeys('3', '~'); eq('ABCdefg', cm.getValue()); helpers.assertCursorAt(0, 3); }, { value: 'abcdefg' }); // Action tests testVim('ctrl-a', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys(''); eq('-9', cm.getValue()); helpers.assertCursorAt(0, 1); helpers.doKeys('2',''); eq('-7', cm.getValue()); }, {value: '-10'}); testVim('ctrl-x', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys(''); eq('-1', cm.getValue()); helpers.assertCursorAt(0, 1); helpers.doKeys('2',''); eq('-3', cm.getValue()); }, {value: '0'}); testVim('/ search forward', function(cm, vim, helpers) { forEach(['', ''], function(key) { cm.setCursor(0, 0); helpers.doKeys(key); helpers.assertCursorAt(0, 5); helpers.doKeys('l'); helpers.doKeys(key); helpers.assertCursorAt(0, 10); cm.setCursor(0, 11); helpers.doKeys(key); helpers.assertCursorAt(0, 11); }); }, {value: '__jmp1 jmp2 jmp'}); testVim('a', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('a'); helpers.assertCursorAt(0, 2); eq('vim-insert', cm.getOption('keyMap')); }); testVim('a_eol', function(cm, vim, helpers) { cm.setCursor(0, lines[0].length - 1); helpers.doKeys('a'); helpers.assertCursorAt(0, lines[0].length); eq('vim-insert', cm.getOption('keyMap')); }); testVim('A_endOfSelectedArea', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('v', 'j', 'l'); helpers.doKeys('A'); helpers.assertCursorAt(1, 2); eq('vim-insert', cm.getOption('keyMap')); }, {value: 'foo\nbar'}); testVim('i', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('i'); helpers.assertCursorAt(0, 1); eq('vim-insert', cm.getOption('keyMap')); }); testVim('i_repeat', function(cm, vim, helpers) { helpers.doKeys('3', 'i'); cm.replaceRange('test', cm.getCursor()); helpers.doKeys(''); eq('testtesttest', cm.getValue()); helpers.assertCursorAt(0, 11); }, { value: '' }); testVim('i_repeat_delete', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('2', 'i'); cm.replaceRange('z', cm.getCursor()); helpers.doInsertModeKeys('Backspace', 'Backspace'); helpers.doKeys(''); eq('abe', cm.getValue()); helpers.assertCursorAt(0, 1); }, { value: 'abcde' }); testVim('A', function(cm, vim, helpers) { helpers.doKeys('A'); helpers.assertCursorAt(0, lines[0].length); eq('vim-insert', cm.getOption('keyMap')); }); testVim('A_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', '2', 'j', 'l', 'l', 'A'); var replacement = new Array(cm.listSelections().length+1).join('hello ').split(' '); replacement.pop(); cm.replaceSelections(replacement); eq('testhello\nmehello\npleahellose', cm.getValue()); helpers.doKeys(''); cm.setCursor(0, 0); helpers.doKeys('.'); // TODO this doesn't work yet // eq('teshellothello\nme hello hello\nplehelloahellose', cm.getValue()); }, {value: 'test\nme\nplease'}); testVim('I', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('I'); helpers.assertCursorAt(0, lines[0].textStart); eq('vim-insert', cm.getOption('keyMap')); }); testVim('I_repeat', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('3', 'I'); cm.replaceRange('test', cm.getCursor()); helpers.doKeys(''); eq('testtesttestblah', cm.getValue()); helpers.assertCursorAt(0, 11); }, { value: 'blah' }); testVim('I_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', '2', 'j', 'l', 'l', 'I'); var replacement = new Array(cm.listSelections().length+1).join('hello ').split(' '); replacement.pop(); cm.replaceSelections(replacement); eq('hellotest\nhellome\nhelloplease', cm.getValue()); }, {value: 'test\nme\nplease'}); testVim('o', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('o'); eq('word1\n\nword2', cm.getValue()); helpers.assertCursorAt(1, 0); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'word1\nword2' }); testVim('o_repeat', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('3', 'o'); cm.replaceRange('test', cm.getCursor()); helpers.doKeys(''); eq('\ntest\ntest\ntest', cm.getValue()); helpers.assertCursorAt(3, 3); }, { value: '' }); testVim('O', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('O'); eq('\nword1\nword2', cm.getValue()); helpers.assertCursorAt(0, 0); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'word1\nword2' }); testVim('J', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('J'); var expectedValue = 'word1 word2\nword3\n word4'; eq(expectedValue, cm.getValue()); helpers.assertCursorAt(0, expectedValue.indexOf('word2') - 1); }, { value: 'word1 \n word2\nword3\n word4' }); testVim('J_repeat', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('3', 'J'); var expectedValue = 'word1 word2 word3\n word4'; eq(expectedValue, cm.getValue()); helpers.assertCursorAt(0, expectedValue.indexOf('word3') - 1); }, { value: 'word1 \n word2\nword3\n word4' }); testVim('p', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().pushText('"', 'yank', 'abc\ndef', false); helpers.doKeys('p'); eq('__abc\ndef_', cm.getValue()); helpers.assertCursorAt(1, 2); }, { value: '___' }); testVim('p_register', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().getRegister('a').setText('abc\ndef', false); helpers.doKeys('"', 'a', 'p'); eq('__abc\ndef_', cm.getValue()); helpers.assertCursorAt(1, 2); }, { value: '___' }); testVim('p_wrong_register', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().getRegister('a').setText('abc\ndef', false); helpers.doKeys('p'); eq('___', cm.getValue()); helpers.assertCursorAt(0, 1); }, { value: '___' }); testVim('p_line', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().pushText('"', 'yank', ' a\nd\n', true); helpers.doKeys('2', 'p'); eq('___\n a\nd\n a\nd', cm.getValue()); helpers.assertCursorAt(1, 2); }, { value: '___' }); testVim('p_lastline', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().pushText('"', 'yank', ' a\nd', true); helpers.doKeys('2', 'p'); eq('___\n a\nd\n a\nd', cm.getValue()); helpers.assertCursorAt(1, 2); }, { value: '___' }); testVim(']p_first_indent_is_smaller', function(cm, vim, helpers) { helpers.getRegisterController().pushText('"', 'yank', ' abc\n def\n', true); helpers.doKeys(']', 'p'); eq(' ___\n abc\n def', cm.getValue()); }, { value: ' ___' }); testVim(']p_first_indent_is_larger', function(cm, vim, helpers) { helpers.getRegisterController().pushText('"', 'yank', ' abc\n def\n', true); helpers.doKeys(']', 'p'); eq(' ___\n abc\ndef', cm.getValue()); }, { value: ' ___' }); testVim(']p_with_tab_indents', function(cm, vim, helpers) { helpers.getRegisterController().pushText('"', 'yank', '\t\tabc\n\t\t\tdef\n', true); helpers.doKeys(']', 'p'); eq('\t___\n\tabc\n\t\tdef', cm.getValue()); }, { value: '\t___', indentWithTabs: true}); testVim(']p_with_spaces_translated_to_tabs', function(cm, vim, helpers) { helpers.getRegisterController().pushText('"', 'yank', ' abc\n def\n', true); helpers.doKeys(']', 'p'); eq('\t___\n\tabc\n\t\tdef', cm.getValue()); }, { value: '\t___', indentWithTabs: true, tabSize: 2 }); testVim('[p', function(cm, vim, helpers) { helpers.getRegisterController().pushText('"', 'yank', ' abc\n def\n', true); helpers.doKeys('[', 'p'); eq(' abc\n def\n ___', cm.getValue()); }, { value: ' ___' }); testVim('P', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().pushText('"', 'yank', 'abc\ndef', false); helpers.doKeys('P'); eq('_abc\ndef__', cm.getValue()); helpers.assertCursorAt(1, 3); }, { value: '___' }); testVim('P_line', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.getRegisterController().pushText('"', 'yank', ' a\nd\n', true); helpers.doKeys('2', 'P'); eq(' a\nd\n a\nd\n___', cm.getValue()); helpers.assertCursorAt(0, 2); }, { value: '___' }); testVim('r', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('3', 'r', 'u'); eq('wuuuet\nanother', cm.getValue(),'3r failed'); helpers.assertCursorAt(0, 3); cm.setCursor(0, 4); helpers.doKeys('v', 'j', 'h', 'r', ''); eq('wuuu \n her', cm.getValue(),'Replacing selection by space-characters failed'); }, { value: 'wordet\nanother' }); testVim('r_visual_block', function(cm, vim, helpers) { cm.setCursor(2, 3); helpers.doKeys('', 'k', 'k', 'h', 'h', 'r', 'l'); eq('1lll\n5lll\nalllefg', cm.getValue()); helpers.doKeys('', 'l', 'j', 'r', ''); eq('1 l\n5 l\nalllefg', cm.getValue()); cm.setCursor(2, 0); helpers.doKeys('o'); helpers.doKeys(''); cm.replaceRange('\t\t', cm.getCursor()); helpers.doKeys('', 'h', 'h', 'r', 'r'); eq('1 l\n5 l\nalllefg\nrrrrrrrr', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); testVim('R', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('R'); helpers.assertCursorAt(0, 1); eq('vim-replace', cm.getOption('keyMap')); is(cm.state.overwrite, 'Setting overwrite state failed'); }); testVim('mark', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 't'); cm.setCursor(0, 0); helpers.doKeys('`', 't'); helpers.assertCursorAt(2, 2); cm.setCursor(2, 0); cm.replaceRange(' h', cm.getCursor()); cm.setCursor(0, 0); helpers.doKeys('\'', 't'); helpers.assertCursorAt(2, 3); }); testVim('jumpToMark_next', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 't'); cm.setCursor(0, 0); helpers.doKeys(']', '`'); helpers.assertCursorAt(2, 2); cm.setCursor(0, 0); helpers.doKeys(']', '\''); helpers.assertCursorAt(2, 0); }); testVim('jumpToMark_next_repeat', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 'a'); cm.setCursor(3, 2); helpers.doKeys('m', 'b'); cm.setCursor(4, 2); helpers.doKeys('m', 'c'); cm.setCursor(0, 0); helpers.doKeys('2', ']', '`'); helpers.assertCursorAt(3, 2); cm.setCursor(0, 0); helpers.doKeys('2', ']', '\''); helpers.assertCursorAt(3, 1); }); testVim('jumpToMark_next_sameline', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('m', 'a'); cm.setCursor(2, 4); helpers.doKeys('m', 'b'); cm.setCursor(2, 2); helpers.doKeys(']', '`'); helpers.assertCursorAt(2, 4); }); testVim('jumpToMark_next_onlyprev', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('m', 'a'); cm.setCursor(4, 0); helpers.doKeys(']', '`'); helpers.assertCursorAt(4, 0); }); testVim('jumpToMark_next_nomark', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys(']', '`'); helpers.assertCursorAt(2, 2); helpers.doKeys(']', '\''); helpers.assertCursorAt(2, 0); }); testVim('jumpToMark_next_linewise_over', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 'a'); cm.setCursor(3, 4); helpers.doKeys('m', 'b'); cm.setCursor(2, 1); helpers.doKeys(']', '\''); helpers.assertCursorAt(3, 1); }); testVim('jumpToMark_next_action', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 't'); cm.setCursor(0, 0); helpers.doKeys('d', ']', '`'); helpers.assertCursorAt(0, 0); var actual = cm.getLine(0); var expected = 'pop pop 0 1 2 3 4'; eq(actual, expected, "Deleting while jumping to the next mark failed."); }); testVim('jumpToMark_next_line_action', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 't'); cm.setCursor(0, 0); helpers.doKeys('d', ']', '\''); helpers.assertCursorAt(0, 1); var actual = cm.getLine(0); var expected = ' (a) [b] {c} ' eq(actual, expected, "Deleting while jumping to the next mark line failed."); }); testVim('jumpToMark_prev', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 't'); cm.setCursor(4, 0); helpers.doKeys('[', '`'); helpers.assertCursorAt(2, 2); cm.setCursor(4, 0); helpers.doKeys('[', '\''); helpers.assertCursorAt(2, 0); }); testVim('jumpToMark_prev_repeat', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 'a'); cm.setCursor(3, 2); helpers.doKeys('m', 'b'); cm.setCursor(4, 2); helpers.doKeys('m', 'c'); cm.setCursor(5, 0); helpers.doKeys('2', '[', '`'); helpers.assertCursorAt(3, 2); cm.setCursor(5, 0); helpers.doKeys('2', '[', '\''); helpers.assertCursorAt(3, 1); }); testVim('jumpToMark_prev_sameline', function(cm, vim, helpers) { cm.setCursor(2, 0); helpers.doKeys('m', 'a'); cm.setCursor(2, 4); helpers.doKeys('m', 'b'); cm.setCursor(2, 2); helpers.doKeys('[', '`'); helpers.assertCursorAt(2, 0); }); testVim('jumpToMark_prev_onlynext', function(cm, vim, helpers) { cm.setCursor(4, 4); helpers.doKeys('m', 'a'); cm.setCursor(2, 0); helpers.doKeys('[', '`'); helpers.assertCursorAt(2, 0); }); testVim('jumpToMark_prev_nomark', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('[', '`'); helpers.assertCursorAt(2, 2); helpers.doKeys('[', '\''); helpers.assertCursorAt(2, 0); }); testVim('jumpToMark_prev_linewise_over', function(cm, vim, helpers) { cm.setCursor(2, 2); helpers.doKeys('m', 'a'); cm.setCursor(3, 4); helpers.doKeys('m', 'b'); cm.setCursor(3, 6); helpers.doKeys('[', '\''); helpers.assertCursorAt(2, 0); }); testVim('delmark_single', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('m', 't'); helpers.doEx('delmarks t'); cm.setCursor(0, 0); helpers.doKeys('`', 't'); helpers.assertCursorAt(0, 0); }); testVim('delmark_range', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('m', 'a'); cm.setCursor(2, 2); helpers.doKeys('m', 'b'); cm.setCursor(3, 2); helpers.doKeys('m', 'c'); cm.setCursor(4, 2); helpers.doKeys('m', 'd'); cm.setCursor(5, 2); helpers.doKeys('m', 'e'); helpers.doEx('delmarks b-d'); cm.setCursor(0, 0); helpers.doKeys('`', 'a'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'b'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'c'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'd'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'e'); helpers.assertCursorAt(5, 2); }); testVim('delmark_multi', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('m', 'a'); cm.setCursor(2, 2); helpers.doKeys('m', 'b'); cm.setCursor(3, 2); helpers.doKeys('m', 'c'); cm.setCursor(4, 2); helpers.doKeys('m', 'd'); cm.setCursor(5, 2); helpers.doKeys('m', 'e'); helpers.doEx('delmarks bcd'); cm.setCursor(0, 0); helpers.doKeys('`', 'a'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'b'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'c'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'd'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'e'); helpers.assertCursorAt(5, 2); }); testVim('delmark_multi_space', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('m', 'a'); cm.setCursor(2, 2); helpers.doKeys('m', 'b'); cm.setCursor(3, 2); helpers.doKeys('m', 'c'); cm.setCursor(4, 2); helpers.doKeys('m', 'd'); cm.setCursor(5, 2); helpers.doKeys('m', 'e'); helpers.doEx('delmarks b c d'); cm.setCursor(0, 0); helpers.doKeys('`', 'a'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'b'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'c'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'd'); helpers.assertCursorAt(1, 2); helpers.doKeys('`', 'e'); helpers.assertCursorAt(5, 2); }); testVim('delmark_all', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('m', 'a'); cm.setCursor(2, 2); helpers.doKeys('m', 'b'); cm.setCursor(3, 2); helpers.doKeys('m', 'c'); cm.setCursor(4, 2); helpers.doKeys('m', 'd'); cm.setCursor(5, 2); helpers.doKeys('m', 'e'); helpers.doEx('delmarks a b-de'); cm.setCursor(0, 0); helpers.doKeys('`', 'a'); helpers.assertCursorAt(0, 0); helpers.doKeys('`', 'b'); helpers.assertCursorAt(0, 0); helpers.doKeys('`', 'c'); helpers.assertCursorAt(0, 0); helpers.doKeys('`', 'd'); helpers.assertCursorAt(0, 0); helpers.doKeys('`', 'e'); helpers.assertCursorAt(0, 0); }); testVim('visual', function(cm, vim, helpers) { helpers.doKeys('l', 'v', 'l', 'l'); helpers.assertCursorAt(0, 4); eqPos(makeCursor(0, 1), cm.getCursor('anchor')); helpers.doKeys('d'); eq('15', cm.getValue()); }, { value: '12345' }); testVim('visual_yank', function(cm, vim, helpers) { helpers.doKeys('v', '3', 'l', 'y'); helpers.assertCursorAt(0, 0); helpers.doKeys('p'); eq('aa te test for yank', cm.getValue()); }, { value: 'a test for yank' }) testVim('visual_w', function(cm, vim, helpers) { helpers.doKeys('v', 'w'); eq(cm.getSelection(), 'motion t'); }, { value: 'motion test'}); testVim('visual_initial_selection', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('v'); cm.getSelection('n'); }, { value: 'init'}); testVim('visual_crossover_left', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys('v', 'l', 'h', 'h'); cm.getSelection('ro'); }, { value: 'cross'}); testVim('visual_crossover_left', function(cm, vim, helpers) { cm.setCursor(0, 2); helpers.doKeys('v', 'h', 'l', 'l'); cm.getSelection('os'); }, { value: 'cross'}); testVim('visual_crossover_up', function(cm, vim, helpers) { cm.setCursor(3, 2); helpers.doKeys('v', 'j', 'k', 'k'); eqPos(Pos(2, 2), cm.getCursor('head')); eqPos(Pos(3, 3), cm.getCursor('anchor')); helpers.doKeys('k'); eqPos(Pos(1, 2), cm.getCursor('head')); eqPos(Pos(3, 3), cm.getCursor('anchor')); }, { value: 'cross\ncross\ncross\ncross\ncross\n'}); testVim('visual_crossover_down', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('v', 'k', 'j', 'j'); eqPos(Pos(2, 3), cm.getCursor('head')); eqPos(Pos(1, 2), cm.getCursor('anchor')); helpers.doKeys('j'); eqPos(Pos(3, 3), cm.getCursor('head')); eqPos(Pos(1, 2), cm.getCursor('anchor')); }, { value: 'cross\ncross\ncross\ncross\ncross\n'}); testVim('visual_exit', function(cm, vim, helpers) { helpers.doKeys('', 'l', 'j', 'j', ''); eqPos(cm.getCursor('anchor'), cm.getCursor('head')); eq(vim.visualMode, false); }, { value: 'hello\nworld\nfoo' }); testVim('visual_line', function(cm, vim, helpers) { helpers.doKeys('l', 'V', 'l', 'j', 'j', 'd'); eq(' 4\n 5', cm.getValue()); }, { value: ' 1\n 2\n 3\n 4\n 5' }); testVim('visual_block_move_to_eol', function(cm, vim, helpers) { // moveToEol should move all block cursors to end of line cm.setCursor(0, 0); helpers.doKeys('', 'G', '$'); var selections = cm.getSelections().join(); eq('123,45,6', selections); // Checks that with cursor at Infinity, finding words backwards still works. helpers.doKeys('2', 'k', 'b'); selections = cm.getSelections().join(); eq('1', selections); }, {value: '123\n45\n6'}); testVim('visual_block_different_line_lengths', function(cm, vim, helpers) { // test the block selection with lines of different length // i.e. extending the selection // till the end of the longest line. helpers.doKeys('', 'l', 'j', 'j', '6', 'l', 'd'); helpers.doKeys('d', 'd', 'd', 'd'); eq('', cm.getValue()); }, {value: '1234\n5678\nabcdefg'}); testVim('visual_block_truncate_on_short_line', function(cm, vim, helpers) { // check for left side selection in case // of moving up to a shorter line. cm.replaceRange('', cm.getCursor()); cm.setCursor(3, 4); helpers.doKeys('', 'l', 'k', 'k', 'd'); eq('hello world\n{\ntis\nsa!', cm.getValue()); }, {value: 'hello world\n{\nthis is\nsparta!'}); testVim('visual_block_corners', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('', '2', 'l', 'k'); // circle around the anchor // and check the selections var selections = cm.getSelections(); eq('345891', selections.join('')); helpers.doKeys('4', 'h'); selections = cm.getSelections(); eq('123678', selections.join('')); helpers.doKeys('j', 'j'); selections = cm.getSelections(); eq('678abc', selections.join('')); helpers.doKeys('4', 'l'); selections = cm.getSelections(); eq('891cde', selections.join('')); }, {value: '12345\n67891\nabcde'}); testVim('visual_block_mode_switch', function(cm, vim, helpers) { // switch between visual modes cm.setCursor(1, 1); // blockwise to characterwise visual helpers.doKeys('', 'j', 'l', 'v'); var selections = cm.getSelections(); eq('7891\nabc', selections.join('')); // characterwise to blockwise helpers.doKeys(''); selections = cm.getSelections(); eq('78bc', selections.join('')); // blockwise to linewise visual helpers.doKeys('V'); selections = cm.getSelections(); eq('67891\nabcde', selections.join('')); }, {value: '12345\n67891\nabcde'}); testVim('visual_block_crossing_short_line', function(cm, vim, helpers) { // visual block with long and short lines cm.setCursor(0, 3); helpers.doKeys('', 'j', 'j', 'j'); var selections = cm.getSelections().join(); eq('4,,d,b', selections); helpers.doKeys('3', 'k'); selections = cm.getSelections().join(); eq('4', selections); helpers.doKeys('5', 'j', 'k'); selections = cm.getSelections().join(""); eq(10, selections.length); }, {value: '123456\n78\nabcdefg\nfoobar\n}\n'}); testVim('visual_block_curPos_on_exit', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', '3' , 'l', ''); eqPos(makeCursor(0, 3), cm.getCursor()); helpers.doKeys('h', '', '2' , 'j' ,'3' , 'l'); eq(cm.getSelections().join(), "3456,,cdef"); helpers.doKeys('4' , 'h'); eq(cm.getSelections().join(), "23,8,bc"); helpers.doKeys('2' , 'l'); eq(cm.getSelections().join(), "34,,cd"); }, {value: '123456\n78\nabcdefg\nfoobar'}); testVim('visual_marks', function(cm, vim, helpers) { helpers.doKeys('l', 'v', 'l', 'l', 'j', 'j', 'v'); // Test visual mode marks cm.setCursor(2, 1); helpers.doKeys('\'', '<'); helpers.assertCursorAt(0, 1); helpers.doKeys('\'', '>'); helpers.assertCursorAt(2, 0); }); testVim('visual_join', function(cm, vim, helpers) { helpers.doKeys('l', 'V', 'l', 'j', 'j', 'J'); eq(' 1 2 3\n 4\n 5', cm.getValue()); is(!vim.visualMode); }, { value: ' 1\n 2\n 3\n 4\n 5' }); testVim('visual_join_2', function(cm, vim, helpers) { helpers.doKeys('G', 'V', 'g', 'g', 'J'); eq('1 2 3 4 5 6 ', cm.getValue()); is(!vim.visualMode); }, { value: '1\n2\n3\n4\n5\n6\n'}); testVim('visual_blank', function(cm, vim, helpers) { helpers.doKeys('v', 'k'); eq(vim.visualMode, true); }, { value: '\n' }); testVim('reselect_visual', function(cm, vim, helpers) { helpers.doKeys('l', 'v', 'l', 'l', 'l', 'y', 'g', 'v'); helpers.assertCursorAt(0, 5); eqPos(makeCursor(0, 1), cm.getCursor('anchor')); helpers.doKeys('v'); cm.setCursor(1, 0); helpers.doKeys('v', 'l', 'l', 'p'); eq('123456\n2345\nbar', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys('g', 'v'); // here the fake cursor is at (1, 3) helpers.assertCursorAt(1, 4); eqPos(makeCursor(1, 0), cm.getCursor('anchor')); helpers.doKeys('v'); cm.setCursor(2, 0); helpers.doKeys('v', 'l', 'l', 'g', 'v'); helpers.assertCursorAt(1, 4); eqPos(makeCursor(1, 0), cm.getCursor('anchor')); helpers.doKeys('g', 'v'); helpers.assertCursorAt(2, 3); eqPos(makeCursor(2, 0), cm.getCursor('anchor')); eq('123456\n2345\nbar', cm.getValue()); }, { value: '123456\nfoo\nbar' }); testVim('reselect_visual_line', function(cm, vim, helpers) { helpers.doKeys('l', 'V', 'j', 'j', 'V', 'g', 'v', 'd'); eq('foo\nand\nbar', cm.getValue()); cm.setCursor(1, 0); helpers.doKeys('V', 'y', 'j'); helpers.doKeys('V', 'p' , 'g', 'v', 'd'); eq('foo\nand', cm.getValue()); }, { value: 'hello\nthis\nis\nfoo\nand\nbar' }); testVim('reselect_visual_block', function(cm, vim, helpers) { cm.setCursor(1, 2); helpers.doKeys('', 'k', 'h', ''); cm.setCursor(2, 1); helpers.doKeys('v', 'l', 'g', 'v'); eqPos(Pos(1, 2), vim.sel.anchor); eqPos(Pos(0, 1), vim.sel.head); // Ensure selection is done with visual block mode rather than one // continuous range. eq(cm.getSelections().join(''), '23oo') helpers.doKeys('g', 'v'); eqPos(Pos(2, 1), vim.sel.anchor); eqPos(Pos(2, 2), vim.sel.head); helpers.doKeys(''); // Ensure selection of deleted range cm.setCursor(1, 1); helpers.doKeys('v', '', 'j', 'd', 'g', 'v'); eq(cm.getSelections().join(''), 'or'); }, { value: '123456\nfoo\nbar' }); testVim('s_normal', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('s'); helpers.doKeys(''); eq('ac', cm.getValue()); }, { value: 'abc'}); testVim('s_visual', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('v', 's'); helpers.doKeys(''); helpers.assertCursorAt(0, 0); eq('ac', cm.getValue()); }, { value: 'abc'}); testVim('o_visual', function(cm, vim, helpers) { cm.setCursor(0,0); helpers.doKeys('v','l','l','l','o'); helpers.assertCursorAt(0,0); helpers.doKeys('v','v','j','j','j','o'); helpers.assertCursorAt(0,0); helpers.doKeys('O'); helpers.doKeys('l','l') helpers.assertCursorAt(3, 3); helpers.doKeys('d'); eq('p',cm.getValue()); }, { value: 'abcd\nefgh\nijkl\nmnop'}); testVim('o_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('','3','j','l','l', 'o'); eqPos(Pos(3, 3), vim.sel.anchor); eqPos(Pos(0, 1), vim.sel.head); helpers.doKeys('O'); eqPos(Pos(3, 1), vim.sel.anchor); eqPos(Pos(0, 3), vim.sel.head); helpers.doKeys('o'); eqPos(Pos(0, 3), vim.sel.anchor); eqPos(Pos(3, 1), vim.sel.head); }, { value: 'abcd\nefgh\nijkl\nmnop'}); testVim('changeCase_visual', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('v', 'l', 'l'); helpers.doKeys('U'); helpers.assertCursorAt(0, 0); helpers.doKeys('v', 'l', 'l'); helpers.doKeys('u'); helpers.assertCursorAt(0, 0); helpers.doKeys('l', 'l', 'l', '.'); helpers.assertCursorAt(0, 3); cm.setCursor(0, 0); helpers.doKeys('q', 'a', 'v', 'j', 'U', 'q'); helpers.assertCursorAt(0, 0); helpers.doKeys('j', '@', 'a'); helpers.assertCursorAt(1, 0); cm.setCursor(3, 0); helpers.doKeys('V', 'U', 'j', '.'); eq('ABCDEF\nGHIJKL\nMnopq\nSHORT LINE\nLONG LINE OF TEXT', cm.getValue()); }, { value: 'abcdef\nghijkl\nmnopq\nshort line\nlong line of text'}); testVim('changeCase_visual_block', function(cm, vim, helpers) { cm.setCursor(2, 1); helpers.doKeys('', 'k', 'k', 'h', 'U'); eq('ABcdef\nGHijkl\nMNopq\nfoo', cm.getValue()); cm.setCursor(0, 2); helpers.doKeys('.'); eq('ABCDef\nGHIJkl\nMNOPq\nfoo', cm.getValue()); // check when last line is shorter. cm.setCursor(2, 2); helpers.doKeys('.'); eq('ABCDef\nGHIJkl\nMNOPq\nfoO', cm.getValue()); }, { value: 'abcdef\nghijkl\nmnopq\nfoo'}); testVim('visual_paste', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('v', 'l', 'l', 'y'); helpers.assertCursorAt(0, 0); helpers.doKeys('3', 'l', 'j', 'v', 'l', 'p'); helpers.assertCursorAt(1, 5); eq('this is a\nunithitest for visual paste', cm.getValue()); cm.setCursor(0, 0); // in case of pasting whole line helpers.doKeys('y', 'y'); cm.setCursor(1, 6); helpers.doKeys('v', 'l', 'l', 'l', 'p'); helpers.assertCursorAt(2, 0); eq('this is a\nunithi\nthis is a\n for visual paste', cm.getValue()); }, { value: 'this is a\nunit test for visual paste'}); // This checks the contents of the register used to paste the text testVim('v_paste_from_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'w'); cm.setCursor(1, 0); helpers.doKeys('v', 'p'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+register/.test(text)); }); }, { value: 'register contents\nare not erased'}); testVim('S_normal', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('j', 'S'); helpers.doKeys(''); helpers.assertCursorAt(1, 1); eq('aa{\n \ncc', cm.getValue()); helpers.doKeys('j', 'S'); eq('aa{\n \n ', cm.getValue()); helpers.assertCursorAt(2, 2); helpers.doKeys(''); helpers.doKeys('d', 'd', 'd', 'd'); helpers.assertCursorAt(0, 0); helpers.doKeys('S'); is(vim.insertMode); eq('', cm.getValue()); }, { value: 'aa{\nbb\ncc'}); testVim('blockwise_paste', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', '3', 'j', 'l', 'y'); cm.setCursor(0, 2); // paste one char after the current cursor position helpers.doKeys('p'); eq('helhelo\nworwold\nfoofo\nbarba', cm.getValue()); cm.setCursor(0, 0); helpers.doKeys('v', '4', 'l', 'y'); cm.setCursor(0, 0); helpers.doKeys('', '3', 'j', 'p'); eq('helheelhelo\norwold\noofo\narba', cm.getValue()); }, { value: 'hello\nworld\nfoo\nbar'}); testVim('blockwise_paste_long/short_line', function(cm, vim, helpers) { // extend short lines in case of different line lengths. cm.setCursor(0, 0); helpers.doKeys('', 'j', 'j', 'y'); cm.setCursor(0, 3); helpers.doKeys('p'); eq('hellho\nfoo f\nbar b', cm.getValue()); }, { value: 'hello\nfoo\nbar'}); testVim('blockwise_paste_cut_paste', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', '2', 'j', 'x'); cm.setCursor(0, 0); helpers.doKeys('P'); eq('cut\nand\npaste\nme', cm.getValue()); }, { value: 'cut\nand\npaste\nme'}); testVim('blockwise_paste_from_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', '2', 'j', '"', 'a', 'y'); cm.setCursor(0, 3); helpers.doKeys('"', 'a', 'p'); eq('foobfar\nhellho\nworlwd', cm.getValue()); }, { value: 'foobar\nhello\nworld'}); testVim('blockwise_paste_last_line', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', '2', 'j', 'l', 'y'); cm.setCursor(3, 0); helpers.doKeys('p'); eq('cut\nand\npaste\nmcue\n an\n pa', cm.getValue()); }, { value: 'cut\nand\npaste\nme'}); testVim('S_visual', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('v', 'j', 'S'); helpers.doKeys(''); helpers.assertCursorAt(0, 0); eq('\ncc', cm.getValue()); }, { value: 'aa\nbb\ncc'}); testVim('d_/', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('match'); helpers.doKeys('2', 'd', '/'); helpers.assertCursorAt(0, 0); eq('match \n next', cm.getValue()); cm.openDialog = helpers.fakeOpenDialog('2'); helpers.doKeys('d', ':'); // TODO eq(' next', cm.getValue()); }, { value: 'text match match \n next' }); testVim('/ and n/N', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('match'); helpers.doKeys('/'); helpers.assertCursorAt(0, 11); helpers.doKeys('n'); helpers.assertCursorAt(1, 6); helpers.doKeys('N'); helpers.assertCursorAt(0, 11); cm.setCursor(0, 0); helpers.doKeys('2', '/'); helpers.assertCursorAt(1, 6); }, { value: 'match nope match \n nope Match' }); testVim('/_case', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('Match'); helpers.doKeys('/'); helpers.assertCursorAt(1, 6); }, { value: 'match nope match \n nope Match' }); testVim('/_2_pcre', function(cm, vim, helpers) { CodeMirror.Vim.setOption('pcre', true); cm.openDialog = helpers.fakeOpenDialog('(word){2}'); helpers.doKeys('/'); helpers.assertCursorAt(1, 9); helpers.doKeys('n'); helpers.assertCursorAt(2, 1); }, { value: 'word\n another wordword\n wordwordword\n' }); testVim('/_2_nopcre', function(cm, vim, helpers) { CodeMirror.Vim.setOption('pcre', false); cm.openDialog = helpers.fakeOpenDialog('\\(word\\)\\{2}'); helpers.doKeys('/'); helpers.assertCursorAt(1, 9); helpers.doKeys('n'); helpers.assertCursorAt(2, 1); }, { value: 'word\n another wordword\n wordwordword\n' }); testVim('/_nongreedy', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('aa'); helpers.doKeys('/'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(1, 3); helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa \n a aa'}); testVim('?_nongreedy', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('aa'); helpers.doKeys('?'); helpers.assertCursorAt(1, 3); helpers.doKeys('n'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa \n a aa'}); testVim('/_greedy', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('a+'); helpers.doKeys('/'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(1, 1); helpers.doKeys('n'); helpers.assertCursorAt(1, 3); helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa \n a aa'}); testVim('?_greedy', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('a+'); helpers.doKeys('?'); helpers.assertCursorAt(1, 3); helpers.doKeys('n'); helpers.assertCursorAt(1, 1); helpers.doKeys('n'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa \n a aa'}); testVim('/_greedy_0_or_more', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('a*'); helpers.doKeys('/'); helpers.assertCursorAt(0, 3); helpers.doKeys('n'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(0, 5); helpers.doKeys('n'); helpers.assertCursorAt(1, 0); helpers.doKeys('n'); helpers.assertCursorAt(1, 1); helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa\n aa'}); testVim('?_greedy_0_or_more', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('a*'); helpers.doKeys('?'); helpers.assertCursorAt(1, 1); helpers.doKeys('n'); helpers.assertCursorAt(1, 0); helpers.doKeys('n'); helpers.assertCursorAt(0, 5); helpers.doKeys('n'); helpers.assertCursorAt(0, 4); helpers.doKeys('n'); helpers.assertCursorAt(0, 3); helpers.doKeys('n'); helpers.assertCursorAt(0, 0); }, { value: 'aaa aa\n aa'}); testVim('? and n/N', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('match'); helpers.doKeys('?'); helpers.assertCursorAt(1, 6); helpers.doKeys('n'); helpers.assertCursorAt(0, 11); helpers.doKeys('N'); helpers.assertCursorAt(1, 6); cm.setCursor(0, 0); helpers.doKeys('2', '?'); helpers.assertCursorAt(0, 11); }, { value: 'match nope match \n nope Match' }); testVim('*', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('*'); helpers.assertCursorAt(0, 22); cm.setCursor(0, 9); helpers.doKeys('2', '*'); helpers.assertCursorAt(1, 8); }, { value: 'nomatch match nomatch match \nnomatch Match' }); testVim('*_no_word', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('*'); helpers.assertCursorAt(0, 0); }, { value: ' \n match \n' }); testVim('*_symbol', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('*'); helpers.assertCursorAt(1, 0); }, { value: ' /}\n/} match \n' }); testVim('#', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('#'); helpers.assertCursorAt(1, 8); cm.setCursor(0, 9); helpers.doKeys('2', '#'); helpers.assertCursorAt(0, 22); }, { value: 'nomatch match nomatch match \nnomatch Match' }); testVim('*_seek', function(cm, vim, helpers) { // Should skip over space and symbols. cm.setCursor(0, 3); helpers.doKeys('*'); helpers.assertCursorAt(0, 22); }, { value: ' := match nomatch match \nnomatch Match' }); testVim('#', function(cm, vim, helpers) { // Should skip over space and symbols. cm.setCursor(0, 3); helpers.doKeys('#'); helpers.assertCursorAt(1, 8); }, { value: ' := match nomatch match \nnomatch Match' }); testVim('g*', function(cm, vim, helpers) { cm.setCursor(0, 8); helpers.doKeys('g', '*'); helpers.assertCursorAt(0, 18); cm.setCursor(0, 8); helpers.doKeys('3', 'g', '*'); helpers.assertCursorAt(1, 8); }, { value: 'matches match alsoMatch\nmatchme matching' }); testVim('g#', function(cm, vim, helpers) { cm.setCursor(0, 8); helpers.doKeys('g', '#'); helpers.assertCursorAt(0, 0); cm.setCursor(0, 8); helpers.doKeys('3', 'g', '#'); helpers.assertCursorAt(1, 0); }, { value: 'matches match alsoMatch\nmatchme matching' }); testVim('macro_insert', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', '0', 'i'); cm.replaceRange('foo', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q', '@', 'a'); eq('foofoo', cm.getValue()); }, { value: ''}); testVim('macro_insert_repeat', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', '$', 'a'); cm.replaceRange('larry.', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('a'); cm.replaceRange('curly.', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('a'); cm.replaceRange('moe.', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('@', 'a'); // At this point, the most recent edit should be the 2nd insert change // inside the macro, i.e. "curly.". helpers.doKeys('.'); eq('larry.curly.moe.larry.curly.curly.', cm.getValue()); }, { value: ''}); testVim('macro_space', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('', ''); helpers.assertCursorAt(0, 2); helpers.doKeys('q', 'a', '', '', 'q'); helpers.assertCursorAt(0, 4); helpers.doKeys('@', 'a'); helpers.assertCursorAt(0, 6); helpers.doKeys('@', 'a'); helpers.assertCursorAt(0, 8); }, { value: 'one line of text.'}); testVim('macro_t_search', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', 't', 'e', 'q'); helpers.assertCursorAt(0, 1); helpers.doKeys('l', '@', 'a'); helpers.assertCursorAt(0, 6); helpers.doKeys('l', ';'); helpers.assertCursorAt(0, 12); }, { value: 'one line of text.'}); testVim('macro_f_search', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'b', 'f', 'e', 'q'); helpers.assertCursorAt(0, 2); helpers.doKeys('@', 'b'); helpers.assertCursorAt(0, 7); helpers.doKeys(';'); helpers.assertCursorAt(0, 13); }, { value: 'one line of text.'}); testVim('macro_slash_search', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'c'); cm.openDialog = helpers.fakeOpenDialog('e'); helpers.doKeys('/', 'q'); helpers.assertCursorAt(0, 2); helpers.doKeys('@', 'c'); helpers.assertCursorAt(0, 7); helpers.doKeys('n'); helpers.assertCursorAt(0, 13); }, { value: 'one line of text.'}); testVim('macro_multislash_search', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'd'); cm.openDialog = helpers.fakeOpenDialog('e'); helpers.doKeys('/'); cm.openDialog = helpers.fakeOpenDialog('t'); helpers.doKeys('/', 'q'); helpers.assertCursorAt(0, 12); helpers.doKeys('@', 'd'); helpers.assertCursorAt(0, 15); }, { value: 'one line of text to rule them all.'}); testVim('macro_last_ex_command_register', function (cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('s/a/b'); helpers.doKeys('2', '@', ':'); eq('bbbaa', cm.getValue()); helpers.assertCursorAt(0, 2); }, { value: 'aaaaa'}); testVim('macro_parens', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'z', 'i'); cm.replaceRange('(', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('e', 'a'); cm.replaceRange(')', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('w', '@', 'z'); helpers.doKeys('w', '@', 'z'); eq('(see) (spot) (run)', cm.getValue()); }, { value: 'see spot run'}); testVim('macro_overwrite', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'z', '0', 'i'); cm.replaceRange('I ', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('e'); // Now replace the macro with something else. helpers.doKeys('q', 'z', 'a'); cm.replaceRange('.', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('e', '@', 'z'); helpers.doKeys('e', '@', 'z'); eq('I see. spot. run.', cm.getValue()); }, { value: 'see spot run'}); testVim('macro_search_f', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', 'f', ' '); helpers.assertCursorAt(0,3); helpers.doKeys('q', '0'); helpers.assertCursorAt(0,0); helpers.doKeys('@', 'a'); helpers.assertCursorAt(0,3); }, { value: 'The quick brown fox jumped over the lazy dog.'}); testVim('macro_search_2f', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', '2', 'f', ' '); helpers.assertCursorAt(0,9); helpers.doKeys('q', '0'); helpers.assertCursorAt(0,0); helpers.doKeys('@', 'a'); helpers.assertCursorAt(0,9); }, { value: 'The quick brown fox jumped over the lazy dog.'}); testVim('yank_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'y'); helpers.doKeys('j', '"', 'b', 'y', 'y'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+foo/.test(text)); is(/b\s+bar/.test(text)); }); helpers.doKeys(':'); }, { value: 'foo\nbar'}); testVim('yank_visual_block', function(cm, vim, helpers) { cm.setCursor(0, 1); helpers.doKeys('', 'l', 'j', '"', 'a', 'y'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+oo\nar/.test(text)); }); helpers.doKeys(':'); }, { value: 'foo\nbar'}); testVim('yank_append_line_to_line_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'y'); helpers.doKeys('j', '"', 'A', 'y', 'y'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+foo\nbar/.test(text)); is(/"\s+foo\nbar/.test(text)); }); helpers.doKeys(':'); }, { value: 'foo\nbar'}); testVim('yank_append_word_to_word_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'w'); helpers.doKeys('j', '"', 'A', 'y', 'w'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+foobar/.test(text)); is(/"\s+foobar/.test(text)); }); helpers.doKeys(':'); }, { value: 'foo\nbar'}); testVim('yank_append_line_to_word_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'w'); helpers.doKeys('j', '"', 'A', 'y', 'y'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+foo\nbar/.test(text)); is(/"\s+foo\nbar/.test(text)); }); helpers.doKeys(':'); }, { value: 'foo\nbar'}); testVim('yank_append_word_to_line_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('"', 'a', 'y', 'y'); helpers.doKeys('j', '"', 'A', 'y', 'w'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+foo\nbar/.test(text)); is(/"\s+foo\nbar/.test(text)); }); helpers.doKeys(':'); }, { value: 'foo\nbar'}); testVim('macro_register', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('q', 'a', 'i'); cm.replaceRange('gangnam', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q'); helpers.doKeys('q', 'b', 'o'); cm.replaceRange('style', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('q'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/a\s+i/.test(text)); is(/b\s+o/.test(text)); }); helpers.doKeys(':'); }, { value: ''}); testVim('._register', function(cm,vim,helpers) { cm.setCursor(0,0); helpers.doKeys('i'); cm.replaceRange('foo',cm.getCursor()); helpers.doKeys(''); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/\.\s+foo/.test(text)); }); helpers.doKeys(':'); }, {value: ''}); testVim(':_register', function(cm,vim,helpers) { helpers.doEx('bar'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/:\s+bar/.test(text)); }); helpers.doKeys(':'); }, {value: ''}); testVim('search_register_escape', function(cm, vim, helpers) { // Check that the register is restored if the user escapes rather than confirms. cm.openDialog = helpers.fakeOpenDialog('waldo'); helpers.doKeys('/'); var onKeyDown; var onKeyUp; var KEYCODES = { f: 70, o: 79, Esc: 27 }; cm.openDialog = function(template, callback, options) { onKeyDown = options.onKeyDown; onKeyUp = options.onKeyUp; }; var close = function() {}; helpers.doKeys('/'); // Fake some keyboard events coming in. onKeyDown({keyCode: KEYCODES.f}, '', close); onKeyUp({keyCode: KEYCODES.f}, '', close); onKeyDown({keyCode: KEYCODES.o}, 'f', close); onKeyUp({keyCode: KEYCODES.o}, 'f', close); onKeyDown({keyCode: KEYCODES.o}, 'fo', close); onKeyUp({keyCode: KEYCODES.o}, 'fo', close); onKeyDown({keyCode: KEYCODES.Esc}, 'foo', close); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/waldo/.test(text)); is(!/foo/.test(text)); }); helpers.doKeys(':'); }, {value: ''}); testVim('search_register', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('foo'); helpers.doKeys('/'); cm.openDialog = helpers.fakeOpenDialog('registers'); cm.openNotification = helpers.fakeOpenNotification(function(text) { is(/\/\s+foo/.test(text)); }); helpers.doKeys(':'); }, {value: ''}); testVim('search_history', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('this'); helpers.doKeys('/'); cm.openDialog = helpers.fakeOpenDialog('checks'); helpers.doKeys('/'); cm.openDialog = helpers.fakeOpenDialog('search'); helpers.doKeys('/'); cm.openDialog = helpers.fakeOpenDialog('history'); helpers.doKeys('/'); cm.openDialog = helpers.fakeOpenDialog('checks'); helpers.doKeys('/'); var onKeyDown; var onKeyUp; var query = ''; var keyCodes = { Up: 38, Down: 40 }; cm.openDialog = function(template, callback, options) { onKeyUp = options.onKeyUp; onKeyDown = options.onKeyDown; }; var close = function(newVal) { if (typeof newVal == 'string') query = newVal; } helpers.doKeys('/'); onKeyDown({keyCode: keyCodes.Up}, query, close); onKeyUp({keyCode: keyCodes.Up}, query, close); eq(query, 'checks'); onKeyDown({keyCode: keyCodes.Up}, query, close); onKeyUp({keyCode: keyCodes.Up}, query, close); eq(query, 'history'); onKeyDown({keyCode: keyCodes.Up}, query, close); onKeyUp({keyCode: keyCodes.Up}, query, close); eq(query, 'search'); onKeyDown({keyCode: keyCodes.Up}, query, close); onKeyUp({keyCode: keyCodes.Up}, query, close); eq(query, 'this'); onKeyDown({keyCode: keyCodes.Down}, query, close); onKeyUp({keyCode: keyCodes.Down}, query, close); eq(query, 'search'); }, {value: ''}); testVim('exCommand_history', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('registers'); helpers.doKeys(':'); cm.openDialog = helpers.fakeOpenDialog('sort'); helpers.doKeys(':'); cm.openDialog = helpers.fakeOpenDialog('map'); helpers.doKeys(':'); cm.openDialog = helpers.fakeOpenDialog('invalid'); helpers.doKeys(':'); var onKeyDown; var onKeyUp; var input = ''; var keyCodes = { Up: 38, Down: 40, s: 115 }; cm.openDialog = function(template, callback, options) { onKeyUp = options.onKeyUp; onKeyDown = options.onKeyDown; }; var close = function(newVal) { if (typeof newVal == 'string') input = newVal; } helpers.doKeys(':'); onKeyDown({keyCode: keyCodes.Up}, input, close); eq(input, 'invalid'); onKeyDown({keyCode: keyCodes.Up}, input, close); eq(input, 'map'); onKeyDown({keyCode: keyCodes.Up}, input, close); eq(input, 'sort'); onKeyDown({keyCode: keyCodes.Up}, input, close); eq(input, 'registers'); onKeyDown({keyCode: keyCodes.s}, '', close); input = 's'; onKeyDown({keyCode: keyCodes.Up}, input, close); eq(input, 'sort'); }, {value: ''}); testVim('search_clear', function(cm, vim, helpers) { var onKeyDown; var input = ''; var keyCodes = { Ctrl: 17, u: 85 }; cm.openDialog = function(template, callback, options) { onKeyDown = options.onKeyDown; }; var close = function(newVal) { if (typeof newVal == 'string') input = newVal; } helpers.doKeys('/'); input = 'foo'; onKeyDown({keyCode: keyCodes.Ctrl}, input, close); onKeyDown({keyCode: keyCodes.u, ctrlKey: true}, input, close); eq(input, ''); }); testVim('exCommand_clear', function(cm, vim, helpers) { var onKeyDown; var input = ''; var keyCodes = { Ctrl: 17, u: 85 }; cm.openDialog = function(template, callback, options) { onKeyDown = options.onKeyDown; }; var close = function(newVal) { if (typeof newVal == 'string') input = newVal; } helpers.doKeys(':'); input = 'foo'; onKeyDown({keyCode: keyCodes.Ctrl}, input, close); onKeyDown({keyCode: keyCodes.u, ctrlKey: true}, input, close); eq(input, ''); }); testVim('.', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('2', 'd', 'w'); helpers.doKeys('.'); eq('5 6', cm.getValue()); }, { value: '1 2 3 4 5 6'}); testVim('._repeat', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('2', 'd', 'w'); helpers.doKeys('3', '.'); eq('6', cm.getValue()); }, { value: '1 2 3 4 5 6'}); testVim('._insert', function(cm, vim, helpers) { helpers.doKeys('i'); cm.replaceRange('test', cm.getCursor()); helpers.doKeys(''); helpers.doKeys('.'); eq('testestt', cm.getValue()); helpers.assertCursorAt(0, 6); helpers.doKeys('O'); cm.replaceRange('xyz', cm.getCursor()); helpers.doInsertModeKeys('Backspace'); helpers.doInsertModeKeys('Down'); helpers.doKeys(''); helpers.doKeys('.'); eq('xy\nxy\ntestestt', cm.getValue()); helpers.assertCursorAt(1, 1); }, { value: ''}); testVim('._insert_repeat', function(cm, vim, helpers) { helpers.doKeys('i'); cm.replaceRange('test', cm.getCursor()); cm.setCursor(0, 4); helpers.doKeys(''); helpers.doKeys('2', '.'); eq('testesttestt', cm.getValue()); helpers.assertCursorAt(0, 10); }, { value: ''}); testVim('._repeat_insert', function(cm, vim, helpers) { helpers.doKeys('3', 'i'); cm.replaceRange('te', cm.getCursor()); cm.setCursor(0, 2); helpers.doKeys(''); helpers.doKeys('.'); eq('tetettetetee', cm.getValue()); helpers.assertCursorAt(0, 10); }, { value: ''}); testVim('._insert_o', function(cm, vim, helpers) { helpers.doKeys('o'); cm.replaceRange('z', cm.getCursor()); cm.setCursor(1, 1); helpers.doKeys(''); helpers.doKeys('.'); eq('\nz\nz', cm.getValue()); helpers.assertCursorAt(2, 0); }, { value: ''}); testVim('._insert_o_repeat', function(cm, vim, helpers) { helpers.doKeys('o'); cm.replaceRange('z', cm.getCursor()); helpers.doKeys(''); cm.setCursor(1, 0); helpers.doKeys('2', '.'); eq('\nz\nz\nz', cm.getValue()); helpers.assertCursorAt(3, 0); }, { value: ''}); testVim('._insert_o_indent', function(cm, vim, helpers) { helpers.doKeys('o'); cm.replaceRange('z', cm.getCursor()); helpers.doKeys(''); cm.setCursor(1, 2); helpers.doKeys('.'); eq('{\n z\n z', cm.getValue()); helpers.assertCursorAt(2, 2); }, { value: '{'}); testVim('._insert_cw', function(cm, vim, helpers) { helpers.doKeys('c', 'w'); cm.replaceRange('test', cm.getCursor()); helpers.doKeys(''); cm.setCursor(0, 3); helpers.doKeys('2', 'l'); helpers.doKeys('.'); eq('test test word3', cm.getValue()); helpers.assertCursorAt(0, 8); }, { value: 'word1 word2 word3' }); testVim('._insert_cw_repeat', function(cm, vim, helpers) { // For some reason, repeat cw in desktop VIM will does not repeat insert mode // changes. Will conform to that behavior. helpers.doKeys('c', 'w'); cm.replaceRange('test', cm.getCursor()); helpers.doKeys(''); cm.setCursor(0, 4); helpers.doKeys('l'); helpers.doKeys('2', '.'); eq('test test', cm.getValue()); helpers.assertCursorAt(0, 8); }, { value: 'word1 word2 word3' }); testVim('._delete', function(cm, vim, helpers) { cm.setCursor(0, 5); helpers.doKeys('i'); helpers.doInsertModeKeys('Backspace'); helpers.doKeys(''); helpers.doKeys('.'); eq('zace', cm.getValue()); helpers.assertCursorAt(0, 1); }, { value: 'zabcde'}); testVim('._delete_repeat', function(cm, vim, helpers) { cm.setCursor(0, 6); helpers.doKeys('i'); helpers.doInsertModeKeys('Backspace'); helpers.doKeys(''); helpers.doKeys('2', '.'); eq('zzce', cm.getValue()); helpers.assertCursorAt(0, 1); }, { value: 'zzabcde'}); testVim('._visual_>', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('V', 'j', '>'); cm.setCursor(2, 0) helpers.doKeys('.'); eq(' 1\n 2\n 3\n 4', cm.getValue()); helpers.assertCursorAt(2, 2); }, { value: '1\n2\n3\n4'}); testVim('f;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('f', 'x'); helpers.doKeys(';'); helpers.doKeys('2', ';'); eq(9, cm.getCursor().ch); }, { value: '01x3xx678x'}); testVim('F;', function(cm, vim, helpers) { cm.setCursor(0, 8); helpers.doKeys('F', 'x'); helpers.doKeys(';'); helpers.doKeys('2', ';'); eq(2, cm.getCursor().ch); }, { value: '01x3xx6x8x'}); testVim('t;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('t', 'x'); helpers.doKeys(';'); helpers.doKeys('2', ';'); eq(8, cm.getCursor().ch); }, { value: '01x3xx678x'}); testVim('T;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('T', 'x'); helpers.doKeys(';'); helpers.doKeys('2', ';'); eq(2, cm.getCursor().ch); }, { value: '0xx3xx678x'}); testVim('f,', function(cm, vim, helpers) { cm.setCursor(0, 6); helpers.doKeys('f', 'x'); helpers.doKeys(','); helpers.doKeys('2', ','); eq(2, cm.getCursor().ch); }, { value: '01x3xx678x'}); testVim('F,', function(cm, vim, helpers) { cm.setCursor(0, 3); helpers.doKeys('F', 'x'); helpers.doKeys(','); helpers.doKeys('2', ','); eq(9, cm.getCursor().ch); }, { value: '01x3xx678x'}); testVim('t,', function(cm, vim, helpers) { cm.setCursor(0, 6); helpers.doKeys('t', 'x'); helpers.doKeys(','); helpers.doKeys('2', ','); eq(3, cm.getCursor().ch); }, { value: '01x3xx678x'}); testVim('T,', function(cm, vim, helpers) { cm.setCursor(0, 4); helpers.doKeys('T', 'x'); helpers.doKeys(','); helpers.doKeys('2', ','); eq(8, cm.getCursor().ch); }, { value: '01x3xx67xx'}); testVim('fd,;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('f', '4'); cm.setCursor(0, 0); helpers.doKeys('d', ';'); eq('56789', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 9); helpers.doKeys('d', ','); eq('01239', cm.getValue()); }, { value: '0123456789'}); testVim('Fd,;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('F', '4'); cm.setCursor(0, 9); helpers.doKeys('d', ';'); eq('01239', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 0); helpers.doKeys('d', ','); eq('56789', cm.getValue()); }, { value: '0123456789'}); testVim('td,;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('t', '4'); cm.setCursor(0, 0); helpers.doKeys('d', ';'); eq('456789', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 9); helpers.doKeys('d', ','); eq('012349', cm.getValue()); }, { value: '0123456789'}); testVim('Td,;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('T', '4'); cm.setCursor(0, 9); helpers.doKeys('d', ';'); eq('012349', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 0); helpers.doKeys('d', ','); eq('456789', cm.getValue()); }, { value: '0123456789'}); testVim('fc,;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('f', '4'); cm.setCursor(0, 0); helpers.doKeys('c', ';', ''); eq('56789', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 9); helpers.doKeys('c', ','); eq('01239', cm.getValue()); }, { value: '0123456789'}); testVim('Fc,;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('F', '4'); cm.setCursor(0, 9); helpers.doKeys('c', ';', ''); eq('01239', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 0); helpers.doKeys('c', ','); eq('56789', cm.getValue()); }, { value: '0123456789'}); testVim('tc,;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('t', '4'); cm.setCursor(0, 0); helpers.doKeys('c', ';', ''); eq('456789', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 9); helpers.doKeys('c', ','); eq('012349', cm.getValue()); }, { value: '0123456789'}); testVim('Tc,;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('T', '4'); cm.setCursor(0, 9); helpers.doKeys('c', ';', ''); eq('012349', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 0); helpers.doKeys('c', ','); eq('456789', cm.getValue()); }, { value: '0123456789'}); testVim('fy,;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('f', '4'); cm.setCursor(0, 0); helpers.doKeys('y', ';', 'P'); eq('012340123456789', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 9); helpers.doKeys('y', ',', 'P'); eq('012345678456789', cm.getValue()); }, { value: '0123456789'}); testVim('Fy,;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('F', '4'); cm.setCursor(0, 9); helpers.doKeys('y', ';', 'p'); eq('012345678945678', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 0); helpers.doKeys('y', ',', 'P'); eq('012340123456789', cm.getValue()); }, { value: '0123456789'}); testVim('ty,;', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys('t', '4'); cm.setCursor(0, 0); helpers.doKeys('y', ';', 'P'); eq('01230123456789', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 9); helpers.doKeys('y', ',', 'p'); eq('01234567895678', cm.getValue()); }, { value: '0123456789'}); testVim('Ty,;', function(cm, vim, helpers) { cm.setCursor(0, 9); helpers.doKeys('T', '4'); cm.setCursor(0, 9); helpers.doKeys('y', ';', 'p'); eq('01234567895678', cm.getValue()); helpers.doKeys('u'); cm.setCursor(0, 0); helpers.doKeys('y', ',', 'P'); eq('01230123456789', cm.getValue()); }, { value: '0123456789'}); testVim('HML', function(cm, vim, helpers) { var lines = 35; var textHeight = cm.defaultTextHeight(); cm.setSize(600, lines*textHeight); cm.setCursor(120, 0); cm.refresh(); //ace_patch helpers.doKeys('H'); helpers.assertCursorAt(86, 2); helpers.doKeys('L'); helpers.assertCursorAt(120, 4); helpers.doKeys('M'); helpers.assertCursorAt(103,4); }, { value: (function(){ var lines = new Array(100); var upper = ' xx\n'; var lower = ' xx\n'; upper = lines.join(upper); lower = lines.join(lower); return upper + lower; })()}); var zVals = []; forEach(['zb','zz','zt','z-','z.','z'], function(e, idx){ var lineNum = 250; var lines = 35; testVim(e, function(cm, vim, helpers) { var k1 = e[0]; var k2 = e.substring(1); var textHeight = cm.defaultTextHeight(); cm.setSize(600, lines*textHeight); cm.setCursor(lineNum, 0); helpers.doKeys(k1, k2); zVals[idx] = cm.getScrollInfo().top; }, { value: (function(){ return new Array(500).join('\n'); })()}); }); testVim('zb_to_bottom', function(cm, vim, helpers){ var lineNum = 250; cm.setSize(600, 35*cm.defaultTextHeight()); cm.setCursor(lineNum, 0); helpers.doKeys('z', 'b'); var scrollInfo = cm.getScrollInfo(); eq(scrollInfo.top + scrollInfo.clientHeight, cm.charCoords(Pos(lineNum, 0), 'local').bottom); }, { value: (function(){ return new Array(500).join('\n'); })()}); testVim('zt_to_top', function(cm, vim, helpers){ var lineNum = 250; cm.setSize(600, 35*cm.defaultTextHeight()); cm.setCursor(lineNum, 0); helpers.doKeys('z', 't'); eq(cm.getScrollInfo().top, cm.charCoords(Pos(lineNum, 0), 'local').top); }, { value: (function(){ return new Array(500).join('\n'); })()}); testVim('zb', function(cm, vim, helpers){ eq(zVals[2], zVals[5]); }); var moveTillCharacterSandbox = 'The quick brown fox \n'; testVim('moveTillCharacter', function(cm, vim, helpers){ cm.setCursor(0, 0); // Search for the 'q'. cm.openDialog = helpers.fakeOpenDialog('q'); helpers.doKeys('/'); eq(4, cm.getCursor().ch); // Jump to just before the first o in the list. helpers.doKeys('t'); helpers.doKeys('o'); eq('The quick brown fox \n', cm.getValue()); // Delete that one character. helpers.doKeys('d'); helpers.doKeys('t'); helpers.doKeys('o'); eq('The quick bown fox \n', cm.getValue()); // Delete everything until the next 'o'. helpers.doKeys('.'); eq('The quick box \n', cm.getValue()); // An unmatched character should have no effect. helpers.doKeys('d'); helpers.doKeys('t'); helpers.doKeys('q'); eq('The quick box \n', cm.getValue()); // Matches should only be possible on single lines. helpers.doKeys('d'); helpers.doKeys('t'); helpers.doKeys('z'); eq('The quick box \n', cm.getValue()); // After all that, the search for 'q' should still be active, so the 'N' command // can run it again in reverse. Use that to delete everything back to the 'q'. helpers.doKeys('d'); helpers.doKeys('N'); eq('The ox \n', cm.getValue()); eq(4, cm.getCursor().ch); }, { value: moveTillCharacterSandbox}); testVim('searchForPipe', function(cm, vim, helpers){ CodeMirror.Vim.setOption('pcre', false); cm.setCursor(0, 0); // Search for the '|'. cm.openDialog = helpers.fakeOpenDialog('|'); helpers.doKeys('/'); eq(4, cm.getCursor().ch); }, { value: 'this|that'}); var scrollMotionSandbox = '\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n'; testVim('scrollMotion', function(cm, vim, helpers){ var prevCursor, prevScrollInfo; cm.setCursor(0, 0); // ctrl-y at the top of the file should have no effect. helpers.doKeys(''); eq(0, cm.getCursor().line); prevScrollInfo = cm.getScrollInfo(); helpers.doKeys(''); eq(1, cm.getCursor().line); is(prevScrollInfo.top < cm.getScrollInfo().top); // Jump to the end of the sandbox. cm.setCursor(1000, 0); cm.refresh(); //ace_patch prevCursor = cm.getCursor(); // ctrl-e at the bottom of the file should have no effect. helpers.doKeys(''); eq(prevCursor.line, cm.getCursor().line); cm.refresh(); //ace_patch prevScrollInfo = cm.getScrollInfo(); helpers.doKeys(''); eq(prevCursor.line - 1, cm.getCursor().line, "Y"); is(prevScrollInfo.top > cm.getScrollInfo().top); }, { value: scrollMotionSandbox}); var squareBracketMotionSandbox = ''+ '({\n'+//0 ' ({\n'+//11 ' /*comment {\n'+//2 ' */(\n'+//3 '#else \n'+//4 ' /* )\n'+//5 '#if }\n'+//6 ' )}*/\n'+//7 ')}\n'+//8 '{}\n'+//9 '#else {{\n'+//10 '{}\n'+//11 '}\n'+//12 '{\n'+//13 '#endif\n'+//14 '}\n'+//15 '}\n'+//16 '#else';//17 testVim('[[, ]]', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys(']', ']'); helpers.assertCursorAt(9,0); helpers.doKeys('2', ']', ']'); helpers.assertCursorAt(13,0); helpers.doKeys(']', ']'); helpers.assertCursorAt(17,0); helpers.doKeys('[', '['); helpers.assertCursorAt(13,0); helpers.doKeys('2', '[', '['); helpers.assertCursorAt(9,0); helpers.doKeys('[', '['); helpers.assertCursorAt(0,0); }, { value: squareBracketMotionSandbox}); testVim('[], ][', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doKeys(']', '['); helpers.assertCursorAt(12,0); helpers.doKeys('2', ']', '['); helpers.assertCursorAt(16,0); helpers.doKeys(']', '['); helpers.assertCursorAt(17,0); helpers.doKeys('[', ']'); helpers.assertCursorAt(16,0); helpers.doKeys('2', '[', ']'); helpers.assertCursorAt(12,0); helpers.doKeys('[', ']'); helpers.assertCursorAt(0,0); }, { value: squareBracketMotionSandbox}); testVim('[{, ]}', function(cm, vim, helpers) { cm.setCursor(4, 10); helpers.doKeys('[', '{'); helpers.assertCursorAt(2,12); helpers.doKeys('2', '[', '{'); helpers.assertCursorAt(0,1); cm.setCursor(4, 10); helpers.doKeys(']', '}'); helpers.assertCursorAt(6,11); helpers.doKeys('2', ']', '}'); helpers.assertCursorAt(8,1); cm.setCursor(0,1); helpers.doKeys(']', '}'); helpers.assertCursorAt(8,1); helpers.doKeys('[', '{'); helpers.assertCursorAt(0,1); }, { value: squareBracketMotionSandbox}); testVim('[(, ])', function(cm, vim, helpers) { cm.setCursor(4, 10); helpers.doKeys('[', '('); helpers.assertCursorAt(3,14); helpers.doKeys('2', '[', '('); helpers.assertCursorAt(0,0); cm.setCursor(4, 10); helpers.doKeys(']', ')'); helpers.assertCursorAt(5,11); helpers.doKeys('2', ']', ')'); helpers.assertCursorAt(8,0); helpers.doKeys('[', '('); helpers.assertCursorAt(0,0); helpers.doKeys(']', ')'); helpers.assertCursorAt(8,0); }, { value: squareBracketMotionSandbox}); testVim('[*, ]*, [/, ]/', function(cm, vim, helpers) { forEach(['*', '/'], function(key){ cm.setCursor(7, 0); helpers.doKeys('2', '[', key); helpers.assertCursorAt(2,2); helpers.doKeys('2', ']', key); helpers.assertCursorAt(7,5); }); }, { value: squareBracketMotionSandbox}); testVim('[#, ]#', function(cm, vim, helpers) { cm.setCursor(10, 3); helpers.doKeys('2', '[', '#'); helpers.assertCursorAt(4,0); helpers.doKeys('5', ']', '#'); helpers.assertCursorAt(17,0); cm.setCursor(10, 3); helpers.doKeys(']', '#'); helpers.assertCursorAt(14,0); }, { value: squareBracketMotionSandbox}); testVim('[m, ]m, [M, ]M', function(cm, vim, helpers) { cm.setCursor(11, 0); helpers.doKeys('[', 'm'); helpers.assertCursorAt(10,7); helpers.doKeys('4', '[', 'm'); helpers.assertCursorAt(1,3); helpers.doKeys('5', ']', 'm'); helpers.assertCursorAt(11,0); helpers.doKeys('[', 'M'); helpers.assertCursorAt(9,1); helpers.doKeys('3', ']', 'M'); helpers.assertCursorAt(15,0); helpers.doKeys('5', '[', 'M'); helpers.assertCursorAt(7,3); }, { value: squareBracketMotionSandbox}); // Ex mode tests testVim('ex_go_to_line', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('4'); helpers.assertCursorAt(3, 0); }, { value: 'a\nb\nc\nd\ne\n'}); testVim('ex_write', function(cm, vim, helpers) { var tmp = CodeMirror.commands.save; var written; var actualCm; CodeMirror.commands.save = function(cm) { written = true; actualCm = cm; }; // Test that w, wr, wri ... write all trigger :write. var command = 'write'; for (var i = 1; i < command.length; i++) { written = false; actualCm = null; helpers.doEx(command.substring(0, i)); eq(written, true); eq(actualCm, cm); } CodeMirror.commands.save = tmp; }); testVim('ex_sort', function(cm, vim, helpers) { helpers.doEx('sort'); eq('Z\na\nb\nc\nd', cm.getValue()); }, { value: 'b\nZ\nd\nc\na'}); testVim('ex_sort_reverse', function(cm, vim, helpers) { helpers.doEx('sort!'); eq('d\nc\nb\na', cm.getValue()); }, { value: 'b\nd\nc\na'}); testVim('ex_sort_range', function(cm, vim, helpers) { helpers.doEx('2,3sort'); eq('b\nc\nd\na', cm.getValue()); }, { value: 'b\nd\nc\na'}); testVim('ex_sort_oneline', function(cm, vim, helpers) { helpers.doEx('2sort'); // Expect no change. eq('b\nd\nc\na', cm.getValue()); }, { value: 'b\nd\nc\na'}); testVim('ex_sort_ignoreCase', function(cm, vim, helpers) { helpers.doEx('sort i'); eq('a\nb\nc\nd\nZ', cm.getValue()); }, { value: 'b\nZ\nd\nc\na'}); testVim('ex_sort_unique', function(cm, vim, helpers) { helpers.doEx('sort u'); eq('Z\na\nb\nc\nd', cm.getValue()); }, { value: 'b\nZ\na\na\nd\na\nc\na'}); testVim('ex_sort_decimal', function(cm, vim, helpers) { helpers.doEx('sort d'); eq('d3\n s5\n6\n.9', cm.getValue()); }, { value: '6\nd3\n s5\n.9'}); testVim('ex_sort_decimal_negative', function(cm, vim, helpers) { helpers.doEx('sort d'); eq('z-9\nd3\n s5\n6\n.9', cm.getValue()); }, { value: '6\nd3\n s5\n.9\nz-9'}); testVim('ex_sort_decimal_reverse', function(cm, vim, helpers) { helpers.doEx('sort! d'); eq('.9\n6\n s5\nd3', cm.getValue()); }, { value: '6\nd3\n s5\n.9'}); testVim('ex_sort_hex', function(cm, vim, helpers) { helpers.doEx('sort x'); eq(' s5\n6\n.9\n&0xB\nd3', cm.getValue()); }, { value: '6\nd3\n s5\n&0xB\n.9'}); testVim('ex_sort_octal', function(cm, vim, helpers) { helpers.doEx('sort o'); eq('.8\n.9\nd3\n s5\n6', cm.getValue()); }, { value: '6\nd3\n s5\n.9\n.8'}); testVim('ex_sort_decimal_mixed', function(cm, vim, helpers) { helpers.doEx('sort d'); eq('y\nz\nc1\nb2\na3', cm.getValue()); }, { value: 'a3\nz\nc1\ny\nb2'}); testVim('ex_sort_decimal_mixed_reverse', function(cm, vim, helpers) { helpers.doEx('sort! d'); eq('a3\nb2\nc1\nz\ny', cm.getValue()); }, { value: 'a3\nz\nc1\ny\nb2'}); testVim('ex_sort_patterns_not_supported', function(cm, vim, helpers) { var notified = false; cm.openNotification = helpers.fakeOpenNotification(function(text) { notified = /patterns not supported/.test(text); }); helpers.doEx('sort /abc/'); is(notified, 'No notification.'); }); // test for :global command testVim('ex_global', function(cm, vim, helpers) { cm.setCursor(0, 0); helpers.doEx('g/one/s//two'); eq('two two\n two two\n two two', cm.getValue()); helpers.doEx('1,2g/two/s//one'); eq('one one\n one one\n two two', cm.getValue()); }, {value: 'one one\n one one\n one one'}); testVim('ex_global_confirm', function(cm, vim, helpers) { cm.setCursor(0, 0); var onKeyDown; var openDialogSave = cm.openDialog; var KEYCODES = { a: 65, n: 78, q: 81, y: 89 }; // Intercept the ex command, 'global' cm.openDialog = function(template, callback, options) { // Intercept the prompt for the embedded ex command, 'substitute' cm.openDialog = function(template, callback, options) { onKeyDown = options.onKeyDown; }; callback('g/one/s//two/gc'); }; helpers.doKeys(':'); var close = function() {}; onKeyDown({keyCode: KEYCODES.n}, '', close); onKeyDown({keyCode: KEYCODES.y}, '', close); onKeyDown({keyCode: KEYCODES.a}, '', close); onKeyDown({keyCode: KEYCODES.q}, '', close); onKeyDown({keyCode: KEYCODES.y}, '', close); eq('one two\n two two\n one one\n two one\n one one', cm.getValue()); }, {value: 'one one\n one one\n one one\n one one\n one one'}); // Basic substitute tests. testVim('ex_substitute_same_line', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('s/one/two/g'); eq('one one\n two two', cm.getValue()); }, { value: 'one one\n one one'}); testVim('ex_substitute_full_file', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('%s/one/two/g'); eq('two two\n two two', cm.getValue()); }, { value: 'one one\n one one'}); testVim('ex_substitute_input_range', function(cm, vim, helpers) { cm.setCursor(1, 0); helpers.doEx('1,3s/\\d/0/g'); eq('0\n0\n0\n4', cm.getValue()); }, { value: '1\n2\n3\n4' }); testVim('ex_substitute_visual_range', function(cm, vim, helpers) { cm.setCursor(1, 0); // Set last visual mode selection marks '< and '> at lines 2 and 4 helpers.doKeys('V', '2', 'j', 'v'); helpers.doEx('\'<,\'>s/\\d/0/g'); eq('1\n0\n0\n0\n5', cm.getValue()); }, { value: '1\n2\n3\n4\n5' }); testVim('ex_substitute_empty_query', function(cm, vim, helpers) { // If the query is empty, use last query. cm.setCursor(1, 0); cm.openDialog = helpers.fakeOpenDialog('1'); helpers.doKeys('/'); helpers.doEx('s//b/g'); eq('abb ab2 ab3', cm.getValue()); }, { value: 'a11 a12 a13' }); testVim('ex_substitute_javascript', function(cm, vim, helpers) { CodeMirror.Vim.setOption('pcre', false); cm.setCursor(1, 0); // Throw all the things that javascript likes to treat as special values // into the replace part. All should be literal (this is VIM). helpers.doEx('s/\\(\\d+\\)/$$ $\' $` $& \\1/g') eq('a $$ $\' $` $& 0 b', cm.getValue()); }, { value: 'a 0 b' }); testVim('ex_substitute_empty_arguments', function(cm,vim,helpers) { cm.setCursor(0, 0); helpers.doEx('s/a/b/g'); cm.setCursor(1, 0); helpers.doEx('s'); eq('b b\nb a', cm.getValue()); }, {value: 'a a\na a'}); // More complex substitute tests that test both pcre and nopcre options. function testSubstitute(name, options) { testVim(name + '_pcre', function(cm, vim, helpers) { cm.setCursor(1, 0); CodeMirror.Vim.setOption('pcre', true); helpers.doEx(options.expr); eq(options.expectedValue, cm.getValue()); }, options); // If no noPcreExpr is defined, assume that it's the same as the expr. var noPcreExpr = options.noPcreExpr ? options.noPcreExpr : options.expr; testVim(name + '_nopcre', function(cm, vim, helpers) { cm.setCursor(1, 0); CodeMirror.Vim.setOption('pcre', false); helpers.doEx(noPcreExpr); eq(options.expectedValue, cm.getValue()); }, options); } testSubstitute('ex_substitute_capture', { value: 'a11 a12 a13', expectedValue: 'a1111 a1212 a1313', // $n is a backreference expr: 's/(\\d+)/$1$1/g', // \n is a backreference. noPcreExpr: 's/\\(\\d+\\)/\\1\\1/g'}); testSubstitute('ex_substitute_capture2', { value: 'a 0 b', expectedValue: 'a $00 b', expr: 's/(\\d+)/$$$1$1/g', noPcreExpr: 's/\\(\\d+\\)/$\\1\\1/g'}); testSubstitute('ex_substitute_nocapture', { value: 'a11 a12 a13', expectedValue: 'a$1$1 a$1$1 a$1$1', expr: 's/(\\d+)/$$1$$1/g', noPcreExpr: 's/\\(\\d+\\)/$1$1/g'}); testSubstitute('ex_substitute_nocapture2', { value: 'a 0 b', expectedValue: 'a $10 b', expr: 's/(\\d+)/$$1$1/g', noPcreExpr: 's/\\(\\d+\\)/\\$1\\1/g'}); testSubstitute('ex_substitute_nocapture', { value: 'a b c', expectedValue: 'a $ c', expr: 's/b/$$/', noPcreExpr: 's/b/$/'}); testSubstitute('ex_substitute_slash_regex', { value: 'one/two \n three/four', expectedValue: 'one|two \n three|four', expr: '%s/\\//|'}); testSubstitute('ex_substitute_pipe_regex', { value: 'one|two \n three|four', expectedValue: 'one,two \n three,four', expr: '%s/\\|/,/', noPcreExpr: '%s/|/,/'}); testSubstitute('ex_substitute_or_regex', { value: 'one|two \n three|four', expectedValue: 'ana|twa \n thraa|faar', expr: '%s/o|e|u/a/g', noPcreExpr: '%s/o\\|e\\|u/a/g'}); testSubstitute('ex_substitute_or_word_regex', { value: 'one|two \n three|four', expectedValue: 'five|five \n three|four', expr: '%s/(one|two)/five/g', noPcreExpr: '%s/\\(one\\|two\\)/five/g'}); testSubstitute('ex_substitute_backslashslash_regex', { value: 'one\\two \n three\\four', expectedValue: 'one,two \n three,four', expr: '%s/\\\\/,'}); testSubstitute('ex_substitute_slash_replacement', { value: 'one,two \n three,four', expectedValue: 'one/two \n three/four', expr: '%s/,/\\/'}); testSubstitute('ex_substitute_backslash_replacement', { value: 'one,two \n three,four', expectedValue: 'one\\two \n three\\four', expr: '%s/,/\\\\/g'}); testSubstitute('ex_substitute_multibackslash_replacement', { value: 'one,two \n three,four', expectedValue: 'one\\\\\\\\two \n three\\\\\\\\four', // 2*8 backslashes. expr: '%s/,/\\\\\\\\\\\\\\\\/g'}); // 16 backslashes. testSubstitute('ex_substitute_newline_replacement', { value: 'one,two \n three,four', expectedValue: 'one\ntwo \n three\nfour', expr: '%s/,/\\n/g'}); testSubstitute('ex_substitute_braces_word', { value: 'ababab abb ab{2}', expectedValue: 'ab abb ab{2}', expr: '%s/(ab){2}//g', noPcreExpr: '%s/\\(ab\\)\\{2\\}//g'}); testSubstitute('ex_substitute_braces_range', { value: 'a aa aaa aaaa', expectedValue: 'a a', expr: '%s/a{2,3}//g', noPcreExpr: '%s/a\\{2,3\\}//g'}); testSubstitute('ex_substitute_braces_literal', { value: 'ababab abb ab{2}', expectedValue: 'ababab abb ', expr: '%s/ab\\{2\\}//g', noPcreExpr: '%s/ab{2}//g'}); testSubstitute('ex_substitute_braces_char', { value: 'ababab abb ab{2}', expectedValue: 'ababab ab{2}', expr: '%s/ab{2}//g', noPcreExpr: '%s/ab\\{2\\}//g'}); testSubstitute('ex_substitute_braces_no_escape', { value: 'ababab abb ab{2}', expectedValue: 'ababab ab{2}', expr: '%s/ab{2}//g', noPcreExpr: '%s/ab\\{2}//g'}); testSubstitute('ex_substitute_count', { value: '1\n2\n3\n4', expectedValue: '1\n0\n0\n4', expr: 's/\\d/0/i 2'}); testSubstitute('ex_substitute_count_with_range', { value: '1\n2\n3\n4', expectedValue: '1\n2\n0\n0', expr: '1,3s/\\d/0/ 3'}); testSubstitute('ex_substitute_not_global', { value: 'aaa\nbaa\ncaa', expectedValue: 'xaa\nbxa\ncxa', expr: '%s/a/x/'}); function testSubstituteConfirm(name, command, initialValue, expectedValue, keys, finalPos) { testVim(name, function(cm, vim, helpers) { var savedOpenDialog = cm.openDialog; var savedKeyName = CodeMirror.keyName; var onKeyDown; var recordedCallback; var closed = true; // Start out closed, set false on second openDialog. function close() { closed = true; } // First openDialog should save callback. cm.openDialog = function(template, callback, options) { recordedCallback = callback; } // Do first openDialog. helpers.doKeys(':'); // Second openDialog should save keyDown handler. cm.openDialog = function(template, callback, options) { onKeyDown = options.onKeyDown; closed = false; }; // Return the command to Vim and trigger second openDialog. recordedCallback(command); // The event should really use keyCode, but here just mock it out and use // key and replace keyName to just return key. CodeMirror.keyName = function (e) { return e.key; } keys = keys.toUpperCase(); for (var i = 0; i < keys.length; i++) { is(!closed); onKeyDown({ key: keys.charAt(i) }, '', close); } try { eq(expectedValue, cm.getValue()); helpers.assertCursorAt(finalPos); is(closed); } catch(e) { throw e } finally { // Restore overriden functions. CodeMirror.keyName = savedKeyName; cm.openDialog = savedOpenDialog; } }, { value: initialValue }); } testSubstituteConfirm('ex_substitute_confirm_emptydoc', '%s/x/b/c', '', '', '', makeCursor(0, 0)); testSubstituteConfirm('ex_substitute_confirm_nomatch', '%s/x/b/c', 'ba a\nbab', 'ba a\nbab', '', makeCursor(0, 0)); testSubstituteConfirm('ex_substitute_confirm_accept', '%s/a/b/cg', 'ba a\nbab', 'bb b\nbbb', 'yyy', makeCursor(1, 1)); testSubstituteConfirm('ex_substitute_confirm_random_keys', '%s/a/b/cg', 'ba a\nbab', 'bb b\nbbb', 'ysdkywerty', makeCursor(1, 1)); testSubstituteConfirm('ex_substitute_confirm_some', '%s/a/b/cg', 'ba a\nbab', 'bb a\nbbb', 'yny', makeCursor(1, 1)); testSubstituteConfirm('ex_substitute_confirm_all', '%s/a/b/cg', 'ba a\nbab', 'bb b\nbbb', 'a', makeCursor(1, 1)); testSubstituteConfirm('ex_substitute_confirm_accept_then_all', '%s/a/b/cg', 'ba a\nbab', 'bb b\nbbb', 'ya', makeCursor(1, 1)); testSubstituteConfirm('ex_substitute_confirm_quit', '%s/a/b/cg', 'ba a\nbab', 'bb a\nbab', 'yq', makeCursor(0, 3)); testSubstituteConfirm('ex_substitute_confirm_last', '%s/a/b/cg', 'ba a\nbab', 'bb b\nbab', 'yl', makeCursor(0, 3)); testSubstituteConfirm('ex_substitute_confirm_oneline', '1s/a/b/cg', 'ba a\nbab', 'bb b\nbab', 'yl', makeCursor(0, 3)); testSubstituteConfirm('ex_substitute_confirm_range_accept', '1,2s/a/b/cg', 'aa\na \na\na', 'bb\nb \na\na', 'yyy', makeCursor(1, 0)); testSubstituteConfirm('ex_substitute_confirm_range_some', '1,3s/a/b/cg', 'aa\na \na\na', 'ba\nb \nb\na', 'ynyy', makeCursor(2, 0)); testSubstituteConfirm('ex_substitute_confirm_range_all', '1,3s/a/b/cg', 'aa\na \na\na', 'bb\nb \nb\na', 'a', makeCursor(2, 0)); testSubstituteConfirm('ex_substitute_confirm_range_last', '1,3s/a/b/cg', 'aa\na \na\na', 'bb\nb \na\na', 'yyl', makeCursor(1, 0)); //:noh should clear highlighting of search-results but allow to resume search through n testVim('ex_noh_clearSearchHighlight', function(cm, vim, helpers) { cm.openDialog = helpers.fakeOpenDialog('match'); helpers.doKeys('?'); helpers.doEx('noh'); eq(vim.searchState_.getOverlay(),null,'match-highlighting wasn\'t cleared'); helpers.doKeys('n'); helpers.assertCursorAt(0, 11,'can\'t resume search after clearing highlighting'); }, { value: 'match nope match \n nope Match' }); testVim('set_boolean', function(cm, vim, helpers) { CodeMirror.Vim.defineOption('testoption', true, 'boolean'); // Test default value is set. is(CodeMirror.Vim.getOption('testoption')); expectFail(function() { // Test fail to set to non-boolean CodeMirror.Vim.setOption('testoption', '5'); }); // Test setOption CodeMirror.Vim.setOption('testoption', false); is(!CodeMirror.Vim.getOption('testoption')); }); testVim('ex_set_boolean', function(cm, vim, helpers) { CodeMirror.Vim.defineOption('testoption', true, 'boolean'); // Test default value is set. is(CodeMirror.Vim.getOption('testoption')); expectFail(function() { // Test fail to set to non-boolean helpers.doEx('set testoption=22'); }); // Test setOption helpers.doEx('set notestoption'); is(!CodeMirror.Vim.getOption('testoption')); }); testVim('set_string', function(cm, vim, helpers) { CodeMirror.Vim.defineOption('testoption', 'a', 'string'); // Test default value is set. eq('a', CodeMirror.Vim.getOption('testoption')); expectFail(function() { // Test fail to set non-string. CodeMirror.Vim.setOption('testoption', true); }); expectFail(function() { // Test fail to set 'notestoption' CodeMirror.Vim.setOption('notestoption', 'b'); }); // Test setOption CodeMirror.Vim.setOption('testoption', 'c'); eq('c', CodeMirror.Vim.getOption('testoption')); }); testVim('ex_set_string', function(cm, vim, helpers) { CodeMirror.Vim.defineOption('testopt', 'a', 'string'); // Test default value is set. eq('a', CodeMirror.Vim.getOption('testopt')); expectFail(function() { // Test fail to set 'notestopt' helpers.doEx('set notestopt=b'); }); // Test setOption helpers.doEx('set testopt=c') eq('c', CodeMirror.Vim.getOption('testopt')); helpers.doEx('set testopt=c') eq('c', CodeMirror.Vim.getOption('testopt', cm)); //local || global eq('c', CodeMirror.Vim.getOption('testopt', cm, {scope: 'local'})); // local eq('c', CodeMirror.Vim.getOption('testopt', cm, {scope: 'global'})); // global eq('c', CodeMirror.Vim.getOption('testopt')); // global // Test setOption global helpers.doEx('setg testopt=d') eq('c', CodeMirror.Vim.getOption('testopt', cm)); eq('c', CodeMirror.Vim.getOption('testopt', cm, {scope: 'local'})); eq('d', CodeMirror.Vim.getOption('testopt', cm, {scope: 'global'})); eq('d', CodeMirror.Vim.getOption('testopt')); // Test setOption local helpers.doEx('setl testopt=e') eq('e', CodeMirror.Vim.getOption('testopt', cm)); eq('e', CodeMirror.Vim.getOption('testopt', cm, {scope: 'local'})); eq('d', CodeMirror.Vim.getOption('testopt', cm, {scope: 'global'})); eq('d', CodeMirror.Vim.getOption('testopt')); }); testVim('ex_set_callback', function(cm, vim, helpers) { var global; function cb(val, cm, cfg) { if (val === undefined) { // Getter if (cm) { return cm._local; } else { return global; } } else { // Setter if (cm) { cm._local = val; } else { global = val; } } } CodeMirror.Vim.defineOption('testopt', 'a', 'string', cb); // Test default value is set. eq('a', CodeMirror.Vim.getOption('testopt')); expectFail(function() { // Test fail to set 'notestopt' helpers.doEx('set notestopt=b'); }); // Test setOption (Identical to the string tests, but via callback instead) helpers.doEx('set testopt=c') eq('c', CodeMirror.Vim.getOption('testopt', cm)); //local || global eq('c', CodeMirror.Vim.getOption('testopt', cm, {scope: 'local'})); // local eq('c', CodeMirror.Vim.getOption('testopt', cm, {scope: 'global'})); // global eq('c', CodeMirror.Vim.getOption('testopt')); // global // Test setOption global helpers.doEx('setg testopt=d') eq('c', CodeMirror.Vim.getOption('testopt', cm)); eq('c', CodeMirror.Vim.getOption('testopt', cm, {scope: 'local'})); eq('d', CodeMirror.Vim.getOption('testopt', cm, {scope: 'global'})); eq('d', CodeMirror.Vim.getOption('testopt')); // Test setOption local helpers.doEx('setl testopt=e') eq('e', CodeMirror.Vim.getOption('testopt', cm)); eq('e', CodeMirror.Vim.getOption('testopt', cm, {scope: 'local'})); eq('d', CodeMirror.Vim.getOption('testopt', cm, {scope: 'global'})); eq('d', CodeMirror.Vim.getOption('testopt')); }) testVim('ex_set_filetype', function(cm, vim, helpers) { CodeMirror.defineMode('test_mode', function() { return {token: function(stream) { stream.match(/^\s+|^\S+/); }}; }); CodeMirror.defineMode('test_mode_2', function() { return {token: function(stream) { stream.match(/^\s+|^\S+/); }}; }); // Test mode is set. helpers.doEx('set filetype=test_mode'); eq('test_mode', cm.getMode().name); // Test 'ft' alias also sets mode. helpers.doEx('set ft=test_mode_2'); eq('test_mode_2', cm.getMode().name); }); testVim('ex_set_filetype_null', function(cm, vim, helpers) { CodeMirror.defineMode('test_mode', function() { return {token: function(stream) { stream.match(/^\s+|^\S+/); }}; }); cm.setOption('mode', 'test_mode'); // Test mode is set to null. helpers.doEx('set filetype='); eq('null', cm.getMode().name); }); // TODO: Reset key maps after each test. testVim('ex_map_key2key', function(cm, vim, helpers) { helpers.doEx('map a x'); helpers.doKeys('a'); helpers.assertCursorAt(0, 0); eq('bc', cm.getValue()); }, { value: 'abc' }); testVim('ex_unmap_key2key', function(cm, vim, helpers) { helpers.doEx('unmap a'); helpers.doKeys('a'); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'abc' }); testVim('ex_unmap_key2key_does_not_remove_default', function(cm, vim, helpers) { expectFail(function() { helpers.doEx('unmap a'); }); helpers.doKeys('a'); eq('vim-insert', cm.getOption('keyMap')); }, { value: 'abc' }); testVim('ex_map_key2key_to_colon', function(cm, vim, helpers) { helpers.doEx('map ; :'); var dialogOpened = false; cm.openDialog = function() { dialogOpened = true; } helpers.doKeys(';'); eq(dialogOpened, true); }); testVim('ex_map_ex2key:', function(cm, vim, helpers) { helpers.doEx('map :del x'); helpers.doEx('del'); helpers.assertCursorAt(0, 0); eq('bc', cm.getValue()); }, { value: 'abc' }); testVim('ex_map_ex2ex', function(cm, vim, helpers) { helpers.doEx('map :del :w'); var tmp = CodeMirror.commands.save; var written = false; var actualCm; CodeMirror.commands.save = function(cm) { written = true; actualCm = cm; }; helpers.doEx('del'); CodeMirror.commands.save = tmp; eq(written, true); eq(actualCm, cm); }); testVim('ex_map_key2ex', function(cm, vim, helpers) { helpers.doEx('map a :w'); var tmp = CodeMirror.commands.save; var written = false; var actualCm; CodeMirror.commands.save = function(cm) { written = true; actualCm = cm; }; helpers.doKeys('a'); CodeMirror.commands.save = tmp; eq(written, true); eq(actualCm, cm); }); testVim('ex_map_key2key_visual_api', function(cm, vim, helpers) { CodeMirror.Vim.map('b', ':w', 'visual'); var tmp = CodeMirror.commands.save; var written = false; var actualCm; CodeMirror.commands.save = function(cm) { written = true; actualCm = cm; }; // Mapping should not work in normal mode. helpers.doKeys('b'); eq(written, false); // Mapping should work in visual mode. helpers.doKeys('v', 'b'); eq(written, true); eq(actualCm, cm); CodeMirror.commands.save = tmp; }); testVim('ex_imap', function(cm, vim, helpers) { CodeMirror.Vim.map('jk', '', 'insert'); helpers.doKeys('i'); is(vim.insertMode); helpers.doKeys('j', 'k'); is(!vim.insertMode); cm.setCursor(0, 1); CodeMirror.Vim.map('jj', '', 'insert'); helpers.doKeys('', '2', 'j', 'l', 'c'); var replacement = fillArray('fo', 3); cm.replaceSelections(replacement); eq('1fo4\n5fo8\nafodefg', cm.getValue()); helpers.doKeys('j', 'j'); cm.setCursor(0, 0); helpers.doKeys('.'); eq('foo4\nfoo8\nfoodefg', cm.getValue()); }, { value: '1234\n5678\nabcdefg' }); testVim('ex_unmap_api', function(cm, vim, helpers) { CodeMirror.Vim.map('', 'gg', 'normal'); is(CodeMirror.Vim.handleKey(cm, "", "normal"), "Alt-X key is mapped"); CodeMirror.Vim.unmap("", "normal"); is(!CodeMirror.Vim.handleKey(cm, "", "normal"), "Alt-X key is unmapped"); }); // Testing registration of functions as ex-commands and mapping to -keys testVim('ex_api_test', function(cm, vim, helpers) { var res=false; var val='from'; CodeMirror.Vim.defineEx('extest','ext',function(cm,params){ if(params.args)val=params.args[0]; else res=true; }); helpers.doEx(':ext to'); eq(val,'to','Defining ex-command failed'); CodeMirror.Vim.map('',':ext'); helpers.doKeys('',''); is(res,'Mapping to key failed'); }); // For now, this test needs to be last because it messes up : for future tests. testVim('ex_map_key2key_from_colon', function(cm, vim, helpers) { helpers.doEx('map : x'); helpers.doKeys(':'); helpers.assertCursorAt(0, 0); eq('bc', cm.getValue()); }, { value: 'abc' }); // Test event handlers testVim('beforeSelectionChange', function(cm, vim, helpers) { cm.setCursor(0, 100); eqPos(cm.getCursor('head'), cm.getCursor('anchor')); }, { value: 'abc' }); }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/layer/cursor.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("../lib/dom"); var isIE8; var Cursor = function(parentEl) { this.element = dom.createElement("div"); this.element.className = "ace_layer ace_cursor-layer"; parentEl.appendChild(this.element); if (isIE8 === undefined) isIE8 = !("opacity" in this.element.style); this.isVisible = false; this.isBlinking = true; this.blinkInterval = 1000; this.smoothBlinking = false; this.cursors = []; this.cursor = this.addCursor(); dom.addCssClass(this.element, "ace_hidden-cursors"); this.$updateCursors = (isIE8 ? this.$updateVisibility : this.$updateOpacity).bind(this); }; (function() { this.$updateVisibility = function(val) { var cursors = this.cursors; for (var i = cursors.length; i--; ) cursors[i].style.visibility = val ? "" : "hidden"; }; this.$updateOpacity = function(val) { var cursors = this.cursors; for (var i = cursors.length; i--; ) cursors[i].style.opacity = val ? "" : "0"; }; this.$padding = 0; this.setPadding = function(padding) { this.$padding = padding; }; this.setSession = function(session) { this.session = session; }; this.setBlinking = function(blinking) { if (blinking != this.isBlinking){ this.isBlinking = blinking; this.restartTimer(); } }; this.setBlinkInterval = function(blinkInterval) { if (blinkInterval != this.blinkInterval){ this.blinkInterval = blinkInterval; this.restartTimer(); } }; this.setSmoothBlinking = function(smoothBlinking) { if (smoothBlinking != this.smoothBlinking && !isIE8) { this.smoothBlinking = smoothBlinking; dom.setCssClass(this.element, "ace_smooth-blinking", smoothBlinking); this.$updateCursors(true); this.$updateCursors = (this.$updateOpacity).bind(this); this.restartTimer(); } }; this.addCursor = function() { var el = dom.createElement("div"); el.className = "ace_cursor"; this.element.appendChild(el); this.cursors.push(el); return el; }; this.removeCursor = function() { if (this.cursors.length > 1) { var el = this.cursors.pop(); el.parentNode.removeChild(el); return el; } }; this.hideCursor = function() { this.isVisible = false; dom.addCssClass(this.element, "ace_hidden-cursors"); this.restartTimer(); }; this.showCursor = function() { this.isVisible = true; dom.removeCssClass(this.element, "ace_hidden-cursors"); this.restartTimer(); }; this.restartTimer = function() { var update = this.$updateCursors; clearInterval(this.intervalId); clearTimeout(this.timeoutId); if (this.smoothBlinking) { dom.removeCssClass(this.element, "ace_smooth-blinking"); } update(true); if (!this.isBlinking || !this.blinkInterval || !this.isVisible) return; if (this.smoothBlinking) { setTimeout(function(){ dom.addCssClass(this.element, "ace_smooth-blinking"); }.bind(this)); } var blink = function(){ this.timeoutId = setTimeout(function() { update(false); }, 0.6 * this.blinkInterval); }.bind(this); this.intervalId = setInterval(function() { update(true); blink(); }, this.blinkInterval); blink(); }; this.getPixelPosition = function(position, onScreen) { if (!this.config || !this.session) return {left : 0, top : 0}; if (!position) position = this.session.selection.getCursor(); var pos = this.session.documentToScreenPosition(position); var cursorLeft = this.$padding + (this.session.$bidiHandler.isBidiRow(pos.row, position.row) ? this.session.$bidiHandler.getPosLeft(pos.column) : pos.column * this.config.characterWidth); var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * this.config.lineHeight; return {left : cursorLeft, top : cursorTop}; }; this.update = function(config) { this.config = config; var selections = this.session.$selectionMarkers; var i = 0, cursorIndex = 0; if (selections === undefined || selections.length === 0){ selections = [{cursor: null}]; } for (var i = 0, n = selections.length; i < n; i++) { var pixelPos = this.getPixelPosition(selections[i].cursor, true); if ((pixelPos.top > config.height + config.offset || pixelPos.top < 0) && i > 1) { continue; } var style = (this.cursors[cursorIndex++] || this.addCursor()).style; if (!this.drawCursor) { style.left = pixelPos.left + "px"; style.top = pixelPos.top + "px"; style.width = config.characterWidth + "px"; style.height = config.lineHeight + "px"; } else { this.drawCursor(style, pixelPos, config, selections[i], this.session); } } while (this.cursors.length > cursorIndex) this.removeCursor(); var overwrite = this.session.getOverwrite(); this.$setOverwrite(overwrite); // cache for textarea and gutter highlight this.$pixelPos = pixelPos; this.restartTimer(); }; this.drawCursor = null; this.$setOverwrite = function(overwrite) { if (overwrite != this.overwrite) { this.overwrite = overwrite; if (overwrite) dom.addCssClass(this.element, "ace_overwrite-cursors"); else dom.removeCssClass(this.element, "ace_overwrite-cursors"); } }; this.destroy = function() { clearInterval(this.intervalId); clearTimeout(this.timeoutId); }; }).call(Cursor.prototype); exports.Cursor = Cursor; }); ================================================ FILE: lib/ace/layer/font_metrics.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { var oop = require("../lib/oop"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var useragent = require("../lib/useragent"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var CHAR_COUNT = 0; var FontMetrics = exports.FontMetrics = function(parentEl) { this.el = dom.createElement("div"); this.$setMeasureNodeStyles(this.el.style, true); this.$main = dom.createElement("div"); this.$setMeasureNodeStyles(this.$main.style); this.$measureNode = dom.createElement("div"); this.$setMeasureNodeStyles(this.$measureNode.style); this.el.appendChild(this.$main); this.el.appendChild(this.$measureNode); parentEl.appendChild(this.el); if (!CHAR_COUNT) this.$testFractionalRect(); this.$measureNode.innerHTML = lang.stringRepeat("X", CHAR_COUNT); this.$characterSize = {width: 0, height: 0}; this.checkForSizeChanges(); }; (function() { oop.implement(this, EventEmitter); this.$characterSize = {width: 0, height: 0}; this.$testFractionalRect = function() { var el = dom.createElement("div"); this.$setMeasureNodeStyles(el.style); el.style.width = "0.2px"; document.documentElement.appendChild(el); var w = el.getBoundingClientRect().width; if (w > 0 && w < 1) CHAR_COUNT = 50; else CHAR_COUNT = 100; el.parentNode.removeChild(el); }; this.$setMeasureNodeStyles = function(style, isRoot) { style.width = style.height = "auto"; style.left = style.top = "0px"; style.visibility = "hidden"; style.position = "absolute"; style.whiteSpace = "pre"; if (useragent.isIE < 8) { style["font-family"] = "inherit"; } else { style.font = "inherit"; } style.overflow = isRoot ? "hidden" : "visible"; }; this.checkForSizeChanges = function() { var size = this.$measureSizes(); if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) { this.$measureNode.style.fontWeight = "bold"; var boldSize = this.$measureSizes(); this.$measureNode.style.fontWeight = ""; this.$characterSize = size; this.charSizes = Object.create(null); this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height; this._emit("changeCharacterSize", {data: size}); } }; this.$pollSizeChanges = function() { if (this.$pollSizeChangesTimer) return this.$pollSizeChangesTimer; var self = this; return this.$pollSizeChangesTimer = setInterval(function() { self.checkForSizeChanges(); }, 500); }; this.setPolling = function(val) { if (val) { this.$pollSizeChanges(); } else if (this.$pollSizeChangesTimer) { clearInterval(this.$pollSizeChangesTimer); this.$pollSizeChangesTimer = 0; } }; this.$measureSizes = function() { if (CHAR_COUNT === 50) { var rect = null; try { rect = this.$measureNode.getBoundingClientRect(); } catch(e) { rect = {width: 0, height:0 }; } var size = { height: rect.height, width: rect.width / CHAR_COUNT }; } else { var size = { height: this.$measureNode.clientHeight, width: this.$measureNode.clientWidth / CHAR_COUNT }; } // Size and width can be null if the editor is not visible or // detached from the document if (size.width === 0 || size.height === 0) return null; return size; }; this.$measureCharWidth = function(ch) { this.$main.innerHTML = lang.stringRepeat(ch, CHAR_COUNT); var rect = this.$main.getBoundingClientRect(); return rect.width / CHAR_COUNT; }; this.getCharacterWidth = function(ch) { var w = this.charSizes[ch]; if (w === undefined) { w = this.charSizes[ch] = this.$measureCharWidth(ch) / this.$characterSize.width; } return w; }; this.destroy = function() { clearInterval(this.$pollSizeChangesTimer); if (this.el && this.el.parentNode) this.el.parentNode.removeChild(this.el); }; }).call(FontMetrics.prototype); }); ================================================ FILE: lib/ace/layer/gutter.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var dom = require("../lib/dom"); var oop = require("../lib/oop"); var lang = require("../lib/lang"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var Gutter = function(parentEl) { this.element = dom.createElement("div"); this.element.className = "ace_layer ace_gutter-layer"; parentEl.appendChild(this.element); this.setShowFoldWidgets(this.$showFoldWidgets); this.gutterWidth = 0; this.$annotations = []; this.$updateAnnotations = this.$updateAnnotations.bind(this); this.$cells = []; }; (function() { oop.implement(this, EventEmitter); this.setSession = function(session) { if (this.session) this.session.removeEventListener("change", this.$updateAnnotations); this.session = session; if (session) session.on("change", this.$updateAnnotations); }; this.addGutterDecoration = function(row, className){ if (window.console) console.warn && console.warn("deprecated use session.addGutterDecoration"); this.session.addGutterDecoration(row, className); }; this.removeGutterDecoration = function(row, className){ if (window.console) console.warn && console.warn("deprecated use session.removeGutterDecoration"); this.session.removeGutterDecoration(row, className); }; this.setAnnotations = function(annotations) { // iterate over sparse array this.$annotations = []; for (var i = 0; i < annotations.length; i++) { var annotation = annotations[i]; var row = annotation.row; var rowInfo = this.$annotations[row]; if (!rowInfo) rowInfo = this.$annotations[row] = {text: []}; var annoText = annotation.text; annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || ""; if (rowInfo.text.indexOf(annoText) === -1) rowInfo.text.push(annoText); var type = annotation.type; if (type == "error") rowInfo.className = " ace_error"; else if (type == "warning" && rowInfo.className != " ace_error") rowInfo.className = " ace_warning"; else if (type == "info" && (!rowInfo.className)) rowInfo.className = " ace_info"; } }; this.$updateAnnotations = function (delta) { if (!this.$annotations.length) return; var firstRow = delta.start.row; var len = delta.end.row - firstRow; if (len === 0) { // do nothing } else if (delta.action == 'remove') { this.$annotations.splice(firstRow, len + 1, null); } else { var args = new Array(len + 1); args.unshift(firstRow, 1); this.$annotations.splice.apply(this.$annotations, args); } }; this.update = function(config) { var session = this.session; var firstRow = config.firstRow; var lastRow = Math.min(config.lastRow + config.gutterOffset, // needed to compensate for hor scollbar session.getLength() - 1); var fold = session.getNextFoldLine(firstRow); var foldStart = fold ? fold.start.row : Infinity; var foldWidgets = this.$showFoldWidgets && session.foldWidgets; var breakpoints = session.$breakpoints; var decorations = session.$decorations; var firstLineNumber = session.$firstLineNumber; var lastLineNumber = 0; var gutterRenderer = session.gutterRenderer || this.$renderer; var cell = null; var index = -1; var row = firstRow; while (true) { if (row > foldStart) { row = fold.end.row + 1; fold = session.getNextFoldLine(row, fold); foldStart = fold ? fold.start.row : Infinity; } if (row > lastRow) { while (this.$cells.length > index + 1) { cell = this.$cells.pop(); this.element.removeChild(cell.element); } break; } cell = this.$cells[++index]; if (!cell) { cell = {element: null, textNode: null, foldWidget: null}; cell.element = dom.createElement("div"); cell.textNode = document.createTextNode(''); cell.element.appendChild(cell.textNode); this.element.appendChild(cell.element); this.$cells[index] = cell; } var className = "ace_gutter-cell "; if (breakpoints[row]) className += breakpoints[row]; if (decorations[row]) className += decorations[row]; if (this.$annotations[row]) className += this.$annotations[row].className; if (cell.element.className != className) cell.element.className = className; var height = session.getRowLength(row) * config.lineHeight + "px"; if (height != cell.element.style.height) cell.element.style.height = height; if (foldWidgets) { var c = foldWidgets[row]; // check if cached value is invalidated and we need to recompute if (c == null) c = foldWidgets[row] = session.getFoldWidget(row); } if (c) { if (!cell.foldWidget) { cell.foldWidget = dom.createElement("span"); cell.element.appendChild(cell.foldWidget); } var className = "ace_fold-widget ace_" + c; if (c == "start" && row == foldStart && row < fold.end.row) className += " ace_closed"; else className += " ace_open"; if (cell.foldWidget.className != className) cell.foldWidget.className = className; var height = config.lineHeight + "px"; if (cell.foldWidget.style.height != height) cell.foldWidget.style.height = height; } else { if (cell.foldWidget) { cell.element.removeChild(cell.foldWidget); cell.foldWidget = null; } } var text = lastLineNumber = gutterRenderer ? gutterRenderer.getText(session, row) : row + firstLineNumber; if (text !== cell.textNode.data) cell.textNode.data = text; row++; } this.element.style.height = config.minHeight + "px"; if (this.$fixedWidth || session.$useWrapMode) lastLineNumber = session.getLength() + firstLineNumber; var gutterWidth = gutterRenderer ? gutterRenderer.getWidth(session, lastLineNumber, config) : lastLineNumber.toString().length * config.characterWidth; var padding = this.$padding || this.$computePadding(); gutterWidth += padding.left + padding.right; if (gutterWidth !== this.gutterWidth && !isNaN(gutterWidth)) { this.gutterWidth = gutterWidth; this.element.style.width = Math.ceil(this.gutterWidth) + "px"; this._emit("changeGutterWidth", gutterWidth); } }; this.$fixedWidth = false; this.$showLineNumbers = true; this.$renderer = ""; this.setShowLineNumbers = function(show) { this.$renderer = !show && { getWidth: function() {return "";}, getText: function() {return "";} }; }; this.getShowLineNumbers = function() { return this.$showLineNumbers; }; this.$showFoldWidgets = true; this.setShowFoldWidgets = function(show) { if (show) dom.addCssClass(this.element, "ace_folding-enabled"); else dom.removeCssClass(this.element, "ace_folding-enabled"); this.$showFoldWidgets = show; this.$padding = null; }; this.getShowFoldWidgets = function() { return this.$showFoldWidgets; }; this.$computePadding = function() { if (!this.element.firstChild) return {left: 0, right: 0}; var style = dom.computedStyle(this.element.firstChild); this.$padding = {}; this.$padding.left = parseInt(style.paddingLeft) + 1 || 0; this.$padding.right = parseInt(style.paddingRight) || 0; return this.$padding; }; this.getRegion = function(point) { var padding = this.$padding || this.$computePadding(); var rect = this.element.getBoundingClientRect(); if (point.x < padding.left + rect.left) return "markers"; if (this.$showFoldWidgets && point.x > rect.right - padding.right) return "foldWidgets"; }; }).call(Gutter.prototype); exports.Gutter = Gutter; }); ================================================ FILE: lib/ace/layer/marker.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Range = require("../range").Range; var dom = require("../lib/dom"); var Marker = function(parentEl) { this.element = dom.createElement("div"); this.element.className = "ace_layer ace_marker-layer"; parentEl.appendChild(this.element); }; (function() { this.$padding = 0; this.setPadding = function(padding) { this.$padding = padding; }; this.setSession = function(session) { this.session = session; }; this.setMarkers = function(markers) { this.markers = markers; }; this.update = function(config) { if (!config) return; this.config = config; var html = []; for (var key in this.markers) { var marker = this.markers[key]; if (!marker.range) { marker.update(html, this, this.session, config); continue; } var range = marker.range.clipRows(config.firstRow, config.lastRow); if (range.isEmpty()) continue; range = range.toScreenRange(this.session); if (marker.renderer) { var top = this.$getTop(range.start.row, config); var left = this.$padding + (this.session.$bidiHandler.isBidiRow(range.start.row) ? this.session.$bidiHandler.getPosLeft(range.start.column) : range.start.column * config.characterWidth); marker.renderer(html, range, left, top, config); } else if (marker.type == "fullLine") { this.drawFullLineMarker(html, range, marker.clazz, config); } else if (marker.type == "screenLine") { this.drawScreenLineMarker(html, range, marker.clazz, config); } else if (range.isMultiLine()) { if (marker.type == "text") this.drawTextMarker(html, range, marker.clazz, config); else this.drawMultiLineMarker(html, range, marker.clazz, config); } else { if (this.session.$bidiHandler.isBidiRow(range.start.row)) { this.drawBidiSingleLineMarker(html, range, marker.clazz + " ace_start" + " ace_br15", config); } else { this.drawSingleLineMarker(html, range, marker.clazz + " ace_start" + " ace_br15", config); } } } this.element.innerHTML = html.join(""); }; this.$getTop = function(row, layerConfig) { return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight; }; function getBorderClass(tl, tr, br, bl) { return (tl ? 1 : 0) | (tr ? 2 : 0) | (br ? 4 : 0) | (bl ? 8 : 0); } // Draws a marker, which spans a range of text on multiple lines this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig, extraStyle) { var session = this.session; var start = range.start.row; var end = range.end.row; var row = start; var prev = 0; var curr = 0; var next = session.getScreenLastRowColumn(row); var clazzModified = null; var lineRange = new Range(row, range.start.column, row, curr); for (; row <= end; row++) { lineRange.start.row = lineRange.end.row = row; lineRange.start.column = row == start ? range.start.column : session.getRowWrapIndent(row); lineRange.end.column = next; prev = curr; curr = next; next = row + 1 < end ? session.getScreenLastRowColumn(row + 1) : row == end ? 0 : range.end.column; clazzModified = clazz + (row == start ? " ace_start" : "") + " ace_br" + getBorderClass(row == start || row == start + 1 && range.start.column, prev < curr, curr > next, row == end); if (this.session.$bidiHandler.isBidiRow(row)) { this.drawBidiSingleLineMarker(stringBuilder, lineRange, clazzModified, layerConfig, row == end ? 0 : 1, extraStyle); } else { this.drawSingleLineMarker(stringBuilder, lineRange, clazzModified, layerConfig, row == end ? 0 : 1, extraStyle); } } }; // Draws a multi line marker, where lines span the full width this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { // from selection start to the end of the line var padding = this.$padding; var height, top, left; extraStyle = extraStyle || ""; if (this.session.$bidiHandler.isBidiRow(range.start.row)) { var range1 = range.clone(); range1.end.row = range1.start.row; range1.end.column = this.session.getLine(range1.start.row).length; this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br1 ace_start", config, null, extraStyle); } else { height = config.lineHeight; top = this.$getTop(range.start.row, config); left = padding + range.start.column * config.characterWidth; stringBuilder.push( "
    " ); } // from start of the last line to the selection end if (this.session.$bidiHandler.isBidiRow(range.end.row)) { var range1 = range.clone(); range1.start.row = range1.end.row; range1.start.column = 0; this.drawBidiSingleLineMarker(stringBuilder, range1, clazz + " ace_br12", config, null, extraStyle); } else { var width = range.end.column * config.characterWidth; height = config.lineHeight; top = this.$getTop(range.end.row, config); stringBuilder.push( "
    " ); } // all the complete lines height = (range.end.row - range.start.row - 1) * config.lineHeight; if (height <= 0) return; top = this.$getTop(range.start.row + 1, config); var radiusClass = (range.start.column ? 1 : 0) | (range.end.column ? 0 : 8); stringBuilder.push( "
    " ); }; // Draws a marker which covers part or whole width of a single screen line this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) { var height = config.lineHeight; var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth; var top = this.$getTop(range.start.row, config); var left = this.$padding + range.start.column * config.characterWidth; stringBuilder.push( "
    " ); }; // Draws Bidi marker which covers part or whole width of a single screen line this.drawBidiSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength, extraStyle) { var height = config.lineHeight, top = this.$getTop(range.start.row, config), padding = this.$padding; var selections = this.session.$bidiHandler.getSelections(range.start.column, range.end.column); selections.forEach(function(selection) { stringBuilder.push( "
    " ); }); }; this.drawFullLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { var top = this.$getTop(range.start.row, config); var height = config.lineHeight; if (range.start.row != range.end.row) height += this.$getTop(range.end.row, config) - top; stringBuilder.push( "
    " ); }; this.drawScreenLineMarker = function(stringBuilder, range, clazz, config, extraStyle) { var top = this.$getTop(range.start.row, config); var height = config.lineHeight; stringBuilder.push( "
    " ); }; }).call(Marker.prototype); exports.Marker = Marker; }); ================================================ FILE: lib/ace/layer/text.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var dom = require("../lib/dom"); var lang = require("../lib/lang"); var useragent = require("../lib/useragent"); var EventEmitter = require("../lib/event_emitter").EventEmitter; var Text = function(parentEl) { this.element = dom.createElement("div"); this.element.className = "ace_layer ace_text-layer"; parentEl.appendChild(this.element); this.$updateEolChar = this.$updateEolChar.bind(this); }; (function() { oop.implement(this, EventEmitter); this.EOF_CHAR = "\xB6"; this.EOL_CHAR_LF = "\xAC"; this.EOL_CHAR_CRLF = "\xa4"; this.EOL_CHAR = this.EOL_CHAR_LF; this.TAB_CHAR = "\u2014"; //"\u21E5"; this.SPACE_CHAR = "\xB7"; this.$padding = 0; this.$updateEolChar = function() { var EOL_CHAR = this.session.doc.getNewLineCharacter() == "\n" ? this.EOL_CHAR_LF : this.EOL_CHAR_CRLF; if (this.EOL_CHAR != EOL_CHAR) { this.EOL_CHAR = EOL_CHAR; return true; } }; this.setPadding = function(padding) { this.$padding = padding; this.element.style.padding = "0 " + padding + "px"; }; this.getLineHeight = function() { return this.$fontMetrics.$characterSize.height || 0; }; this.getCharacterWidth = function() { return this.$fontMetrics.$characterSize.width || 0; }; this.$setFontMetrics = function(measure) { this.$fontMetrics = measure; this.$fontMetrics.on("changeCharacterSize", function(e) { this._signal("changeCharacterSize", e); }.bind(this)); this.$pollSizeChanges(); }; this.checkForSizeChanges = function() { this.$fontMetrics.checkForSizeChanges(); }; this.$pollSizeChanges = function() { return this.$pollSizeChangesTimer = this.$fontMetrics.$pollSizeChanges(); }; this.setSession = function(session) { this.session = session; if (session) this.$computeTabString(); }; this.showInvisibles = false; this.setShowInvisibles = function(showInvisibles) { if (this.showInvisibles == showInvisibles) return false; this.showInvisibles = showInvisibles; this.$computeTabString(); return true; }; this.displayIndentGuides = true; this.setDisplayIndentGuides = function(display) { if (this.displayIndentGuides == display) return false; this.displayIndentGuides = display; this.$computeTabString(); return true; }; this.$tabStrings = []; this.onChangeTabSize = this.$computeTabString = function() { var tabSize = this.session.getTabSize(); this.tabSize = tabSize; var tabStr = this.$tabStrings = [0]; for (var i = 1; i < tabSize + 1; i++) { if (this.showInvisibles) { tabStr.push("" + lang.stringRepeat(this.TAB_CHAR, i) + ""); } else { tabStr.push(lang.stringRepeat(" ", i)); } } if (this.displayIndentGuides) { this.$indentGuideRe = /\s\S| \t|\t |\s$/; var className = "ace_indent-guide"; var spaceClass = ""; var tabClass = ""; if (this.showInvisibles) { className += " ace_invisible"; spaceClass = " ace_invisible_space"; tabClass = " ace_invisible_tab"; var spaceContent = lang.stringRepeat(this.SPACE_CHAR, this.tabSize); var tabContent = lang.stringRepeat(this.TAB_CHAR, this.tabSize); } else{ var spaceContent = lang.stringRepeat(" ", this.tabSize); var tabContent = spaceContent; } this.$tabStrings[" "] = "" + spaceContent + ""; this.$tabStrings["\t"] = "" + tabContent + ""; } }; this.updateLines = function(config, firstRow, lastRow) { // Due to wrap line changes there can be new lines if e.g. // the line to updated wrapped in the meantime. if (this.config.lastRow != config.lastRow || this.config.firstRow != config.firstRow) { this.scrollLines(config); } this.config = config; var first = Math.max(firstRow, config.firstRow); var last = Math.min(lastRow, config.lastRow); var lineElements = this.element.childNodes; var lineElementsIdx = 0; for (var row = config.firstRow; row < first; row++) { var foldLine = this.session.getFoldLine(row); if (foldLine) { if (foldLine.containsRow(first)) { first = foldLine.start.row; break; } else { row = foldLine.end.row; } } lineElementsIdx ++; } var row = first; var foldLine = this.session.getNextFoldLine(row); var foldStart = foldLine ? foldLine.start.row : Infinity; while (true) { if (row > foldStart) { row = foldLine.end.row+1; foldLine = this.session.getNextFoldLine(row, foldLine); foldStart = foldLine ? foldLine.start.row :Infinity; } if (row > last) break; var lineElement = lineElements[lineElementsIdx++]; if (lineElement) { var html = []; this.$renderLine( html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false ); lineElement.style.height = config.lineHeight * this.session.getRowLength(row) + "px"; lineElement.innerHTML = html.join(""); } row++; } }; this.scrollLines = function(config) { var oldConfig = this.config; this.config = config; if (!oldConfig || oldConfig.lastRow < config.firstRow) return this.update(config); if (config.lastRow < oldConfig.firstRow) return this.update(config); var el = this.element; if (oldConfig.firstRow < config.firstRow) for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--) el.removeChild(el.firstChild); if (oldConfig.lastRow > config.lastRow) for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--) el.removeChild(el.lastChild); if (config.firstRow < oldConfig.firstRow) { var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1); if (el.firstChild) el.insertBefore(fragment, el.firstChild); else el.appendChild(fragment); } if (config.lastRow > oldConfig.lastRow) { var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow); el.appendChild(fragment); } }; this.$renderLinesFragment = function(config, firstRow, lastRow) { var fragment = this.element.ownerDocument.createDocumentFragment(); var row = firstRow; var foldLine = this.session.getNextFoldLine(row); var foldStart = foldLine ? foldLine.start.row : Infinity; while (true) { if (row > foldStart) { row = foldLine.end.row+1; foldLine = this.session.getNextFoldLine(row, foldLine); foldStart = foldLine ? foldLine.start.row : Infinity; } if (row > lastRow) break; var container = dom.createElement("div"); var html = []; // Get the tokens per line as there might be some lines in between // beeing folded. this.$renderLine(html, row, false, row == foldStart ? foldLine : false); // don't use setInnerHtml since we are working with an empty DIV container.innerHTML = html.join(""); if (this.$useLineGroups()) { container.className = 'ace_line_group'; fragment.appendChild(container); container.style.height = config.lineHeight * this.session.getRowLength(row) + "px"; } else { while(container.firstChild) fragment.appendChild(container.firstChild); } row++; } return fragment; }; this.update = function(config) { this.config = config; var html = []; var firstRow = config.firstRow, lastRow = config.lastRow; var row = firstRow; var foldLine = this.session.getNextFoldLine(row); var foldStart = foldLine ? foldLine.start.row : Infinity; while (true) { if (row > foldStart) { row = foldLine.end.row+1; foldLine = this.session.getNextFoldLine(row, foldLine); foldStart = foldLine ? foldLine.start.row :Infinity; } if (row > lastRow) break; if (this.$useLineGroups()) html.push("
    "); this.$renderLine(html, row, false, row == foldStart ? foldLine : false); if (this.$useLineGroups()) html.push("
    "); // end the line group row++; } this.element.innerHTML = html.join(""); }; this.$textToken = { "text": true, "rparen": true, "lparen": true }; this.$renderToken = function(stringBuilder, screenColumn, token, value) { var self = this; var replaceReg = /\t|&|<|>|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF\uFFF9-\uFFFC])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF]/g; var replaceFunc = function(c, a, b, tabIdx, idx4) { if (a) { return self.showInvisibles ? "" + lang.stringRepeat(self.SPACE_CHAR, c.length) + "" : c; } else if (c == "&") { return "&"; } else if (c == "<") { return "<"; } else if (c == ">") { // normally escaping this is not needed, but xml documents throw error when setting innerHTML to ]]> return ">"; } else if (c == "\t") { var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx); screenColumn += tabSize - 1; return self.$tabStrings[tabSize]; } else if (c == "\u3000") { // U+3000 is both invisible AND full-width, so must be handled uniquely var classToUse = self.showInvisibles ? "ace_cjk ace_invisible ace_invisible_space" : "ace_cjk"; var space = self.showInvisibles ? self.SPACE_CHAR : ""; screenColumn += 1; return "" + space + ""; } else if (b) { return "" + self.SPACE_CHAR + ""; } else { screenColumn += 1; return "" + c + ""; } }; var output = value.replace(replaceReg, replaceFunc); if (!this.$textToken[token.type]) { var classes = "ace_" + token.type.replace(/\./g, " ace_"); var style = ""; if (token.type == "fold") style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' "; stringBuilder.push("", output, ""); } else { stringBuilder.push(output); } return screenColumn + value.length; }; this.renderIndentGuide = function(stringBuilder, value, max) { var cols = value.search(this.$indentGuideRe); if (cols <= 0 || cols >= max) return value; if (value[0] == " ") { cols -= cols % this.tabSize; stringBuilder.push(lang.stringRepeat(this.$tabStrings[" "], cols/this.tabSize)); return value.substr(cols); } else if (value[0] == "\t") { stringBuilder.push(lang.stringRepeat(this.$tabStrings["\t"], cols)); return value.substr(cols); } return value; }; this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) { var chars = 0; var split = 0; var splitChars = splits[0]; var screenColumn = 0; for (var i = 0; i < tokens.length; i++) { var token = tokens[i]; var value = token.value; if (i == 0 && this.displayIndentGuides) { chars = value.length; value = this.renderIndentGuide(stringBuilder, value, splitChars); if (!value) continue; chars -= value.length; } if (chars + value.length < splitChars) { screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); chars += value.length; } else { while (chars + value.length >= splitChars) { screenColumn = this.$renderToken( stringBuilder, screenColumn, token, value.substring(0, splitChars - chars) ); value = value.substring(splitChars - chars); chars = splitChars; if (!onlyContents) { stringBuilder.push("
    ", "
    " ); } stringBuilder.push(lang.stringRepeat("\xa0", splits.indent)); split ++; screenColumn = 0; splitChars = splits[split] || Number.MAX_VALUE; } if (value.length != 0) { chars += value.length; screenColumn = this.$renderToken( stringBuilder, screenColumn, token, value ); } } } }; this.$renderSimpleLine = function(stringBuilder, tokens) { var screenColumn = 0; var token = tokens[0]; var value = token.value; if (this.displayIndentGuides) value = this.renderIndentGuide(stringBuilder, value); if (value) screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); for (var i = 1; i < tokens.length; i++) { token = tokens[i]; value = token.value; screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value); } }; // row is either first row of foldline or not in fold this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) { if (!foldLine && foldLine != false) foldLine = this.session.getFoldLine(row); if (foldLine) var tokens = this.$getFoldLineTokens(row, foldLine); else var tokens = this.session.getTokens(row); if (!onlyContents) { stringBuilder.push( "
    " ); } if (tokens.length) { var splits = this.session.getRowSplitData(row); if (splits && splits.length) this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents); else this.$renderSimpleLine(stringBuilder, tokens); } if (this.showInvisibles) { if (foldLine) row = foldLine.end.row; stringBuilder.push( "", row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR, "" ); } if (!onlyContents) stringBuilder.push("
    "); }; this.$getFoldLineTokens = function(row, foldLine) { var session = this.session; var renderTokens = []; function addTokens(tokens, from, to) { var idx = 0, col = 0; while ((col + tokens[idx].value.length) < from) { col += tokens[idx].value.length; idx++; if (idx == tokens.length) return; } if (col != from) { var value = tokens[idx].value.substring(from - col); // Check if the token value is longer then the from...to spacing. if (value.length > (to - from)) value = value.substring(0, to - from); renderTokens.push({ type: tokens[idx].type, value: value }); col = from + value.length; idx += 1; } while (col < to && idx < tokens.length) { var value = tokens[idx].value; if (value.length + col > to) { renderTokens.push({ type: tokens[idx].type, value: value.substring(0, to - col) }); } else renderTokens.push(tokens[idx]); col += value.length; idx += 1; } } var tokens = session.getTokens(row); foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { if (placeholder != null) { renderTokens.push({ type: "fold", value: placeholder }); } else { if (isNewRow) tokens = session.getTokens(row); if (tokens.length) addTokens(tokens, lastColumn, column); } }, foldLine.end.row, this.session.getLine(foldLine.end.row).length); return renderTokens; }; this.$useLineGroups = function() { // For the updateLines function to work correctly, it's important that the // child nodes of this.element correspond on a 1-to-1 basis to rows in the // document (as distinct from lines on the screen). For sessions that are // wrapped, this means we need to add a layer to the node hierarchy (tagged // with the class name ace_line_group). return this.session.getUseWrapMode(); }; this.destroy = function() { clearInterval(this.$pollSizeChangesTimer); if (this.$measureNode) this.$measureNode.parentNode.removeChild(this.$measureNode); delete this.$measureNode; }; }).call(Text.prototype); exports.Text = Text; }); ================================================ FILE: lib/ace/layer/text_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("../test/mockdom"); } define(function(require, exports, module) { "use strict"; var assert = require("../test/assertions"); var EditSession = require("../edit_session").EditSession; var TextLayer = require("./text").Text; var JavaScriptMode = require("../mode/javascript").Mode; module.exports = { setUp: function(next) { this.session = new EditSession(""); this.session.setMode(new JavaScriptMode()); this.textLayer = new TextLayer(document.createElement("div")); this.textLayer.setSession(this.session); this.textLayer.config = { characterWidth: 10, lineHeight: 20 }; next(); }, "test: render line with hard tabs should render the same as lines with soft tabs" : function() { this.session.setValue("a\ta\ta\t\na a a \n"); this.textLayer.$computeTabString(); // row with hard tabs var stringBuilder = []; this.textLayer.$renderLine(stringBuilder, 0); // row with soft tabs var stringBuilder2 = []; this.textLayer.$renderLine(stringBuilder2, 1); assert.equal(stringBuilder.join(""), stringBuilder2.join("")); }, "test rendering width of ideographic space (U+3000)" : function() { this.session.setValue("\u3000"); var stringBuilder = []; this.textLayer.$renderLine(stringBuilder, 0, true); assert.equal(stringBuilder.join(""), ""); this.textLayer.setShowInvisibles(true); var stringBuilder = []; this.textLayer.$renderLine(stringBuilder, 0, true); assert.equal( stringBuilder.join(""), "" + this.textLayer.SPACE_CHAR + "" + "\xB6" ); }, "test rendering of indent guides" : function() { var textLayer = this.textLayer; var EOL = "" + textLayer.EOL_CHAR + ""; var SPACE = function(i) {return Array(i+1).join(" ");}; var DOT = function(i) {return Array(i+1).join(textLayer.SPACE_CHAR);}; var TAB = function(i) {return Array(i+1).join(textLayer.TAB_CHAR);}; function testRender(results) { for (var i = results.length; i--; ) { var stringBuilder = []; textLayer.$renderLine(stringBuilder, i, true); assert.equal(stringBuilder.join(""), results[i]); } } this.session.setValue(" \n\t\tf\n "); testRender([ "" + SPACE(4) + "" + SPACE(2), "" + SPACE(4) + "" + SPACE(4) + "f", SPACE(3) ]); this.textLayer.setShowInvisibles(true); testRender([ "" + DOT(4) + "" + DOT(2) + "" + EOL, "" + TAB(4) + "" + TAB(4) + "f" + EOL ]); this.textLayer.setDisplayIndentGuides(false); testRender([ "" + DOT(6) + "" + EOL, "" + TAB(4) + "" + TAB(4) + "f" + EOL ]); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/lib/app_config.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "no use strict"; var oop = require("./oop"); var EventEmitter = require("./event_emitter").EventEmitter; var optionsProvider = { setOptions: function(optList) { Object.keys(optList).forEach(function(key) { this.setOption(key, optList[key]); }, this); }, getOptions: function(optionNames) { var result = {}; if (!optionNames) { optionNames = Object.keys(this.$options); } else if (!Array.isArray(optionNames)) { result = optionNames; optionNames = Object.keys(result); } optionNames.forEach(function(key) { result[key] = this.getOption(key); }, this); return result; }, setOption: function(name, value) { if (this["$" + name] === value) return; var opt = this.$options[name]; if (!opt) { return warn('misspelled option "' + name + '"'); } if (opt.forwardTo) return this[opt.forwardTo] && this[opt.forwardTo].setOption(name, value); if (!opt.handlesSet) this["$" + name] = value; if (opt && opt.set) opt.set.call(this, value); }, getOption: function(name) { var opt = this.$options[name]; if (!opt) { return warn('misspelled option "' + name + '"'); } if (opt.forwardTo) return this[opt.forwardTo] && this[opt.forwardTo].getOption(name); return opt && opt.get ? opt.get.call(this) : this["$" + name]; } }; function warn(message) { if (typeof console != "undefined" && console.warn) console.warn.apply(console, arguments); } function reportError(msg, data) { var e = new Error(msg); e.data = data; if (typeof console == "object" && console.error) console.error(e); setTimeout(function() { throw e; }); } var AppConfig = function() { this.$defaultOptions = {}; }; (function() { // module loading oop.implement(this, EventEmitter); /* * option {name, value, initialValue, setterName, set, get } */ this.defineOptions = function(obj, path, options) { if (!obj.$options) this.$defaultOptions[path] = obj.$options = {}; Object.keys(options).forEach(function(key) { var opt = options[key]; if (typeof opt == "string") opt = {forwardTo: opt}; opt.name || (opt.name = key); obj.$options[opt.name] = opt; if ("initialValue" in opt) obj["$" + opt.name] = opt.initialValue; }); // implement option provider interface oop.implement(obj, optionsProvider); return this; }; this.resetOptions = function(obj) { Object.keys(obj.$options).forEach(function(key) { var opt = obj.$options[key]; if ("value" in opt) obj.setOption(key, opt.value); }); }; this.setDefaultValue = function(path, name, value) { var opts = this.$defaultOptions[path] || (this.$defaultOptions[path] = {}); if (opts[name]) { if (opts.forwardTo) this.setDefaultValue(opts.forwardTo, name, value); else opts[name].value = value; } }; this.setDefaultValues = function(path, optionHash) { Object.keys(optionHash).forEach(function(key) { this.setDefaultValue(path, key, optionHash[key]); }, this); }; this.warn = warn; this.reportError = reportError; }).call(AppConfig.prototype); exports.AppConfig = AppConfig; }); ================================================ FILE: lib/ace/lib/bidiutil.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var ArabicAlefBetIntervalsBegine = ['\u0621', '\u0641']; var ArabicAlefBetIntervalsEnd = ['\u063A', '\u064a']; var dir = 0, hiLevel = 0; var lastArabic = false, hasUBAT_AL = false, hasUBAT_B = false, hasUBAT_S = false, hasBlockSep = false, hasSegSep = false; var impTab_LTR = [ /* L, R, EN, AN, N, IL, Cond */ /* 0 LTR text */ [ 0, 3, 0, 1, 0, 0, 0 ], /* 1 LTR+AN */ [ 0, 3, 0, 1, 2, 2, 0 ], /* 2 LTR+AN+N */ [ 0, 3, 0, 0x11, 2, 0, 1 ], /* 3 RTL text */ [ 0, 3, 5, 5, 4, 1, 0 ], /* 4 RTL cont */ [ 0, 3, 0x15, 0x15, 4, 0, 1 ], /* 5 RTL+EN/AN */ [ 0, 3, 5, 5, 4, 2, 0 ] ]; var impTab_RTL = [ /* L, R, EN, AN, N, IL, Cond */ /* 0 RTL text */ [ 2, 0, 1, 1, 0, 1, 0 ], /* 1 RTL+EN/AN */ [ 2, 0, 1, 1, 0, 2, 0 ], /* 2 LTR text */ [ 2, 0, 2, 1, 3, 2, 0 ], /* 3 LTR+cont */ [ 2, 0, 2, 0x21, 3, 1, 1 ] ]; var LTR = 0, RTL = 1; var L = 0; /* left to right */ var R = 1; /* right to left */ var EN = 2; /* European digit */ var AN = 3; /* Arabic-Indic digit */ var ON = 4; /* neutral */ var B = 5; /* block separator */ var S = 6; /* segment separator */ var AL = 7; /* Arabic Letter */ var WS = 8; /* white space */ var CS = 9; /* common digit separator */ var ES = 10; /* European digit separator */ var ET = 11; /* European digit terminator */ var NSM = 12; /* Non Spacing Mark */ var LRE = 13; /* LRE */ var RLE = 14; /* RLE */ var PDF = 15; /* PDF */ var LRO = 16; /* LRO */ var RLO = 17; /* RLO */ var BN = 18; /* Boundary Neutral */ var UnicodeTBL00 = [ BN,BN,BN,BN,BN,BN,BN,BN,BN,S,B,S,WS,B,BN,BN, BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,B,B,B,S, WS,ON,ON,ET,ET,ET,ON,ON,ON,ON,ON,ES,CS,ES,CS,CS, EN,EN,EN,EN,EN,EN,EN,EN,EN,EN,CS,ON,ON,ON,ON,ON, ON,L,L,L,L,L,L,L,L,L,L,L,L,L,L,L, L,L,L,L,L,L,L,L,L,L,L,ON,ON,ON,ON,ON, ON,L,L,L,L,L,L,L,L,L,L,L,L,L,L,L, L,L,L,L,L,L,L,L,L,L,L,ON,ON,ON,ON,BN, BN,BN,BN,BN,BN,B,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN, BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN,BN, CS,ON,ET,ET,ET,ET,ON,ON,ON,ON,L,ON,ON,BN,ON,ON, ET,ET,EN,EN,ON,L,ON,ON,ON,EN,L,ON,ON,ON,ON,ON ]; var UnicodeTBL20 = [ WS,WS,WS,WS,WS,WS,WS,WS,WS,WS,WS,BN,BN,BN,L,R , ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON, ON,ON,ON,ON,ON,ON,ON,ON,WS,B,LRE,RLE,PDF,LRO,RLO,CS, ET,ET,ET,ET,ET,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON, ON,ON,ON,ON,CS,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON, ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,ON,WS ]; function _computeLevels(chars, levels, len, charTypes) { var impTab = dir ? impTab_RTL : impTab_LTR , prevState = null, newClass = null, newLevel = null, newState = 0 , action = null, cond = null, condPos = -1, i = null, ix = null, classes = []; if (!charTypes) { for (i = 0, charTypes = []; i < len; i++) { charTypes[i] = _getCharacterType(chars[i]); } } hiLevel = dir; lastArabic = false; hasUBAT_AL = false; hasUBAT_B = false; hasUBAT_S = false; for (ix = 0; ix < len; ix++){ prevState = newState; classes[ix] = newClass = _getCharClass(chars, charTypes, classes, ix); newState = impTab[prevState][newClass]; action = newState & 0xF0; newState &= 0x0F; levels[ix] = newLevel = impTab[newState][5]; if (action > 0){ if (action == 0x10){ for(i = condPos; i < ix; i++){ levels[i] = 1; } condPos = -1; } else { condPos = -1; } } cond = impTab[newState][6]; if (cond){ if(condPos == -1){ condPos = ix; } }else{ if (condPos > -1){ for(i = condPos; i < ix; i++){ levels[i] = newLevel; } condPos = -1; } } if (charTypes[ix] == B){ levels[ix] = 0; } hiLevel |= newLevel; } if (hasUBAT_S){ for(i = 0; i < len; i++){ if(charTypes[i] == S){ levels[i] = dir; for(var j = i - 1; j >= 0; j--){ if(charTypes[j] == WS){ levels[j] = dir; }else{ break; } } } } } } function _invertLevel(lev, levels, _array) { if (hiLevel < lev){ return; } if (lev == 1 && dir == RTL && !hasUBAT_B){ _array.reverse(); return; } var len = _array.length, start = 0, end, lo, hi, tmp; while(start < len){ if (levels[start] >= lev){ end = start + 1; while(end < len && levels[end] >= lev){ end++; } for(lo = start, hi = end - 1 ; lo < hi; lo++, hi--){ tmp = _array[lo]; _array[lo] = _array[hi]; _array[hi] = tmp; } start = end; } start++; } } function _getCharClass(chars, types, classes, ix) { var cType = types[ix], wType, nType, len, i; switch(cType){ case L: case R: lastArabic = false; case ON: case AN: return cType; case EN: return lastArabic ? AN : EN; case AL: lastArabic = true; hasUBAT_AL = true; return R; case WS: return ON; case CS: if (ix < 1 || (ix + 1) >= types.length || ((wType = classes[ix - 1]) != EN && wType != AN) || ((nType = types[ix + 1]) != EN && nType != AN)){ return ON; } if (lastArabic){nType = AN;} return nType == wType ? nType : ON; case ES: wType = ix > 0 ? classes[ix - 1] : B; if (wType == EN && (ix + 1) < types.length && types[ix + 1] == EN){ return EN; } return ON; case ET: if (ix > 0 && classes[ix - 1] == EN){ return EN; } if (lastArabic){ return ON; } i = ix + 1; len = types.length; while (i < len && types[i] == ET){ i++; } if (i < len && types[i] == EN){ return EN; } return ON; case NSM: len = types.length; i = ix + 1; while (i < len && types[i] == NSM){ i++; } if (i < len){ var c = chars[ix], rtlCandidate = (c >= 0x0591 && c <= 0x08FF) || c == 0xFB1E; wType = types[i]; if (rtlCandidate && (wType == R || wType == AL)){ return R; } } if (ix < 1 || (wType = types[ix - 1]) == B){ return ON; } return classes[ix - 1]; case B: lastArabic = false; hasUBAT_B = true; return dir; case S: hasUBAT_S = true; return ON; case LRE: case RLE: case LRO: case RLO: case PDF: lastArabic = false; case BN: return ON; } } function _getCharacterType( ch ) { var uc = ch.charCodeAt(0), hi = uc >> 8; if (hi == 0) { return ((uc > 0x00BF) ? L : UnicodeTBL00[uc]); } else if (hi == 5) { return (/[\u0591-\u05f4]/.test(ch) ? R : L); } else if (hi == 6) { if (/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(ch)) return NSM; else if (/[\u0660-\u0669\u066b-\u066c]/.test(ch)) return AN; else if (uc == 0x066A) return ET; else if (/[\u06f0-\u06f9]/.test(ch)) return EN; else return AL; } else if (hi == 0x20 && uc <= 0x205F) { return UnicodeTBL20[uc & 0xFF]; } else if (hi == 0xFE) { return (uc >= 0xFE70 ? AL : ON); } return ON; } function _isArabicDiacritics( ch ) { return (ch >= '\u064b' && ch <= '\u0655'); } /* Strong LTR character (0 - even), regular width */ exports.L = L; /* Strong RTL character (1 - odd), Bidi width */ exports.R = R; /* European digit (2 - even), regular width */ exports.EN = EN; /* Neutral RTL-by-context character (3 - odd), regular width */ exports.ON_R = 3; /* Hindi (Arabic) digit (4 - even), Bidi width */ exports.AN = 4; /* Arabic LamAlef (5 - odd), Half Bidi width */ exports.R_H = 5; /* invisible EOL (6 - even), zero width */ exports.B = 6; exports.DOT = "\xB7"; /** * Performs text reordering by implementing Unicode Bidi algorithm * with aim to produce logical<->visual map and Bidi levels * @param {String} text string to be reordered * @param {Array} unicode character types produced by call to 'hasBidiCharacters' * @param {Boolean} 'true' for right-to-left text direction, otherwise 'false' * * @return {Object} An object containing logicalFromVisual map and Bidi levels **/ exports.doBidiReorder = function(text, textCharTypes, isRtl) { if (text.length < 2) return {}; var chars = text.split(""), logicalFromVisual = new Array(chars.length), bidiLevels = new Array(chars.length), levels = []; dir = isRtl ? RTL : LTR; _computeLevels(chars, levels, chars.length, textCharTypes); for (var i = 0; i < logicalFromVisual.length; logicalFromVisual[i] = i, i++); _invertLevel(2, levels, logicalFromVisual); _invertLevel(1, levels, logicalFromVisual); for (var i = 0; i < logicalFromVisual.length - 1; i++) { //fix levels to reflect character width if (textCharTypes[i] === AN) { levels[i] = exports.AN; } else if (levels[i] === R && ((textCharTypes[i] > AL && textCharTypes[i] < LRE) || textCharTypes[i] === ON || textCharTypes[i] === BN)) { levels[i] = exports.ON_R; } else if ((i > 0 && chars[i - 1] === '\u0644') && /\u0622|\u0623|\u0625|\u0627/.test(chars[i])) { levels[i - 1] = levels[i] = exports.R_H; i++; } } /* fix level to mark zero length EOL */ if (chars[chars.length - 1] === exports.DOT) levels[chars.length - 1] = exports.B; for (var i = 0; i < logicalFromVisual.length; i++) { bidiLevels[i] = levels[logicalFromVisual[i]]; } return {'logicalFromVisual': logicalFromVisual, 'bidiLevels': bidiLevels}; }; /** * Performs character classification, to be used in Unicode Bidi algorithm. * @param {String} text string to be reordered * @param {Array} unicode character types (to be filled by this method) * * @return {Boolean} 'true' if text contains Bidi characters, otherwise 'false' **/ exports.hasBidiCharacters = function(text, textCharTypes){ var ret = false; for (var i = 0; i < text.length; i++){ textCharTypes[i] = _getCharacterType(text.charAt(i)); if (!ret && (textCharTypes[i] == R || textCharTypes[i] == AL)) ret = true; } return ret; }; /** * Returns visual index corresponding to logical index basing on logicalFromvisual * map provided by Unicode Bidi algorithm. * @param {int} logical index of character in text buffer * @param {Object} object containing logicalFromVisual map * * @return {int} visual index (on display) corresponding to logical index **/ exports.getVisualFromLogicalIdx = function(logIdx, rowMap) { for (var i = 0; i < rowMap.logicalFromVisual.length; i++) { if (rowMap.logicalFromVisual[i] == logIdx) return i; } return 0; }; }); ================================================ FILE: lib/ace/lib/dom.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var XHTML_NS = "http://www.w3.org/1999/xhtml"; exports.getDocumentHead = function(doc) { if (!doc) doc = document; return doc.head || doc.getElementsByTagName("head")[0] || doc.documentElement; }; exports.createElement = function(tag, ns) { return document.createElementNS ? document.createElementNS(ns || XHTML_NS, tag) : document.createElement(tag); }; exports.hasCssClass = function(el, name) { var classes = (el.className + "").split(/\s+/g); return classes.indexOf(name) !== -1; }; /* * Add a CSS class to the list of classes on the given node */ exports.addCssClass = function(el, name) { if (!exports.hasCssClass(el, name)) { el.className += " " + name; } }; /* * Remove a CSS class from the list of classes on the given node */ exports.removeCssClass = function(el, name) { var classes = el.className.split(/\s+/g); while (true) { var index = classes.indexOf(name); if (index == -1) { break; } classes.splice(index, 1); } el.className = classes.join(" "); }; exports.toggleCssClass = function(el, name) { var classes = el.className.split(/\s+/g), add = true; while (true) { var index = classes.indexOf(name); if (index == -1) { break; } add = false; classes.splice(index, 1); } if (add) classes.push(name); el.className = classes.join(" "); return add; }; /* * Add or remove a CSS class from the list of classes on the given node * depending on the value of include */ exports.setCssClass = function(node, className, include) { if (include) { exports.addCssClass(node, className); } else { exports.removeCssClass(node, className); } }; exports.hasCssString = function(id, doc) { var index = 0, sheets; doc = doc || document; if (doc.createStyleSheet && (sheets = doc.styleSheets)) { while (index < sheets.length) if (sheets[index++].owningElement.id === id) return true; } else if ((sheets = doc.getElementsByTagName("style"))) { while (index < sheets.length) if (sheets[index++].id === id) return true; } return false; }; exports.importCssString = function importCssString(cssText, id, doc) { doc = doc || document; // If style is already imported return immediately. if (id && exports.hasCssString(id, doc)) return null; var style; if (id) cssText += "\n/*# sourceURL=ace/css/" + id + " */"; if (doc.createStyleSheet) { style = doc.createStyleSheet(); style.cssText = cssText; if (id) style.owningElement.id = id; } else { style = exports.createElement("style"); style.appendChild(doc.createTextNode(cssText)); if (id) style.id = id; exports.getDocumentHead(doc).appendChild(style); } }; exports.importCssStylsheet = function(uri, doc) { if (doc.createStyleSheet) { doc.createStyleSheet(uri); } else { var link = exports.createElement('link'); link.rel = 'stylesheet'; link.href = uri; exports.getDocumentHead(doc).appendChild(link); } }; exports.getInnerWidth = function(element) { return ( parseInt(exports.computedStyle(element, "paddingLeft"), 10) + parseInt(exports.computedStyle(element, "paddingRight"), 10) + element.clientWidth ); }; exports.getInnerHeight = function(element) { return ( parseInt(exports.computedStyle(element, "paddingTop"), 10) + parseInt(exports.computedStyle(element, "paddingBottom"), 10) + element.clientHeight ); }; exports.scrollbarWidth = function(document) { var inner = exports.createElement("ace_inner"); inner.style.width = "100%"; inner.style.minWidth = "0px"; inner.style.height = "200px"; inner.style.display = "block"; var outer = exports.createElement("ace_outer"); var style = outer.style; style.position = "absolute"; style.left = "-10000px"; style.overflow = "hidden"; style.width = "200px"; style.minWidth = "0px"; style.height = "150px"; style.display = "block"; outer.appendChild(inner); var body = document.documentElement; body.appendChild(outer); var noScrollbar = inner.offsetWidth; style.overflow = "scroll"; var withScrollbar = inner.offsetWidth; if (noScrollbar == withScrollbar) { withScrollbar = outer.clientWidth; } body.removeChild(outer); return noScrollbar-withScrollbar; }; if (typeof document == "undefined") { exports.importCssString = function() {}; return; } if (window.pageYOffset !== undefined) { exports.getPageScrollTop = function() { return window.pageYOffset; }; exports.getPageScrollLeft = function() { return window.pageXOffset; }; } else { exports.getPageScrollTop = function() { return document.body.scrollTop; }; exports.getPageScrollLeft = function() { return document.body.scrollLeft; }; } if (window.getComputedStyle) exports.computedStyle = function(element, style) { if (style) return (window.getComputedStyle(element, "") || {})[style] || ""; return window.getComputedStyle(element, "") || {}; }; else exports.computedStyle = function(element, style) { if (style) return element.currentStyle[style]; return element.currentStyle; }; /* * Optimized set innerHTML. This is faster than plain innerHTML if the element * already contains a lot of child elements. * * See http://blog.stevenlevithan.com/archives/faster-than-innerhtml for details */ exports.setInnerHtml = function(el, innerHtml) { var element = el.cloneNode(false);//document.createElement("div"); element.innerHTML = innerHtml; el.parentNode.replaceChild(element, el); return element; }; if ("textContent" in document.documentElement) { exports.setInnerText = function(el, innerText) { el.textContent = innerText; }; exports.getInnerText = function(el) { return el.textContent; }; } else { exports.setInnerText = function(el, innerText) { el.innerText = innerText; }; exports.getInnerText = function(el) { return el.innerText; }; } exports.getParentWindow = function(document) { return document.defaultView || document.parentWindow; }; }); ================================================ FILE: lib/ace/lib/es5-shim.js ================================================ // https://github.com/kriskowal/es5-shim // Copyright 2009-2012 by contributors, MIT License define(function(require, exports, module) { /* * Brings an environment as close to ECMAScript 5 compliance * as is possible with the facilities of erstwhile engines. * * Annotated ES5: http://es5.github.com/ (specific links below) * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf * Required reading: http://javascriptweblog.wordpress.com/2011/12/05/extending-javascript-natives/ */ // // Function // ======== // // ES-5 15.3.4.5 // http://es5.github.com/#x15.3.4.5 function Empty() {} if (!Function.prototype.bind) { Function.prototype.bind = function bind(that) { // .length is 1 // 1. Let Target be the this value. var target = this; // 2. If IsCallable(Target) is false, throw a TypeError exception. if (typeof target != "function") { throw new TypeError("Function.prototype.bind called on incompatible " + target); } // 3. Let A be a new (possibly empty) internal list of all of the // argument values provided after thisArg (arg1, arg2 etc), in order. // XXX slicedArgs will stand in for "A" if used var args = slice.call(arguments, 1); // for normal call // 4. Let F be a new native ECMAScript object. // 11. Set the [[Prototype]] internal property of F to the standard // built-in Function prototype object as specified in 15.3.3.1. // 12. Set the [[Call]] internal property of F as described in // 15.3.4.5.1. // 13. Set the [[Construct]] internal property of F as described in // 15.3.4.5.2. // 14. Set the [[HasInstance]] internal property of F as described in // 15.3.4.5.3. var bound = function () { if (this instanceof bound) { // 15.3.4.5.2 [[Construct]] // When the [[Construct]] internal method of a function object, // F that was created using the bind function is called with a // list of arguments ExtraArgs, the following steps are taken: // 1. Let target be the value of F's [[TargetFunction]] // internal property. // 2. If target has no [[Construct]] internal method, a // TypeError exception is thrown. // 3. Let boundArgs be the value of F's [[BoundArgs]] internal // property. // 4. Let args be a new list containing the same values as the // list boundArgs in the same order followed by the same // values as the list ExtraArgs in the same order. // 5. Return the result of calling the [[Construct]] internal // method of target providing args as the arguments. var result = target.apply( this, args.concat(slice.call(arguments)) ); if (Object(result) === result) { return result; } return this; } else { // 15.3.4.5.1 [[Call]] // When the [[Call]] internal method of a function object, F, // which was created using the bind function is called with a // this value and a list of arguments ExtraArgs, the following // steps are taken: // 1. Let boundArgs be the value of F's [[BoundArgs]] internal // property. // 2. Let boundThis be the value of F's [[BoundThis]] internal // property. // 3. Let target be the value of F's [[TargetFunction]] internal // property. // 4. Let args be a new list containing the same values as the // list boundArgs in the same order followed by the same // values as the list ExtraArgs in the same order. // 5. Return the result of calling the [[Call]] internal method // of target providing boundThis as the this value and // providing args as the arguments. // equiv: target.call(this, ...boundArgs, ...args) return target.apply( that, args.concat(slice.call(arguments)) ); } }; if(target.prototype) { Empty.prototype = target.prototype; bound.prototype = new Empty(); // Clean up dangling references. Empty.prototype = null; } // XXX bound.length is never writable, so don't even try // // 15. If the [[Class]] internal property of Target is "Function", then // a. Let L be the length property of Target minus the length of A. // b. Set the length own property of F to either 0 or L, whichever is // larger. // 16. Else set the length own property of F to 0. // 17. Set the attributes of the length own property of F to the values // specified in 15.3.5.1. // TODO // 18. Set the [[Extensible]] internal property of F to true. // TODO // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3). // 20. Call the [[DefineOwnProperty]] internal method of F with // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]: // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and // false. // 21. Call the [[DefineOwnProperty]] internal method of F with // arguments "arguments", PropertyDescriptor {[[Get]]: thrower, // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false}, // and false. // TODO // NOTE Function objects created using Function.prototype.bind do not // have a prototype property or the [[Code]], [[FormalParameters]], and // [[Scope]] internal properties. // XXX can't delete prototype in pure-js. // 22. Return F. return bound; }; } // Shortcut to an often accessed properties, in order to avoid multiple // dereference that costs universally. // _Please note: Shortcuts are defined after `Function.prototype.bind` as we // us it in defining shortcuts. var call = Function.prototype.call; var prototypeOfArray = Array.prototype; var prototypeOfObject = Object.prototype; var slice = prototypeOfArray.slice; // Having a toString local variable name breaks in Opera so use _toString. var _toString = call.bind(prototypeOfObject.toString); var owns = call.bind(prototypeOfObject.hasOwnProperty); // If JS engine supports accessors creating shortcuts. var defineGetter; var defineSetter; var lookupGetter; var lookupSetter; var supportsAccessors; if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) { defineGetter = call.bind(prototypeOfObject.__defineGetter__); defineSetter = call.bind(prototypeOfObject.__defineSetter__); lookupGetter = call.bind(prototypeOfObject.__lookupGetter__); lookupSetter = call.bind(prototypeOfObject.__lookupSetter__); } // // Array // ===== // // ES5 15.4.4.12 // http://es5.github.com/#x15.4.4.12 // Default value for second param // [bugfix, ielt9, old browsers] // IE < 9 bug: [1,2].splice(0).join("") == "" but should be "12" if ([1,2].splice(0).length != 2) { if(function() { // test IE < 9 to splice bug - see issue #138 function makeArray(l) { var a = new Array(l+2); a[0] = a[1] = 0; return a; } var array = [], lengthBefore; array.splice.apply(array, makeArray(20)); array.splice.apply(array, makeArray(26)); lengthBefore = array.length; //46 array.splice(5, 0, "XXX"); // add one element lengthBefore + 1 == array.length if (lengthBefore + 1 == array.length) { return true;// has right splice implementation without bugs } // else { // IE8 bug // } }()) {//IE 6/7 var array_splice = Array.prototype.splice; Array.prototype.splice = function(start, deleteCount) { if (!arguments.length) { return []; } else { return array_splice.apply(this, [ start === void 0 ? 0 : start, deleteCount === void 0 ? (this.length - start) : deleteCount ].concat(slice.call(arguments, 2))) } }; } else {//IE8 // taken from http://docs.sencha.com/ext-js/4-1/source/Array2.html Array.prototype.splice = function(pos, removeCount){ var length = this.length; if (pos > 0) { if (pos > length) pos = length; } else if (pos == void 0) { pos = 0; } else if (pos < 0) { pos = Math.max(length + pos, 0); } if (!(pos+removeCount < length)) removeCount = length - pos; var removed = this.slice(pos, pos+removeCount); var insert = slice.call(arguments, 2); var add = insert.length; // we try to use Array.push when we can for efficiency... if (pos === length) { if (add) { this.push.apply(this, insert); } } else { var remove = Math.min(removeCount, length - pos); var tailOldPos = pos + remove; var tailNewPos = tailOldPos + add - remove; var tailCount = length - tailOldPos; var lengthAfterRemove = length - remove; if (tailNewPos < tailOldPos) { // case A for (var i = 0; i < tailCount; ++i) { this[tailNewPos+i] = this[tailOldPos+i]; } } else if (tailNewPos > tailOldPos) { // case B for (i = tailCount; i--; ) { this[tailNewPos+i] = this[tailOldPos+i]; } } // else, add == remove (nothing to do) if (add && pos === lengthAfterRemove) { this.length = lengthAfterRemove; // truncate array this.push.apply(this, insert); } else { this.length = lengthAfterRemove + add; // reserves space for (i = 0; i < add; ++i) { this[pos+i] = insert[i]; } } } return removed; }; } } // ES5 15.4.3.2 // http://es5.github.com/#x15.4.3.2 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray if (!Array.isArray) { Array.isArray = function isArray(obj) { return _toString(obj) == "[object Array]"; }; } // The IsCallable() check in the Array functions // has been replaced with a strict check on the // internal class of the object to trap cases where // the provided function was actually a regular // expression literal, which in V8 and // JavaScriptCore is a typeof "function". Only in // V8 are regular expression literals permitted as // reduce parameters, so it is desirable in the // general case for the shim to match the more // strict and common behavior of rejecting regular // expressions. // ES5 15.4.4.18 // http://es5.github.com/#x15.4.4.18 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach // Check failure of by-index access of string characters (IE < 9) // and failure of `0 in boxedString` (Rhino) var boxedString = Object("a"), splitString = boxedString[0] != "a" || !(0 in boxedString); if (!Array.prototype.forEach) { Array.prototype.forEach = function forEach(fun /*, thisp*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, thisp = arguments[1], i = -1, length = self.length >>> 0; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(); // TODO message } while (++i < length) { if (i in self) { // Invoke the callback function with call, passing arguments: // context, property value, property key, thisArg object // context fun.call(thisp, self[i], i, object); } } }; } // ES5 15.4.4.19 // http://es5.github.com/#x15.4.4.19 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map if (!Array.prototype.map) { Array.prototype.map = function map(fun /*, thisp*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, result = Array(length), thisp = arguments[1]; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self) result[i] = fun.call(thisp, self[i], i, object); } return result; }; } // ES5 15.4.4.20 // http://es5.github.com/#x15.4.4.20 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter if (!Array.prototype.filter) { Array.prototype.filter = function filter(fun /*, thisp */) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, result = [], value, thisp = arguments[1]; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self) { value = self[i]; if (fun.call(thisp, value, i, object)) { result.push(value); } } } return result; }; } // ES5 15.4.4.16 // http://es5.github.com/#x15.4.4.16 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every if (!Array.prototype.every) { Array.prototype.every = function every(fun /*, thisp */) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, thisp = arguments[1]; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self && !fun.call(thisp, self[i], i, object)) { return false; } } return true; }; } // ES5 15.4.4.17 // http://es5.github.com/#x15.4.4.17 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some if (!Array.prototype.some) { Array.prototype.some = function some(fun /*, thisp */) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0, thisp = arguments[1]; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } for (var i = 0; i < length; i++) { if (i in self && fun.call(thisp, self[i], i, object)) { return true; } } return false; }; } // ES5 15.4.4.21 // http://es5.github.com/#x15.4.4.21 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce if (!Array.prototype.reduce) { Array.prototype.reduce = function reduce(fun /*, initial*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } // no value to return if no initial value and an empty array if (!length && arguments.length == 1) { throw new TypeError("reduce of empty array with no initial value"); } var i = 0; var result; if (arguments.length >= 2) { result = arguments[1]; } else { do { if (i in self) { result = self[i++]; break; } // if array contains no values, no initial value to return if (++i >= length) { throw new TypeError("reduce of empty array with no initial value"); } } while (true); } for (; i < length; i++) { if (i in self) { result = fun.call(void 0, result, self[i], i, object); } } return result; }; } // ES5 15.4.4.22 // http://es5.github.com/#x15.4.4.22 // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight if (!Array.prototype.reduceRight) { Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) { var object = toObject(this), self = splitString && _toString(this) == "[object String]" ? this.split("") : object, length = self.length >>> 0; // If no callback function or if callback is not a callable function if (_toString(fun) != "[object Function]") { throw new TypeError(fun + " is not a function"); } // no value to return if no initial value, empty array if (!length && arguments.length == 1) { throw new TypeError("reduceRight of empty array with no initial value"); } var result, i = length - 1; if (arguments.length >= 2) { result = arguments[1]; } else { do { if (i in self) { result = self[i--]; break; } // if array contains no values, no initial value to return if (--i < 0) { throw new TypeError("reduceRight of empty array with no initial value"); } } while (true); } do { if (i in this) { result = fun.call(void 0, result, self[i], i, object); } } while (i--); return result; }; } // ES5 15.4.4.14 // http://es5.github.com/#x15.4.4.14 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf if (!Array.prototype.indexOf || ([0, 1].indexOf(1, 2) != -1)) { Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) { var self = splitString && _toString(this) == "[object String]" ? this.split("") : toObject(this), length = self.length >>> 0; if (!length) { return -1; } var i = 0; if (arguments.length > 1) { i = toInteger(arguments[1]); } // handle negative indices i = i >= 0 ? i : Math.max(0, length + i); for (; i < length; i++) { if (i in self && self[i] === sought) { return i; } } return -1; }; } // ES5 15.4.4.15 // http://es5.github.com/#x15.4.4.15 // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf if (!Array.prototype.lastIndexOf || ([0, 1].lastIndexOf(0, -3) != -1)) { Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) { var self = splitString && _toString(this) == "[object String]" ? this.split("") : toObject(this), length = self.length >>> 0; if (!length) { return -1; } var i = length - 1; if (arguments.length > 1) { i = Math.min(i, toInteger(arguments[1])); } // handle negative indices i = i >= 0 ? i : length - Math.abs(i); for (; i >= 0; i--) { if (i in self && sought === self[i]) { return i; } } return -1; }; } // // Object // ====== // // ES5 15.2.3.2 // http://es5.github.com/#x15.2.3.2 if (!Object.getPrototypeOf) { // https://github.com/kriskowal/es5-shim/issues#issue/2 // http://ejohn.org/blog/objectgetprototypeof/ // recommended by fschaefer on github Object.getPrototypeOf = function getPrototypeOf(object) { return object.__proto__ || ( object.constructor ? object.constructor.prototype : prototypeOfObject ); }; } // ES5 15.2.3.3 // http://es5.github.com/#x15.2.3.3 if (!Object.getOwnPropertyDescriptor) { var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " + "non-object: "; Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) { if ((typeof object != "object" && typeof object != "function") || object === null) throw new TypeError(ERR_NON_OBJECT + object); // If object does not owns property return undefined immediately. if (!owns(object, property)) return; var descriptor, getter, setter; // If object has a property then it's for sure both `enumerable` and // `configurable`. descriptor = { enumerable: true, configurable: true }; // If JS engine supports accessor properties then property may be a // getter or setter. if (supportsAccessors) { // Unfortunately `__lookupGetter__` will return a getter even // if object has own non getter property along with a same named // inherited getter. To avoid misbehavior we temporary remove // `__proto__` so that `__lookupGetter__` will return getter only // if it's owned by an object. var prototype = object.__proto__; object.__proto__ = prototypeOfObject; var getter = lookupGetter(object, property); var setter = lookupSetter(object, property); // Once we have getter and setter we can put values back. object.__proto__ = prototype; if (getter || setter) { if (getter) descriptor.get = getter; if (setter) descriptor.set = setter; // If it was accessor property we're done and return here // in order to avoid adding `value` to the descriptor. return descriptor; } } // If we got this far we know that object has an own property that is // not an accessor so we set it as a value and return descriptor. descriptor.value = object[property]; return descriptor; }; } // ES5 15.2.3.4 // http://es5.github.com/#x15.2.3.4 if (!Object.getOwnPropertyNames) { Object.getOwnPropertyNames = function getOwnPropertyNames(object) { return Object.keys(object); }; } // ES5 15.2.3.5 // http://es5.github.com/#x15.2.3.5 if (!Object.create) { var createEmpty; if (Object.prototype.__proto__ === null) { createEmpty = function () { return { "__proto__": null }; }; } else { // In old IE __proto__ can't be used to manually set `null` createEmpty = function () { var empty = {}; for (var i in empty) empty[i] = null; empty.constructor = empty.hasOwnProperty = empty.propertyIsEnumerable = empty.isPrototypeOf = empty.toLocaleString = empty.toString = empty.valueOf = empty.__proto__ = null; return empty; } } Object.create = function create(prototype, properties) { var object; if (prototype === null) { object = createEmpty(); } else { if (typeof prototype != "object") throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); var Type = function () {}; Type.prototype = prototype; object = new Type(); // IE has no built-in implementation of `Object.getPrototypeOf` // neither `__proto__`, but this manually setting `__proto__` will // guarantee that `Object.getPrototypeOf` will work as expected with // objects created using `Object.create` object.__proto__ = prototype; } if (properties !== void 0) Object.defineProperties(object, properties); return object; }; } // ES5 15.2.3.6 // http://es5.github.com/#x15.2.3.6 // Patch for WebKit and IE8 standard mode // Designed by hax // related issue: https://github.com/kriskowal/es5-shim/issues#issue/5 // IE8 Reference: // http://msdn.microsoft.com/en-us/library/dd282900.aspx // http://msdn.microsoft.com/en-us/library/dd229916.aspx // WebKit Bugs: // https://bugs.webkit.org/show_bug.cgi?id=36423 function doesDefinePropertyWork(object) { try { Object.defineProperty(object, "sentinel", {}); return "sentinel" in object; } catch (exception) { // returns falsy } } // check whether defineProperty works if it's given. Otherwise, // shim partially. if (Object.defineProperty) { var definePropertyWorksOnObject = doesDefinePropertyWork({}); var definePropertyWorksOnDom = typeof document == "undefined" || doesDefinePropertyWork(document.createElement("div")); if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) { var definePropertyFallback = Object.defineProperty; } } if (!Object.defineProperty || definePropertyFallback) { var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: "; var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: " var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " + "on this javascript engine"; Object.defineProperty = function defineProperty(object, property, descriptor) { if ((typeof object != "object" && typeof object != "function") || object === null) throw new TypeError(ERR_NON_OBJECT_TARGET + object); if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null) throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor); // make a valiant attempt to use the real defineProperty // for I8's DOM elements. if (definePropertyFallback) { try { return definePropertyFallback.call(Object, object, property, descriptor); } catch (exception) { // try the shim if the real one doesn't work } } // If it's a data property. if (owns(descriptor, "value")) { // fail silently if "writable", "enumerable", or "configurable" // are requested but not supported /* // alternate approach: if ( // can't implement these features; allow false but not true !(owns(descriptor, "writable") ? descriptor.writable : true) || !(owns(descriptor, "enumerable") ? descriptor.enumerable : true) || !(owns(descriptor, "configurable") ? descriptor.configurable : true) ) throw new RangeError( "This implementation of Object.defineProperty does not " + "support configurable, enumerable, or writable." ); */ if (supportsAccessors && (lookupGetter(object, property) || lookupSetter(object, property))) { // As accessors are supported only on engines implementing // `__proto__` we can safely override `__proto__` while defining // a property to make sure that we don't hit an inherited // accessor. var prototype = object.__proto__; object.__proto__ = prototypeOfObject; // Deleting a property anyway since getter / setter may be // defined on object itself. delete object[property]; object[property] = descriptor.value; // Setting original `__proto__` back now. object.__proto__ = prototype; } else { object[property] = descriptor.value; } } else { if (!supportsAccessors) throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED); // If we got that far then getters and setters can be defined !! if (owns(descriptor, "get")) defineGetter(object, property, descriptor.get); if (owns(descriptor, "set")) defineSetter(object, property, descriptor.set); } return object; }; } // ES5 15.2.3.7 // http://es5.github.com/#x15.2.3.7 if (!Object.defineProperties) { Object.defineProperties = function defineProperties(object, properties) { for (var property in properties) { if (owns(properties, property)) Object.defineProperty(object, property, properties[property]); } return object; }; } // ES5 15.2.3.8 // http://es5.github.com/#x15.2.3.8 if (!Object.seal) { Object.seal = function seal(object) { // this is misleading and breaks feature-detection, but // allows "securable" code to "gracefully" degrade to working // but insecure code. return object; }; } // ES5 15.2.3.9 // http://es5.github.com/#x15.2.3.9 if (!Object.freeze) { Object.freeze = function freeze(object) { // this is misleading and breaks feature-detection, but // allows "securable" code to "gracefully" degrade to working // but insecure code. return object; }; } // detect a Rhino bug and patch it try { Object.freeze(function () {}); } catch (exception) { Object.freeze = (function freeze(freezeObject) { return function freeze(object) { if (typeof object == "function") { return object; } else { return freezeObject(object); } }; })(Object.freeze); } // ES5 15.2.3.10 // http://es5.github.com/#x15.2.3.10 if (!Object.preventExtensions) { Object.preventExtensions = function preventExtensions(object) { // this is misleading and breaks feature-detection, but // allows "securable" code to "gracefully" degrade to working // but insecure code. return object; }; } // ES5 15.2.3.11 // http://es5.github.com/#x15.2.3.11 if (!Object.isSealed) { Object.isSealed = function isSealed(object) { return false; }; } // ES5 15.2.3.12 // http://es5.github.com/#x15.2.3.12 if (!Object.isFrozen) { Object.isFrozen = function isFrozen(object) { return false; }; } // ES5 15.2.3.13 // http://es5.github.com/#x15.2.3.13 if (!Object.isExtensible) { Object.isExtensible = function isExtensible(object) { // 1. If Type(O) is not Object throw a TypeError exception. if (Object(object) === object) { throw new TypeError(); // TODO message } // 2. Return the Boolean value of the [[Extensible]] internal property of O. var name = ''; while (owns(object, name)) { name += '?'; } object[name] = true; var returnValue = owns(object, name); delete object[name]; return returnValue; }; } // ES5 15.2.3.14 // http://es5.github.com/#x15.2.3.14 if (!Object.keys) { // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation var hasDontEnumBug = true, dontEnums = [ "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", "propertyIsEnumerable", "constructor" ], dontEnumsLength = dontEnums.length; for (var key in {"toString": null}) { hasDontEnumBug = false; } Object.keys = function keys(object) { if ( (typeof object != "object" && typeof object != "function") || object === null ) { throw new TypeError("Object.keys called on a non-object"); } var keys = []; for (var name in object) { if (owns(object, name)) { keys.push(name); } } if (hasDontEnumBug) { for (var i = 0, ii = dontEnumsLength; i < ii; i++) { var dontEnum = dontEnums[i]; if (owns(object, dontEnum)) { keys.push(dontEnum); } } } return keys; }; } // // most of es5-shim Date section is removed since ace doesn't need it, it is too intrusive and it causes problems for users // ==== // // ES5 15.9.4.4 // http://es5.github.com/#x15.9.4.4 if (!Date.now) { Date.now = function now() { return new Date().getTime(); }; } // // String // ====== // // ES5 15.5.4.20 // http://es5.github.com/#x15.5.4.20 var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" + "\u2029\uFEFF"; if (!String.prototype.trim || ws.trim()) { // http://blog.stevenlevithan.com/archives/faster-trim-javascript // http://perfectionkills.com/whitespace-deviations/ ws = "[" + ws + "]"; var trimBeginRegexp = new RegExp("^" + ws + ws + "*"), trimEndRegexp = new RegExp(ws + ws + "*$"); String.prototype.trim = function trim() { return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, ""); }; } // // Util // ====== // // ES5 9.4 // http://es5.github.com/#x9.4 // http://jsperf.com/to-integer function toInteger(n) { n = +n; if (n !== n) { // isNaN n = 0; } else if (n !== 0 && n !== (1/0) && n !== -(1/0)) { n = (n > 0 || -1) * Math.floor(Math.abs(n)); } return n; } function isPrimitive(input) { var type = typeof input; return ( input === null || type === "undefined" || type === "boolean" || type === "number" || type === "string" ); } function toPrimitive(input) { var val, valueOf, toString; if (isPrimitive(input)) { return input; } valueOf = input.valueOf; if (typeof valueOf === "function") { val = valueOf.call(input); if (isPrimitive(val)) { return val; } } toString = input.toString; if (typeof toString === "function") { val = toString.call(input); if (isPrimitive(val)) { return val; } } throw new TypeError(); } // ES5 9.9 // http://es5.github.com/#x9.9 var toObject = function (o) { if (o == null) { // this matches both null and undefined throw new TypeError("can't convert "+o+" to object"); } return Object(o); }; }); ================================================ FILE: lib/ace/lib/event.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var keys = require("./keys"); var useragent = require("./useragent"); var pressedKeys = null; var ts = 0; exports.addListener = function(elem, type, callback) { if (elem.addEventListener) { return elem.addEventListener(type, callback, false); } if (elem.attachEvent) { var wrapper = function() { callback.call(elem, window.event); }; callback._wrapper = wrapper; elem.attachEvent("on" + type, wrapper); } }; exports.removeListener = function(elem, type, callback) { if (elem.removeEventListener) { return elem.removeEventListener(type, callback, false); } if (elem.detachEvent) { elem.detachEvent("on" + type, callback._wrapper || callback); } }; /* * Prevents propagation and clobbers the default action of the passed event */ exports.stopEvent = function(e) { exports.stopPropagation(e); exports.preventDefault(e); return false; }; exports.stopPropagation = function(e) { if (e.stopPropagation) e.stopPropagation(); else e.cancelBubble = true; }; exports.preventDefault = function(e) { if (e.preventDefault) e.preventDefault(); else e.returnValue = false; }; /* * @return {Number} 0 for left button, 1 for middle button, 2 for right button */ exports.getButton = function(e) { if (e.type == "dblclick") return 0; if (e.type == "contextmenu" || (useragent.isMac && (e.ctrlKey && !e.altKey && !e.shiftKey))) return 2; // DOM Event if (e.preventDefault) { return e.button; } // old IE else { return {1:0, 2:2, 4:1}[e.button]; } }; exports.capture = function(el, eventHandler, releaseCaptureHandler) { function onMouseUp(e) { eventHandler && eventHandler(e); releaseCaptureHandler && releaseCaptureHandler(e); exports.removeListener(document, "mousemove", eventHandler, true); exports.removeListener(document, "mouseup", onMouseUp, true); exports.removeListener(document, "dragstart", onMouseUp, true); } exports.addListener(document, "mousemove", eventHandler, true); exports.addListener(document, "mouseup", onMouseUp, true); exports.addListener(document, "dragstart", onMouseUp, true); return onMouseUp; }; exports.addTouchMoveListener = function (el, callback) { var startx, starty; exports.addListener(el, "touchstart", function (e) { var touches = e.touches; var touchObj = touches[0]; startx = touchObj.clientX; starty = touchObj.clientY; }); exports.addListener(el, "touchmove", function (e) { var touches = e.touches; if (touches.length > 1) return; var touchObj = touches[0]; e.wheelX = startx - touchObj.clientX; e.wheelY = starty - touchObj.clientY; startx = touchObj.clientX; starty = touchObj.clientY; callback(e); }); }; exports.addMouseWheelListener = function(el, callback) { if ("onmousewheel" in el) { exports.addListener(el, "mousewheel", function(e) { var factor = 8; if (e.wheelDeltaX !== undefined) { e.wheelX = -e.wheelDeltaX / factor; e.wheelY = -e.wheelDeltaY / factor; } else { e.wheelX = 0; e.wheelY = -e.wheelDelta / factor; } callback(e); }); } else if ("onwheel" in el) { exports.addListener(el, "wheel", function(e) { var factor = 0.35; switch (e.deltaMode) { case e.DOM_DELTA_PIXEL: e.wheelX = e.deltaX * factor || 0; e.wheelY = e.deltaY * factor || 0; break; case e.DOM_DELTA_LINE: case e.DOM_DELTA_PAGE: e.wheelX = (e.deltaX || 0) * 5; e.wheelY = (e.deltaY || 0) * 5; break; } callback(e); }); } else { exports.addListener(el, "DOMMouseScroll", function(e) { if (e.axis && e.axis == e.HORIZONTAL_AXIS) { e.wheelX = (e.detail || 0) * 5; e.wheelY = 0; } else { e.wheelX = 0; e.wheelY = (e.detail || 0) * 5; } callback(e); }); } }; exports.addMultiMouseDownListener = function(elements, timeouts, eventHandler, callbackName) { var clicks = 0; var startX, startY, timer; var eventNames = { 2: "dblclick", 3: "tripleclick", 4: "quadclick" }; function onMousedown(e) { if (exports.getButton(e) !== 0) { clicks = 0; } else if (e.detail > 1) { clicks++; if (clicks > 4) clicks = 1; } else { clicks = 1; } if (useragent.isIE) { var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5; if (!timer || isNewClick) clicks = 1; if (timer) clearTimeout(timer); timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600); if (clicks == 1) { startX = e.clientX; startY = e.clientY; } } e._clicks = clicks; eventHandler[callbackName]("mousedown", e); if (clicks > 4) clicks = 0; else if (clicks > 1) return eventHandler[callbackName](eventNames[clicks], e); } function onDblclick(e) { clicks = 2; if (timer) clearTimeout(timer); timer = setTimeout(function() {timer = null;}, timeouts[clicks - 1] || 600); eventHandler[callbackName]("mousedown", e); eventHandler[callbackName](eventNames[clicks], e); } if (!Array.isArray(elements)) elements = [elements]; elements.forEach(function(el) { exports.addListener(el, "mousedown", onMousedown); if (useragent.isOldIE) exports.addListener(el, "dblclick", onDblclick); }); }; var getModifierHash = useragent.isMac && useragent.isOpera && !("KeyboardEvent" in window) ? function(e) { return 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0); } : function(e) { return 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0) | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0); }; exports.getModifierString = function(e) { return keys.KEY_MODS[getModifierHash(e)]; }; function normalizeCommandKeys(callback, e, keyCode) { var hashId = getModifierHash(e); if (!useragent.isMac && pressedKeys) { if (e.getModifierState && (e.getModifierState("OS") || e.getModifierState("Win"))) hashId |= 8; if (pressedKeys.altGr) { if ((3 & hashId) != 3) pressedKeys.altGr = 0; else return; } if (keyCode === 18 || keyCode === 17) { var location = "location" in e ? e.location : e.keyLocation; if (keyCode === 17 && location === 1) { if (pressedKeys[keyCode] == 1) ts = e.timeStamp; } else if (keyCode === 18 && hashId === 3 && location === 2) { var dt = e.timeStamp - ts; if (dt < 50) pressedKeys.altGr = true; } } } if (keyCode in keys.MODIFIER_KEYS) { keyCode = -1; } // keyCode of right command is 93 on mac and 92 on windows. // keyCode of left command key is 91 if (hashId & 8 && (keyCode >= 91 && keyCode <= 93)) { keyCode = -1; } if (!hashId && keyCode === 13) { var location = "location" in e ? e.location : e.keyLocation; if (location === 3) { callback(e, hashId, -keyCode); if (e.defaultPrevented) return; } } if (useragent.isChromeOS && hashId & 8) { callback(e, hashId, keyCode); if (e.defaultPrevented) return; else hashId &= ~8; } // If there is no hashId and the keyCode is not a function key, then // we don't call the callback as we don't handle a command key here // (it's a normal key/character input). if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) { return false; } return callback(e, hashId, keyCode); } exports.addCommandKeyListener = function(el, callback) { var addListener = exports.addListener; if (useragent.isOldGecko || (useragent.isOpera && !("KeyboardEvent" in window))) { // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown // event if the user pressed the key for a longer time. Instead, the // keydown event was fired once and later on only the keypress event. // To emulate the 'right' keydown behavior, the keyCode of the initial // keyDown event is stored and in the following keypress events the // stores keyCode is used to emulate a keyDown event. var lastKeyDownKeyCode = null; addListener(el, "keydown", function(e) { lastKeyDownKeyCode = e.keyCode; }); addListener(el, "keypress", function(e) { return normalizeCommandKeys(callback, e, lastKeyDownKeyCode); }); } else { var lastDefaultPrevented = null; addListener(el, "keydown", function(e) { pressedKeys[e.keyCode] = (pressedKeys[e.keyCode] || 0) + 1; var result = normalizeCommandKeys(callback, e, e.keyCode); lastDefaultPrevented = e.defaultPrevented; return result; }); addListener(el, "keypress", function(e) { if (lastDefaultPrevented && (e.ctrlKey || e.altKey || e.shiftKey || e.metaKey)) { exports.stopEvent(e); lastDefaultPrevented = null; } }); addListener(el, "keyup", function(e) { pressedKeys[e.keyCode] = null; }); if (!pressedKeys) { resetPressedKeys(); addListener(window, "focus", resetPressedKeys); } } }; function resetPressedKeys() { // console.log("resetting") pressedKeys = Object.create(null); } if (typeof window == "object" && window.postMessage && !useragent.isOldIE) { var postMessageId = 1; exports.nextTick = function(callback, win) { win = win || window; var messageName = "zero-timeout-message-" + postMessageId; exports.addListener(win, "message", function listener(e) { if (e.data == messageName) { exports.stopPropagation(e); exports.removeListener(win, "message", listener); callback(); } }); win.postMessage(messageName, "*"); }; } exports.nextFrame = typeof window == "object" && (window.requestAnimationFrame || window.mozRequestAnimationFrame || window.webkitRequestAnimationFrame || window.msRequestAnimationFrame || window.oRequestAnimationFrame); if (exports.nextFrame) exports.nextFrame = exports.nextFrame.bind(window); else exports.nextFrame = function(callback) { setTimeout(callback, 17); }; }); ================================================ FILE: lib/ace/lib/event_emitter.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var EventEmitter = {}; var stopPropagation = function() { this.propagationStopped = true; }; var preventDefault = function() { this.defaultPrevented = true; }; EventEmitter._emit = EventEmitter._dispatchEvent = function(eventName, e) { this._eventRegistry || (this._eventRegistry = {}); this._defaultHandlers || (this._defaultHandlers = {}); var listeners = this._eventRegistry[eventName] || []; var defaultHandler = this._defaultHandlers[eventName]; if (!listeners.length && !defaultHandler) return; if (typeof e != "object" || !e) e = {}; if (!e.type) e.type = eventName; if (!e.stopPropagation) e.stopPropagation = stopPropagation; if (!e.preventDefault) e.preventDefault = preventDefault; listeners = listeners.slice(); for (var i=0; i 0) { if (count & 1) result += string; if (count >>= 1) string += string; } return result; }; var trimBeginRegexp = /^\s\s*/; var trimEndRegexp = /\s\s*$/; exports.stringTrimLeft = function (string) { return string.replace(trimBeginRegexp, ''); }; exports.stringTrimRight = function (string) { return string.replace(trimEndRegexp, ''); }; exports.copyObject = function(obj) { var copy = {}; for (var key in obj) { copy[key] = obj[key]; } return copy; }; exports.copyArray = function(array){ var copy = []; for (var i=0, l=array.length; i * Provides an augmented, extensible, cross-browser implementation of regular expressions, * including support for additional syntax, flags, and methods */ define(function(require, exports, module) { "use strict"; //--------------------------------- // Private variables //--------------------------------- var real = { exec: RegExp.prototype.exec, test: RegExp.prototype.test, match: String.prototype.match, replace: String.prototype.replace, split: String.prototype.split }, compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups compliantLastIndexIncrement = function () { var x = /^/g; real.test.call(x, ""); return !x.lastIndex; }(); if (compliantLastIndexIncrement && compliantExecNpcg) return; //--------------------------------- // Overriden native methods //--------------------------------- // Adds named capture support (with backreferences returned as `result.name`), and fixes two // cross-browser issues per ES3: // - Captured values for nonparticipating capturing groups should be returned as `undefined`, // rather than the empty string. // - `lastIndex` should not be incremented after zero-length matches. RegExp.prototype.exec = function (str) { var match = real.exec.apply(this, arguments), name, r2; if ( typeof(str) == 'string' && match) { // Fix browsers whose `exec` methods don't consistently return `undefined` for // nonparticipating capturing groups if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) { r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", "")); // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed // matching due to characters outside the match real.replace.call(str.slice(match.index), r2, function () { for (var i = 1; i < arguments.length - 2; i++) { if (arguments[i] === undefined) match[i] = undefined; } }); } // Attach named capture properties if (this._xregexp && this._xregexp.captureNames) { for (var i = 1; i < match.length; i++) { name = this._xregexp.captureNames[i - 1]; if (name) match[name] = match[i]; } } // Fix browsers that increment `lastIndex` after zero-length matches if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index)) this.lastIndex--; } return match; }; // Don't override `test` if it won't change anything if (!compliantLastIndexIncrement) { // Fix browser bug in native method RegExp.prototype.test = function (str) { // Use the native `exec` to skip some processing overhead, even though the overriden // `exec` would take care of the `lastIndex` fix var match = real.exec.call(this, str); // Fix browsers that increment `lastIndex` after zero-length matches if (match && this.global && !match[0].length && (this.lastIndex > match.index)) this.lastIndex--; return !!match; }; } //--------------------------------- // Private helper functions //--------------------------------- function getNativeFlags (regex) { return (regex.global ? "g" : "") + (regex.ignoreCase ? "i" : "") + (regex.multiline ? "m" : "") + (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 (regex.sticky ? "y" : ""); } function indexOf (array, item, from) { if (Array.prototype.indexOf) // Use the native array method if available return array.indexOf(item, from); for (var i = from || 0; i < array.length; i++) { if (array[i] === item) return i; } return -1; } }); ================================================ FILE: lib/ace/lib/useragent.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; /* * I hate doing this, but we need some way to determine if the user is on a Mac * The reason is that users have different expectations of their key combinations. * * Take copy as an example, Mac people expect to use CMD or APPLE + C * Windows folks expect to use CTRL + C */ exports.OS = { LINUX: "LINUX", MAC: "MAC", WINDOWS: "WINDOWS" }; /* * Return an exports.OS constant */ exports.getOS = function() { if (exports.isMac) { return exports.OS.MAC; } else if (exports.isLinux) { return exports.OS.LINUX; } else { return exports.OS.WINDOWS; } }; // this can be called in non browser environments (e.g. from ace/requirejs/text) if (typeof navigator != "object") return; var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); var ua = navigator.userAgent; // Is the user using a browser that identifies itself as Windows exports.isWin = (os == "win"); // Is the user using a browser that identifies itself as Mac OS exports.isMac = (os == "mac"); // Is the user using a browser that identifies itself as Linux exports.isLinux = (os == "linux"); // Windows Store JavaScript apps (aka Metro apps written in HTML5 and JavaScript) do not use the "Microsoft Internet Explorer" string in their user agent, but "MSAppHost" instead. exports.isIE = (navigator.appName == "Microsoft Internet Explorer" || navigator.appName.indexOf("MSAppHost") >= 0) ? parseFloat((ua.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]) : parseFloat((ua.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]); // for ie exports.isOldIE = exports.isIE && exports.isIE < 9; // Is this Firefox or related? exports.isGecko = exports.isMozilla = ua.match(/ Gecko\/\d+/); // Is this Opera exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]"; // Is the user using a browser that identifies itself as WebKit exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined; exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined; exports.isAIR = ua.indexOf("AdobeAIR") >= 0; exports.isIPad = ua.indexOf("iPad") >= 0; exports.isChromeOS = ua.indexOf(" CrOS ") >= 0; exports.isIOS = /iPad|iPhone|iPod/.test(ua) && !window.MSStream; if (exports.isIOS) exports.isMac = true; }); ================================================ FILE: lib/ace/line_widgets.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("./lib/oop"); var dom = require("./lib/dom"); var Range = require("./range").Range; function LineWidgets(session) { this.session = session; this.session.widgetManager = this; this.session.getRowLength = this.getRowLength; this.session.$getWidgetScreenLength = this.$getWidgetScreenLength; this.updateOnChange = this.updateOnChange.bind(this); this.renderWidgets = this.renderWidgets.bind(this); this.measureWidgets = this.measureWidgets.bind(this); this.session._changedWidgets = []; this.$onChangeEditor = this.$onChangeEditor.bind(this); this.session.on("change", this.updateOnChange); this.session.on("changeFold", this.updateOnFold); this.session.on("changeEditor", this.$onChangeEditor); } (function() { this.getRowLength = function(row) { var h; if (this.lineWidgets) h = this.lineWidgets[row] && this.lineWidgets[row].rowCount || 0; else h = 0; if (!this.$useWrapMode || !this.$wrapData[row]) { return 1 + h; } else { return this.$wrapData[row].length + 1 + h; } }; this.$getWidgetScreenLength = function() { var screenRows = 0; this.lineWidgets.forEach(function(w){ if (w && w.rowCount && !w.hidden) screenRows += w.rowCount; }); return screenRows; }; this.$onChangeEditor = function(e) { this.attach(e.editor); }; this.attach = function(editor) { if (editor && editor.widgetManager && editor.widgetManager != this) editor.widgetManager.detach(); if (this.editor == editor) return; this.detach(); this.editor = editor; if (editor) { editor.widgetManager = this; editor.renderer.on("beforeRender", this.measureWidgets); editor.renderer.on("afterRender", this.renderWidgets); } }; this.detach = function(e) { var editor = this.editor; if (!editor) return; this.editor = null; editor.widgetManager = null; editor.renderer.off("beforeRender", this.measureWidgets); editor.renderer.off("afterRender", this.renderWidgets); var lineWidgets = this.session.lineWidgets; lineWidgets && lineWidgets.forEach(function(w) { if (w && w.el && w.el.parentNode) { w._inDocument = false; w.el.parentNode.removeChild(w.el); } }); }; this.updateOnFold = function(e, session) { var lineWidgets = session.lineWidgets; if (!lineWidgets || !e.action) return; var fold = e.data; var start = fold.start.row; var end = fold.end.row; var hide = e.action == "add"; for (var i = start + 1; i < end; i++) { if (lineWidgets[i]) lineWidgets[i].hidden = hide; } if (lineWidgets[end]) { if (hide) { if (!lineWidgets[start]) lineWidgets[start] = lineWidgets[end]; else lineWidgets[end].hidden = hide; } else { if (lineWidgets[start] == lineWidgets[end]) lineWidgets[start] = undefined; lineWidgets[end].hidden = hide; } } }; this.updateOnChange = function(delta) { var lineWidgets = this.session.lineWidgets; if (!lineWidgets) return; var startRow = delta.start.row; var len = delta.end.row - startRow; if (len === 0) { // return } else if (delta.action == 'remove') { var removed = lineWidgets.splice(startRow + 1, len); removed.forEach(function(w) { w && this.removeLineWidget(w); }, this); this.$updateRows(); } else { var args = new Array(len); args.unshift(startRow, 0); lineWidgets.splice.apply(lineWidgets, args); this.$updateRows(); } }; this.$updateRows = function() { var lineWidgets = this.session.lineWidgets; if (!lineWidgets) return; var noWidgets = true; lineWidgets.forEach(function(w, i) { if (w) { noWidgets = false; w.row = i; while (w.$oldWidget) { w.$oldWidget.row = i; w = w.$oldWidget; } } }); if (noWidgets) this.session.lineWidgets = null; }; this.addLineWidget = function(w) { if (!this.session.lineWidgets) this.session.lineWidgets = new Array(this.session.getLength()); var old = this.session.lineWidgets[w.row]; if (old) { w.$oldWidget = old; if (old.el && old.el.parentNode) { old.el.parentNode.removeChild(old.el); old._inDocument = false; } } this.session.lineWidgets[w.row] = w; w.session = this.session; var renderer = this.editor.renderer; if (w.html && !w.el) { w.el = dom.createElement("div"); w.el.innerHTML = w.html; } if (w.el) { dom.addCssClass(w.el, "ace_lineWidgetContainer"); w.el.style.position = "absolute"; w.el.style.zIndex = 5; renderer.container.appendChild(w.el); w._inDocument = true; } if (!w.coverGutter) { w.el.style.zIndex = 3; } if (w.pixelHeight == null) { w.pixelHeight = w.el.offsetHeight; } if (w.rowCount == null) { w.rowCount = w.pixelHeight / renderer.layerConfig.lineHeight; } var fold = this.session.getFoldAt(w.row, 0); w.$fold = fold; if (fold) { var lineWidgets = this.session.lineWidgets; if (w.row == fold.end.row && !lineWidgets[fold.start.row]) lineWidgets[fold.start.row] = w; else w.hidden = true; } this.session._emit("changeFold", {data:{start:{row: w.row}}}); this.$updateRows(); this.renderWidgets(null, renderer); this.onWidgetChanged(w); return w; }; this.removeLineWidget = function(w) { w._inDocument = false; w.session = null; if (w.el && w.el.parentNode) w.el.parentNode.removeChild(w.el); if (w.editor && w.editor.destroy) try { w.editor.destroy(); } catch(e){} if (this.session.lineWidgets) { var w1 = this.session.lineWidgets[w.row]; if (w1 == w) { this.session.lineWidgets[w.row] = w.$oldWidget; if (w.$oldWidget) this.onWidgetChanged(w.$oldWidget); } else { while (w1) { if (w1.$oldWidget == w) { w1.$oldWidget = w.$oldWidget; break; } w1 = w1.$oldWidget; } } } this.session._emit("changeFold", {data:{start:{row: w.row}}}); this.$updateRows(); }; this.getWidgetsAtRow = function(row) { var lineWidgets = this.session.lineWidgets; var w = lineWidgets && lineWidgets[row]; var list = []; while (w) { list.push(w); w = w.$oldWidget; } return list; }; this.onWidgetChanged = function(w) { this.session._changedWidgets.push(w); this.editor && this.editor.renderer.updateFull(); }; this.measureWidgets = function(e, renderer) { var changedWidgets = this.session._changedWidgets; var config = renderer.layerConfig; if (!changedWidgets || !changedWidgets.length) return; var min = Infinity; for (var i = 0; i < changedWidgets.length; i++) { var w = changedWidgets[i]; if (!w || !w.el) continue; if (w.session != this.session) continue; if (!w._inDocument) { if (this.session.lineWidgets[w.row] != w) continue; w._inDocument = true; renderer.container.appendChild(w.el); } w.h = w.el.offsetHeight; if (!w.fixedWidth) { w.w = w.el.offsetWidth; w.screenWidth = Math.ceil(w.w / config.characterWidth); } var rowCount = w.h / config.lineHeight; if (w.coverLine) { rowCount -= this.session.getRowLineCount(w.row); if (rowCount < 0) rowCount = 0; } if (w.rowCount != rowCount) { w.rowCount = rowCount; if (w.row < min) min = w.row; } } if (min != Infinity) { this.session._emit("changeFold", {data:{start:{row: min}}}); this.session.lineWidgetWidth = null; } this.session._changedWidgets = []; }; this.renderWidgets = function(e, renderer) { var config = renderer.layerConfig; var lineWidgets = this.session.lineWidgets; if (!lineWidgets) return; var first = Math.min(this.firstRow, config.firstRow); var last = Math.max(this.lastRow, config.lastRow, lineWidgets.length); while (first > 0 && !lineWidgets[first]) first--; this.firstRow = config.firstRow; this.lastRow = config.lastRow; renderer.$cursorLayer.config = config; for (var i = first; i <= last; i++) { var w = lineWidgets[i]; if (!w || !w.el) continue; if (w.hidden) { w.el.style.top = -100 - (w.pixelHeight || 0) + "px"; continue; } if (!w._inDocument) { w._inDocument = true; renderer.container.appendChild(w.el); } var top = renderer.$cursorLayer.getPixelPosition({row: i, column:0}, true).top; if (!w.coverLine) top += config.lineHeight * this.session.getRowLineCount(w.row); w.el.style.top = top - config.offset + "px"; var left = w.coverGutter ? 0 : renderer.gutterWidth; if (!w.fixedWidth) left -= renderer.scrollLeft; w.el.style.left = left + "px"; if (w.fullWidth && w.screenWidth) { w.el.style.minWidth = config.width + 2 * config.padding + "px"; } if (w.fixedWidth) { w.el.style.right = renderer.scrollBar.getWidth() + "px"; } else { w.el.style.right = ""; } } }; }).call(LineWidgets.prototype); exports.LineWidgets = LineWidgets; }); ================================================ FILE: lib/ace/mode/_test/Readme.md ================================================ `tokens_.json` files keep information about correct tokens and tokenizer states for all modes supported by ace. They are generated from `text_.txt` or `demo/kitchen-sink/doc/*` with ```sh node highlight_rules_test.js -gen ``` command. ================================================ FILE: lib/ace/mode/_test/highlight_rules_test.js ================================================ var fs = require("fs"); var path = require("path"); if (!fs.existsSync) fs.existsSync = path.existsSync; require("amd-loader"); var cwd = __dirname + "/"; var root = path.normalize(cwd + Array(5).join("../")); function jsFileList(path, filter) { if (!filter) filter = /_test/; return fs.readdirSync(path).map(function(x) { if (x.slice(-3) == ".js" && !filter.test(x) && !/\s/.test(x)) return x.slice(0, -3); }).filter(Boolean); } function modeList() { return jsFileList(cwd + "../", /_highlight_rules|_test|_worker|xml_util|_outdent|behaviour|completions/); } function checkModes() { modeList().forEach(function(modeName, i) { console.log(padNumber(i+1, 3) + ") check: \u001b[33m" + modeName + "\u001b[0m"); try { var Mode = require("../" + modeName).Mode; } catch(e) { console.warn("Can't load mode :" + modeName, e); return; } var m = new Mode(); if (!("lineCommentStart" in m) && !("blockComment" in m)) console.warn("missing comment in " + modeName); if (!m.$id) console.warn("missing id in " + modeName); var tokenizer = (new Mode).getTokenizer(); testComments(m.lineCommentStart, testLineComment, tokenizer, modeName); testComments(m.blockComment, testBlockComment, tokenizer, modeName); }); function testComments(desc, fn, tokenizer, modeName) { if (desc) { if (Array.isArray(desc)) { desc.forEach(function(x) { fn(tokenizer, x, modeName); }); } else { fn(tokenizer, desc, modeName); } } } function testBlockComment(tokenizer, blockComment, modeName) { if (blockComment.lineStartOnly) return; // TODO test var str = blockComment.start + " " + blockComment.end; str = blockComment.start + str; if (blockComment.nestable) str += blockComment.end; var data = tokenizer.getLineTokens(str, "start"); var isBroken = data.tokens.some(function(t) { return !/comment/.test(t.type); }); if (isBroken) console.warn("broken blockComment in " + modeName, data); if (!/start/.test(data.state)) console.warn("broken state after blockComment in " + modeName, data); } function testLineComment(tokenizer, commentStart, modeName) { var tokens = tokenizer.getLineTokens(commentStart + " ", "start").tokens; if (!/comment/.test(tokens[0].type)) console.warn("broken lineCommentStart in " + modeName); } } function generateTestData(names, force) { var docRoot = root + "/demo/kitchen-sink/docs"; var docs = fs.readdirSync(docRoot); var specialDocs = fs.readdirSync(cwd); var modes = modeList(); // console.log("Docs:", docs); // console.log("Modes:", modes); docs.forEach(function(docName) { var p = docName.toLowerCase().split("."); if (!p[1]) return; var modeName; if (modes.indexOf(p[0]) != -1) modeName = p[0]; else if (modes.indexOf(p[1]) != -1) modeName = p[1]; else modeName = {"txt": "text", cpp: "c_cpp"}[p[1]]; if (names && names.length && names.indexOf(modeName) == -1) return; var outputPath = cwd + "tokens_" + modeName + ".json"; try { var oldOutput = require(outputPath); } catch(e) {} if (oldOutput && !force) { var oldText = oldOutput.map(function(x) { if (x.length > 1 && typeof x[x.length - 1] == "string") return x[x.length - 1]; return x.slice(1).map(function(tok) { return tok[1]; }).join(""); }).join("\n"); } var filePath = "text_" + modeName + ".txt"; if (specialDocs.indexOf(filePath) !== -1) { filePath = cwd + filePath; } else { filePath = docRoot + "/" + docName; // oldText = ""; } var text = oldText ||fs.readFileSync(filePath, "utf8"); try { var Mode = require("../" + modeName).Mode; } catch(e) { console.warn("Can't load mode :" + modeName, p, e); return; } console.log(modeName); var tokenizer = new Mode().getTokenizer(); var state = "start"; var data = text.split(/\r\n|\r|\n/).map(function(line) { var data = tokenizer.getLineTokens(line, state); var tmp = []; tmp.push(JSON.stringify(data.state)); var tokenizedLine = ""; data.tokens.forEach(function(x) { tokenizedLine += x.value; tmp.push(JSON.stringify([x.type, x.value])); }); if (tokenizedLine != line) tmp.push(JSON.stringify(line)); state = data.state; return tmp.join(",\n "); }); var jsonStr = "[[\n " + data.join("\n],[\n ") + "\n]]"; if (oldOutput && JSON.stringify(JSON.parse(jsonStr)) == JSON.stringify(oldOutput)) return; fs.writeFileSync(outputPath, jsonStr, "utf8"); }); } function test(startAt) { var modes = fs.readdirSync(cwd).map(function(x) { return (x.match(/tokens_(.*).json/) || {})[1]; }).filter(function(x){return !!x;}); for (var i = Math.max(0, startAt||0); i < modes.length; i++) testMode(modes[i], i); console.log("\u001b[32m" + "all ok" + "\u001b[0m"); } function testMode(modeName, i) { console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m"); var text = fs.readFileSync(cwd + "tokens_" + modeName + ".json", "utf8"); var data = JSON.parse(text); var Mode = require("../" + modeName).Mode; var tokenizer = new Mode().getTokenizer(); var state = "start"; data.forEach(function(lineData) { lineData.values = []; lineData.types = []; lineData.state = lineData.shift(); var line = null; if (typeof lineData[lineData.length - 1] == "string") line = lineData.pop(); lineData.forEach(function(x) { lineData.types.push(x[0]); lineData.values.push(x[1]); }); if (typeof line != "string") line = lineData.values.join(""); var tokens = tokenizer.getLineTokens(line, state); var values = tokens.tokens.map(function(x) {return x.value;}); var types = tokens.tokens.map(function(x) {return x.type;}); var err = testEqual([ JSON.stringify(lineData.state), JSON.stringify(tokens.state), lineData.types, types, lineData.values, values]); if (err) { console.log(line); throw "error"; } state = tokens.state; }); } function testEqual(a) { var err; if (a[0] + "" !== a[1] + "") { console.log(a[0],a[1]); err = 1; } if ( a[2] + "" !== a[3] + "" || a[4] + "" !== a[5] + "") { arrayDiff(a[2],a[3]); arrayDiff(a[4],a[5]); err = 1; } return err; } function arrayDiff(a1, a2) { var l = Math.max(a1.length, a2.length); var out = []; for (var i = 0; i < l; i++) { out.push("\n", padNumber(i+1, 3), ") "); if (a1[i] !== a2[i]) out.push("\u001b[31m", a1[i], "\u001b[0m != \u001b[32m", a2[i], "\u001b[0m"); else out.push(a1[i]); } console.log(out.join("")); } function padNumber(num, digits) { return (" " + num).slice(-digits); } // cli var arg = process.argv[2]; if (!arg) { test(); checkModes(); } else if (/--?g(en)?/.test(arg)) generateTestData(process.argv.splice(3)); else if (/--?c(heck)?/.test(arg)) checkModes(); else if (/\d+/.test(arg)) test(parseInt(process.argv[2],10) || 0); else testMode(arg, -1); ================================================ FILE: lib/ace/mode/_test/package.json ================================================ { "name": "ace-mode-creator", "version": "0.1.0", "dependencies": { "connect": "", "socket.io": "" } } ================================================ FILE: lib/ace/mode/_test/text_asciidoc.txt ================================================ ------------------------------------ ----------------------------------- _ita_lic_, *bo*ld*, +mo+no+, normal. ``double quoted'', `single quoted'. normal, ^super^, ~sub~. '''' Escaped: \_italic_, +++_italic_+++, t\__e__st, +++t__e__st+++, +++bold+++, $$normal$$ \¶ ¶ \`not single quoted' \`\`not double quoted'' [fffff] +++++++++++++++++++++++++++++++++++++ (C) {ss} ss +++++++++++++++++++++++++++++++++++++ ............. callout <1> .............. > 1 1> 2 <2> 3 Escaped: \_italic_, t\__e__st, o__ .optional title ............. callout <1> .............. :macro: dddd .lists . 1 .. 2 ... d ..... big + continue + next line xi) no ++la+tin++ xi) la++tin++ 2. num__ber__ [red]#red# -- 5. f <> {macro} -- image::path[beauty] ->--<= -- replacements image::s sssss sss sssss == 1 heading === not a heading ==================================== ================================== ====4 NOTE: above NOTE: above [[x6]] WARNING: [options[]] --------------------------- literal --------------------------- = Tables |==================================== | _italic_ | *bold* | text | (R) |==================================== [more, options] /////////// comment /////////// // one line comment [red]#red text# [yellow-background]#on yellow# [big]#large# [red yellow-background big]*all bold* https://site text callto:ace http://ace.ajaxorg.com[awesome] .still normal text .break out thoug should not --------------------------- /////////////////////////// --------------------------- ================================================ FILE: lib/ace/mode/_test/text_coffee.txt ================================================ #test: tokenize keyword for (i 1..2) #test: tokenize regexp /"[a]/ #test: tokenize functions foo = ({args}) -> foo = ({a1, a2}) -> foo = ({@a1, a2}) -> foo : ({args}) -> foo = ({args}) -> foo = ({0abc}) -> foo = ({/abc}) => foo = ({abc/}) -> foo = ({#abc}) -> foo = ({abc#}) -> foo = ({)abc}) -> foo = ({abc)}) -> foo = ({a{bc}) -> foo = ({}) -> foo = ({ }) -> foo : ({}) -> foo = (args) -> foo = (arg1, arg2) -> foo = (arg1 = 1, arg2 = 'name') -> foo = (@arg1 = /abc/, arg2 = 'name') -> #test: tokenize function: invalid case: foo=(/args) -> foo = () -> foo = ( ) -> foo : ( ) -> window.foo = (args) -> foo = -> foo = -> foo : -> #test: tokenize callback function foo bar: 1, (args) -> foo = (1, 2 (x) -> #test: tokenize class class Foo class Foo extends Bar #test: tokenize illegal name property foo.static.function #!test tokenize string with interpolation a = "#{ 22 / 7 + {x: "#{a + b}"} + 2}" " #{ "" + {} } )" """heredoc """ do -> ### herecomment ### re = /regex/imgy.test /// heregex # comment ///imgy this isnt: `just JavaScript` undefined ================================================ FILE: lib/ace/mode/_test/text_coldfusion.txt ================================================ z ---> welcome="Hello World!"> z --> #welcome# Dateformat(now()) ================================================ FILE: lib/ace/mode/_test/text_curly.txt ================================================ tokenize Curly template{{test}} tokenize embedded script '123' tokenize multiline attribute value with double quotes tokenize multiline attribute value with single quotes ================================================ FILE: lib/ace/mode/_test/text_ejs.txt ================================================ Cloud9 Rocks! <% if (!isRoot) { %> <% } %> <% entries.forEach(function(entry) { %> <% }) %>
    Name Size
    ..
    <%= entry.name %> <%= entry.size %>
    value="<%=window%>" <% } %> /> ================================================ FILE: lib/ace/mode/_test/text_gobstones.txt ================================================ program { /* * A gobstons multiline comment * Taken from: * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/" */ sumar(2, 3) } function sumar(a, b) { r := a + b } // unreachable code -- unreachable code # unreachable code procedure hacerAlgo() { Mover(Este) Poner(Rojo) Sacar(Azul) } ================================================ FILE: lib/ace/mode/_test/text_html.txt ================================================ '123'
    ================================================ FILE: lib/ace/mode/_test/text_javascript.txt ================================================ //test: tokenize 'standard' functions string.charCodeAt(23); document.getElementById('test'); console.log('Here it is');"; test: /**tokenize doc*/ comment /**tokenize doc comment with @tag {}*/ //test: tokenize parens var $line$ = "[{( )}]"; //test tokenize arithmetic expression which looks like a regexp a/b/c a/=b/c //test tokenize reg exps a=/b/g a+/b/g a = 1 + /2 + 1/gimyxk a=/a/ / /a/ case /a/.test(c) //test tokenize multi-line comment containing a single line comment noRegex /* foo // bar */ canBeRegex; /* foo // bar */ // test tokenize identifier with umlauts fu?e // test // is not a regexp { // 123 //test skipping escaped chars 'Meh\\nNeh' console.log('\\u1232Feh' "test multiline\ strings" a=' b="\ still a string function foo(items, nada) { for (var i=0; i>=t<>r>>>s>=0b1 foo.protoype.d = function(a, b, c, d) foo.d =function(a, b) foo.d =function(a, /*****/ d"string" var o = { t:`${[].map(x => { return x })}` }; ================================================ FILE: lib/ace/mode/_test/text_livescript.txt ================================================ # comment ================================================ FILE: lib/ace/mode/_test/text_lucene.txt ================================================ test: recognises AND as keyword test: recognises OR as keyword test: recognises NOT as keyword test: recognises "hello this is dog" as string test: recognises -"hello this is dog" as negation with string test: recognises ~100 as text with proximity test: recognises "hello this is dog"~100 as string with proximity test: recognises raw:"hello this is dog" as keyword test: recognises raw:foo as"keyword' test: recognises "(" as opening parenthesis test: recognises ")" as closing parenthesis test: recognises foo* as text with asterisk test: recognises foo? as text with interro test: recognises single word as text foo ================================================ FILE: lib/ace/mode/_test/text_markdown.txt ================================================ test: header 1 #f test: header 2 ## foo test: header ends with ' #' # # # test: header ends with '#' #foo# test: 6+ #s is not a valid header ####### foo test: # followed be only space is not a valid header # test: only space between #s is not a valid header # # # test links [Cloud9 IDE](http://www.c9.io/) # * [demo](http://ajaxorg.github.com/ace/) [+](escape(\) ) [+](a "title") [+](a "space" ) * usually *work* fine (_em_) in lists in plain text http://ace.ajaxorg.com ================================================ FILE: lib/ace/mode/_test/text_php.txt ================================================ not &js; ================================================ FILE: lib/ace/mode/_test/text_ruby.txt ================================================ #test: symbol tokenizer [:@thing, :$thing, :_thing, :thing, :Thing, :thing1, :thing_a, :THING, :thing!, :thing=, :thing?, :t?, :, :@, :$, :1, :1thing, :th?ing, :thi=ng, :1thing, :th!ing, :thing# ] #test: namespaces aren't symbols" : function() { Namespaced::Class #test: hex tokenizer 0x9a, 0XA1, 0x9_a, 0x, 0x_9a, 0x9a_, #test: float tokenizer [1, +1, -1, 12_345, 0.000_1, _, 3_1, 1_2, 1_.0, 0._1]; {:id => ?", :key => "value", anotherKey: [x, y?]} =begin =end =begin x =end- =end x herDocs = [<<'FOO', <(vector: &[T], function: &fn(v: &T) -> U) -> ~[U] { let mut accumulator = ~[]; for vec::each(vector) |element| { accumulator.push(function(element)); } return accumulator; } // numbers 14E-111_f64; 45isize 0x1i32 0o777u32 0b01 14f32 1_2.78f32 1_2.3E+7f32 // not numbers 14._E-111_f64; 0xi32; 0b777u // identifiers ending in constant.numeric foo1; foo1u32; foo1f32; foo0xF; foo1.0 ================================================ FILE: lib/ace/mode/_test/text_wollok.txt ================================================ class Actividad { method calcularMejora() } class EstudiarMateria inherits Actividad { var materia var puntos = 0 new(m, p) { materia = m puntos = p } override method calcularMejora() = puntos } class EjercitarEnSimulador inherits Actividad { var horas = 0 new(h) { horas = h } override method calcularMejora() = 10 * horas } object pepita { var energia = 100 method volar(m) { energia -= m } } ================================================ FILE: lib/ace/mode/_test/text_xml.txt ================================================ //Juhu Kinners test: two tags in the same lines should be in separate tokens" test: multiline attributes" ================================================ FILE: lib/ace/mode/_test/tokens_abap.json ================================================ [[ "start", ["doc.comment","***************************************"] ],[ "start", ["doc.comment","** Program: EXAMPLE **"] ],[ "start", ["doc.comment","** Author: Joe Byte, 07-Jul-2007 **"] ],[ "start", ["doc.comment","***************************************"] ],[ "start", ["text"," "] ],[ "start", ["keyword","REPORT"], ["text"," BOOKINGS"], ["keyword.operator","."] ],[ "start", ["text"," "] ],[ "start", ["doc.comment","* Read flight bookings from the database"] ],[ "start", ["keyword","SELECT"], ["keyword.operator"," * "], ["keyword","FROM"], ["text"," FLIGHTINFO"] ],[ "start", ["text"," "], ["keyword","WHERE"], ["text"," "], ["keyword","CLASS"], ["keyword.operator"," = "], ["string","'Y'"], ["text"," "], ["comment","\"Y = economy"] ],[ "start", ["text"," "], ["keyword","OR"], ["text"," "], ["keyword","CLASS"], ["keyword.operator"," = "], ["string","'C'"], ["keyword.operator","."], ["text"," "], ["comment","\"C = business"] ],[ "start", ["paren.lparen","("], ["invalid","..."], ["paren.rparen",")"] ],[ "start" ],[ "start", ["keyword","REPORT"], ["text"," TEST"], ["keyword.operator","."] ],[ "start", ["keyword","WRITE"], ["text"," "], ["string","'Hello World'"], ["keyword.operator","."] ],[ "start" ],[ "start", ["text","USERPROMPT"], ["keyword.operator"," = "], ["string","'Please double-click on a line in the output list '"], ["text"," "], ["keyword.operator","&"] ],[ "start", ["text"," "], ["string","'to see the complete details of the transaction.'"], ["keyword.operator","."] ],[ "start" ],[ "start" ],[ "start", ["keyword","DATA"], ["text"," LAST_EOM "], ["keyword","TYPE"], ["text"," "], ["support.type","D"], ["keyword.operator","."], ["text"," "], ["comment","\"last end-of-month date"] ],[ "start", ["text"," "] ],[ "start", ["doc.comment","* Start from today's date"] ],[ "start", ["text"," LAST_EOM"], ["keyword.operator"," = "], ["variable.parameter","SY"], ["keyword.operator","-"], ["text","DATUM"], ["keyword.operator","."] ],[ "start", ["doc.comment","* Set characters 6 and 7 (0-relative) of the YYYYMMDD string to \"01\","] ],[ "start", ["doc.comment","* giving the first day of the current month"] ],[ "start", ["text"," LAST_EOM"], ["constant.numeric","+6"], ["paren.lparen","("], ["constant.numeric","2"], ["paren.rparen",")"], ["keyword.operator"," = "], ["string","'01'"], ["keyword.operator","."] ],[ "start", ["doc.comment","* Subtract one day"] ],[ "start", ["text"," LAST_EOM"], ["keyword.operator"," = "], ["text","LAST_EOM"], ["keyword.operator"," - "], ["constant.numeric","1"], ["keyword.operator","."] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","WRITE"], ["keyword.operator",":"], ["text"," "], ["string","'Last day of previous month was'"], ["keyword.operator",","], ["text"," LAST_EOM"], ["keyword.operator","."] ],[ "start", ["text"," "] ],[ "start", ["keyword","DATA"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["keyword","BEGIN OF"], ["text"," I_VBRK "], ["keyword","OCCURS"], ["text"," "], ["constant.numeric","0"], ["keyword.operator",","] ],[ "start", ["text"," VBELN "], ["keyword","LIKE"], ["text"," "], ["variable.parameter","VBRK-VBELN"], ["keyword.operator",","] ],[ "start", ["text"," ZUONR "], ["keyword","LIKE"], ["text"," "], ["variable.parameter","VBRK-ZUONR"], ["keyword.operator",","] ],[ "start", ["text"," "], ["keyword","END OF"], ["text"," I_VBRK"], ["keyword.operator","."] ],[ "start" ],[ "start", ["keyword","SORT"], ["text"," i_vbrk "], ["keyword","BY"], ["text"," vbeln "], ["keyword","ASCENDING"], ["keyword.operator","."] ],[ "start", ["keyword","SORT"], ["text"," i_vbrk "], ["keyword","BY"], ["text"," vbeln "], ["keyword","DESCENDING"], ["keyword.operator","."] ],[ "start" ],[ "start", ["keyword","RETURN"], ["keyword.operator","."] ]] ================================================ FILE: lib/ace/mode/_test/tokens_abc.json ================================================ [[ "start", ["comment.line.percentage","%abc-2.1"] ],[ "start", ["information.keyword","H:"], ["information.argument.string.unquoted","This file contains some example English tunes"] ],[ "start", ["comment.line.percentage","% note that the comments (like this one) are to highlight usages"] ],[ "start", ["comment.line.percentage","% and would not normally be included in such detail"] ],[ "start", ["information.keyword","O:"], ["information.argument.string.unquoted","England "], ["comment.line.percentage","% the origin of all tunes is England"] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","1 "], ["comment.line.percentage","% tune no 1"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Dusty Miller, The "], ["comment.line.percentage","% title"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Binny's Jig "], ["comment.line.percentage","% an alternative title"] ],[ "start", ["information.keyword","C:"], ["information.argument.string.unquoted","Trad. "], ["comment.line.percentage","% traditional"] ],[ "start", ["information.keyword","R:"], ["information.argument.string.unquoted","DH "], ["comment.line.percentage","% double hornpipe"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted","3/4 "], ["comment.line.percentage","% meter"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","G "], ["comment.line.percentage","% key"] ],[ "start", ["pitch.constant.numeric","B"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","c"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","B"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator",":|"] ],[ "start", ["pitch.constant.numeric","B"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","g"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","c"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","a"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator",":|"] ],[ "start", ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","/2"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","/2"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","c"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","/2"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","/2"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator",":|"] ],[ "start", ["information.keyword","W:"], ["information.argument.string.unquoted","Hey, the dusty miller, and his dusty coat;"] ],[ "start", ["information.keyword","W:"], ["information.argument.string.unquoted","He will win a shilling, or he spend a groat."] ],[ "start", ["information.keyword","W:"], ["information.argument.string.unquoted","Dusty was the coat, dusty was the colour;"] ],[ "start", ["information.keyword","W:"], ["information.argument.string.unquoted","Dusty was the kiss, that I got frae the miller."] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","2"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Old Sir Simon the King"] ],[ "start", ["information.keyword","C:"], ["information.argument.string.unquoted","Trad."] ],[ "start", ["information.keyword","S:"], ["information.argument.string.unquoted","Offord MSS "], ["comment.line.percentage","% from Offord manuscript"] ],[ "start", ["information.keyword","N:"], ["information.argument.string.unquoted","see also Playford "], ["comment.line.percentage","% reference note"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted","9/8"] ],[ "start", ["information.keyword","R:"], ["information.argument.string.unquoted","SJ "], ["comment.line.percentage","% slip jig"] ],[ "start", ["information.keyword","N:"], ["information.argument.string.unquoted","originally in C "], ["comment.line.percentage","% transcription note"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","G"] ],[ "start", ["pitch.constant.numeric","D"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","D"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","D"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","D"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"] ],[ "start", ["pitch.constant.numeric","D"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","D"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","D"], ["barline.keyword.operator","|[1"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["text","["], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","G"], ["text","] "], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","D"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"], ["text","\\ "], ["comment.line.percentage","% no line-break in score"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted","12/8 "], ["comment.line.percentage","% change of meter"] ],[ "start", ["barline.keyword.operator","[2"], ["text"," "], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["text","\\ "], ["comment.line.percentage","% no line-break in score"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted","9/8 "], ["comment.line.percentage","% change of meter"] ],[ "start", ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","E"], ["text"," "], ["pitch.constant.numeric","D"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|]"] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","3"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","William and Nancy"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","New Mown Hay"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Legacy, The"] ],[ "start", ["information.keyword","C:"], ["information.argument.string.unquoted","Trad."] ],[ "start", ["information.keyword","O:"], ["information.argument.string.unquoted","England; Gloucs; Bledington "], ["comment.line.percentage","% place of origin"] ],[ "start", ["information.keyword","B:"], ["information.argument.string.unquoted","Sussex Tune Book "], ["comment.line.percentage","% can be found in these books"] ],[ "start", ["information.keyword","B:"], ["information.argument.string.unquoted","Mally's Cotswold Morris vol.1 2"] ],[ "start", ["information.keyword","D:"], ["information.argument.string.unquoted","Morris On "], ["comment.line.percentage","% can be heard on this record"] ],[ "start", ["information.keyword","P:"], ["information.argument.string.unquoted","(AB)2(AC)2A "], ["comment.line.percentage","% play the parts in this order"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted","6/8"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","G "] ],[ "start", ["information.keyword.embedded","[P:"], ["information.argument.string.unquoted","A]"], ["text"," "], ["pitch.constant.numeric","D"], ["barline.keyword.operator","|"], ["string.quoted","\"G\""], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","F"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"] ],[ "start", ["information.keyword.embedded","[P:"], ["information.argument.string.unquoted","B]"], ["text"," "], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["string.quoted","\"G\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","e"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","e"], ["text"," "], ["string.quoted","\"D7\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","c"], ["barline.keyword.operator","|"] ],[ "start", ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","F"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"] ],[ "start", ["comment.line.percentage","% changes of meter, using inline fields"] ],[ "start", ["information.keyword.embedded","[T:"], ["information.argument.string.unquoted","Slows]"], ["information.keyword.embedded","[M:"], ["information.argument.string.unquoted","4/4]"], ["information.keyword.embedded","[L:"], ["information.argument.string.unquoted","1/4]"], ["information.keyword.embedded","[P:"], ["information.argument.string.unquoted","C]"], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["string.quoted","\"Em\""], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text"," "], ["string.quoted","\"A7\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["text","\\"] ],[ "start", ["text"," "], ["string.quoted","\"C\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["information.keyword.embedded","[M:"], ["information.argument.string.unquoted","3/8]"], ["information.keyword.embedded","[L:"], ["information.argument.string.unquoted","1/8]"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","d"], ["text"," "], ["barline.keyword.operator","|"], ["information.keyword.embedded","[M:"], ["information.argument.string.unquoted","6/8]"], ["text"," "], ["string.quoted","\"C\""], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","e"], ["text"," "], ["string.quoted","\"D7\""], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","c"], ["barline.keyword.operator","|"] ],[ "start", ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["string.quoted","\"C\""], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["string.quoted","\"D7\""], ["pitch.constant.numeric","F"], ["text"," "], ["string.quoted","\"G\""], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","4"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","South Downs Jig"] ],[ "start", ["information.keyword","R:"], ["information.argument.string.unquoted","jig"] ],[ "start", ["information.keyword","S:"], ["information.argument.string.unquoted","Robert Harbron"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted","6/8"] ],[ "start", ["information.keyword","L:"], ["information.argument.string.unquoted","1/8"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","G"] ],[ "start", ["barline.keyword.operator","|:"], ["text"," "], ["pitch.constant.numeric","d"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","3"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","e"], ["text"," "], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["text"," "], ["barline.keyword.operator","|"] ],[ "start", ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","3"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["text"," "], ["barline.keyword.operator",":|"] ],[ "start", ["pitch.constant.numeric","B"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","c"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","c"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["information.keyword.embedded","[M:"], ["information.argument.string.unquoted","9/8]"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","A"], ["duration.constant.numeric","3"], ["text"," "], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword.embedded","[M:"], ["information.argument.string.unquoted","6/8]"], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","E"], ["duration.constant.numeric","3"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","D"], ["text"," "], ["barline.keyword.operator","|"], ["text"," "], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["text"," "], ["barline.keyword.operator","|1"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["text"," "], ["barline.keyword.operator",":|2"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["duration.constant.numeric","3"], ["text"," "], ["barline.keyword.operator","|]"] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","5"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Atholl Brose"] ],[ "start", ["comment.line.percentage","% in this example, which reproduces Highland Bagpipe gracing,"] ],[ "start", ["comment.line.percentage","% the large number of grace notes mean that it is more convenient to be specific about"] ],[ "start", ["comment.line.percentage","% score line-breaks (using the $ symbol), rather than using code line breaks to indicate them"] ],[ "start", ["information.keyword","I:"], ["information.argument.string.unquoted","linebreak $"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","D"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["text","{"], ["pitch.constant.numeric","e"], ["text","}"], ["pitch.constant.numeric","A"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","e"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","A"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["text","{"], ["pitch.constant.numeric","e"], ["text","}"], ["pitch.constant.numeric","A"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","A"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","f"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","e"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["text","{"], ["pitch.constant.numeric","e"], ["text","}"], ["pitch.constant.numeric","A"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","e"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","A"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","G"], ["duration.constant.numeric",">"], ["text","{"], ["pitch.constant.numeric","d"], ["text","}"], ["pitch.constant.numeric","B"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","G"], ["text"," {"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["text","}"], ["pitch.constant.numeric","d"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","B"], ["barline.keyword.operator",":|"], ["text","$"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric","2"], ["text"," {"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","f"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","e"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","d"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","d"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","d"], ["text","}"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","<"], ["text","{"], ["pitch.constant.numeric","e"], ["text","}"], ["pitch.constant.numeric","G"], ["text"," {"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["text","}"], ["pitch.constant.numeric","d"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","a"], ["duration.constant.numeric","2"], ["text"," {"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","<"], ["text","{"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","G"], ["text","}"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","a"], ["text"," {"], ["pitch.constant.numeric","f"], ["text","}"], ["pitch.constant.numeric","g"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","e"], ["text"," {"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","f"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"] ],[ "start", ["text","{"], ["pitch.constant.numeric","g"], ["text","}"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","f"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","g"], ["text"," {"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["text","}"], ["pitch.constant.numeric","d"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","c"], ["text"," {"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","d"], ["text","}"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","<"], ["text","{"], ["pitch.constant.numeric","e"], ["text","}"], ["pitch.constant.numeric","G"], ["text"," {"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["text","}"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|]"] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","6"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Untitled Reel"] ],[ "start", ["information.keyword","C:"], ["information.argument.string.unquoted","Trad."] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","D"] ],[ "start", ["pitch.constant.numeric","e"], ["pitch.constant.numeric","g"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","a"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","b"], ["text"," "], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","g"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","b"], ["pitch.constant.numeric","g"], ["text"," "], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","g"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","g"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","f"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"], ["text","\\"] ],[ "start", ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","G"] ],[ "start", ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["text"," "], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|"] ],[ "start" ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted","7"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted","Kitchen Girl"] ],[ "start", ["information.keyword","C:"], ["information.argument.string.unquoted","Trad."] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","D"] ],[ "start", ["text","["], ["pitch.constant.numeric","c"], ["duration.constant.numeric","4"], ["pitch.constant.numeric","a"], ["duration.constant.numeric","4"], ["text","] ["], ["pitch.constant.numeric","B"], ["duration.constant.numeric","4"], ["pitch.constant.numeric","g"], ["duration.constant.numeric","4"], ["text","]"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","f"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","g"], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","b"], ["pitch.constant.numeric","a"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","g"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","g"], ["barline.keyword.operator","|"] ],[ "start", ["pitch.constant.numeric","a"], ["duration.constant.numeric","4"], ["text"," "], ["pitch.constant.numeric","g"], ["duration.constant.numeric","4"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","g"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["text"," "], ["pitch.constant.numeric","A"], ["duration.constant.numeric","4"], ["barline.keyword.operator",":|"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted","G"] ],[ "start", ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","D"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["text"," "], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","3"], ["pitch.constant.numeric","f"], ["text"," "], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"] ],[ "start", ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["text"," "], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","c"], ["text"," "], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","4"], ["text"," "], ["pitch.constant.numeric","A"], ["duration.constant.numeric","4"], ["barline.keyword.operator",":|"] ],[ "start" ],[ "start", ["comment.line.percentage","%abc-2.1"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","pagewidth 21cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","pageheight 29.7cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","topspace 0.5cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","topmargin 1cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","botmargin 0cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","leftmargin 1cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","rightmargin 1cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","titlespace 0cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","titlefont Times-Bold 32"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","subtitlefont Times-Bold 24"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","composerfont Times 16"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","vocalfont Times-Roman 14"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","staffsep 60pt"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","sysstaffsep 20pt"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","musicspace 1cm"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","vocalspace 5pt"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","measurenb 0"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","barsperstaff 5"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","scale 0.7"] ],[ "start", ["information.keyword","X:"], ["information.argument.string.unquoted"," 1"] ],[ "start", ["information.keyword","T:"], ["information.argument.string.unquoted"," Canzonetta a tre voci"] ],[ "start", ["information.keyword","C:"], ["information.argument.string.unquoted"," Claudio Monteverdi (1567-1643)"] ],[ "start", ["information.keyword","M:"], ["information.argument.string.unquoted"," C"] ],[ "start", ["information.keyword","L:"], ["information.argument.string.unquoted"," 1/4"] ],[ "start", ["information.keyword","Q:"], ["information.argument.string.unquoted"," \"Andante mosso\" 1/4 = 110"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","score [1 2 3]"] ],[ "start", ["information.keyword","V:"], ["information.argument.string.unquoted"," 1 clef=treble name=\"Soprano\"sname=\"A\""] ],[ "start", ["information.keyword","V:"], ["information.argument.string.unquoted"," 2 clef=treble name=\"Alto\" sname=\"T\""] ],[ "start", ["information.keyword","V:"], ["information.argument.string.unquoted"," 3 clef=bass middle=d name=\"Tenor\" sname=\"B\""] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","MIDI program 1 75 % recorder"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","MIDI program 2 75"] ],[ "start", ["information.comment.line.percentage","%%"], ["information.keyword.embedded","MIDI program 3 75"] ],[ "start", ["information.keyword","K:"], ["information.argument.string.unquoted"," Eb"] ],[ "start", ["comment.line.percentage","% 1 - 4"] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 1]"], ["text"," "], ["barline.keyword.operator","|:"], ["pitch.constant.numeric","z"], ["duration.constant.numeric","4"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","z"], ["duration.constant.numeric","4"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","f"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["text"," "], ["barline.keyword.operator","|"], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","c"], ["text"," "], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," Son que-sti~i cre-spi cri-ni~e"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," Que-sti son gli~oc-chi che mi-"] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 2]"], ["text"," "], ["barline.keyword.operator","|:"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","c"], ["barline.keyword.operator","|"], ["text","("], ["pitch.constant.numeric","F"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","/"], ["text",")"], ["pitch.constant.numeric","c"], ["accent.constant.language","="], ["pitch.constant.numeric","A"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","A"], ["text"," "], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," Son que-sti~i cre-spi cri-ni~e que - - - - sto~il vi-so e"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," Que-sti son~gli oc-chi che mi-ran - - - - do fi-so mi-"] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 3]"], ["text"," "], ["barline.keyword.operator","|:"], ["pitch.constant.numeric","z"], ["duration.constant.numeric","4"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","f"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["barline.keyword.operator","|"], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","f"], ["text"," "], ["barline.keyword.operator","|"], ["text","("], ["pitch.constant.numeric","B"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","/"], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","/"], ["text",")"], ["pitch.constant.numeric","f"], ["pitch.constant.numeric","f"], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," Son que-sti~i cre-spi cri-ni~e que - - - - sto~il"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," Que-sti son~gli oc-chi che mi-ran - - - - do"] ],[ "start", ["comment.line.percentage","% 5 - 9"] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 1]"], ["text"," "], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","A"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","3"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["string.quoted","!fermata!"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","z"], ["text"," "], ["barline.keyword.operator","::"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","4"], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," ran-do fi-so, tut-to re-stai con-qui-so."] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 2]"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","F"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","3"], ["pitch.constant.numeric","F"], ["barline.keyword.operator","|"], ["accent.constant.language","="], ["pitch.constant.numeric","E"], ["duration.constant.numeric","2"], ["string.quoted","!fermata!"], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","z"], ["barline.keyword.operator","::"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","4"], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," que-sto~il vi-so ond' io ri-man-go~uc-ci-so. Deh,"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," ran-do fi-so tut-to re-stai con-qui-so."] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 3]"], ["text"," ("], ["pitch.constant.numeric","a"], ["pitch.constant.numeric","g"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","f"], ["duration.constant.numeric","/"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["text",")"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","3"], ["pitch.constant.numeric","B"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["string.quoted","!fermata!"], ["pitch.constant.numeric","c"], ["pitch.constant.numeric","z"], ["text"," "], ["barline.keyword.operator","::"], ["pitch.constant.numeric","A"], ["duration.constant.numeric","4"], ["barline.keyword.operator","|"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," vi - - - so ond' io ti-man-go~uc-ci-so. Deh,"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," fi - - - so tut-to re-stai con-qui-so."] ],[ "start", ["comment.line.percentage","% 10 - 15"] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 1]"], ["text"," "], ["pitch.constant.numeric","f"], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","e"], ["pitch.constant.numeric","c"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","B"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","2"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","z"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["text"," "], ["barline.keyword.operator","|"], ["text","\\"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," dim-me-lo ben mi-o, che que-sto"], ["text","\\"] ],[ "start", ["accent.constant.language","="], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["text"," "], ["barline.keyword.operator","|1"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","z"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|2"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","8"], ["barline.keyword.operator","|]"], ["text"," "], ["comment.line.percentage","% more notes"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," sol de-si-o_. "], ["comment.line.percentage","% more lyrics"] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 2]"], ["text"," "], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","A"], ["text"," "], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","A"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["accent.constant.language","="], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["text"," "], ["barline.keyword.operator","|"], ["text","("], ["pitch.constant.numeric","G"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","3/2"], ["accent.constant.language","="], ["pitch.constant.numeric","E"], ["duration.constant.numeric","//"], ["pitch.constant.numeric","D"], ["duration.constant.numeric","//"], ["pitch.constant.numeric","E"], ["text",")"], ["barline.keyword.operator","|1"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","z"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|2"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","8"], ["barline.keyword.operator","|]"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," dim-me-lo ben mi-o, che que-sto sol de-si - - - - o_."] ],[ "start", ["information.keyword.embedded","[V:"], ["information.argument.string.unquoted"," 3]"], ["text"," "], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["pitch.constant.numeric","B"], ["pitch.constant.numeric","c"], ["duration.constant.numeric",">"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","e"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","A"], ["pitch.constant.numeric","F"], ["barline.keyword.operator","|"], ["accent.constant.language","="], ["pitch.constant.numeric","E"], ["pitch.constant.numeric","F"], ["pitch.constant.numeric","c"], ["accent.constant.language","_"], ["pitch.constant.numeric","d"], ["barline.keyword.operator","|"], ["pitch.constant.numeric","c"], ["duration.constant.numeric","4"], ["text"," "], ["barline.keyword.operator","|1"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","2"], ["pitch.constant.numeric","z"], ["duration.constant.numeric","2"], ["barline.keyword.operator",":|2"], ["pitch.constant.numeric","F"], ["duration.constant.numeric","8"], ["barline.keyword.operator","|]"] ],[ "start", ["information.keyword","w:"], ["information.argument.string.unquoted"," dim-me-lo ben mi-o, che que-sto sol de-si-o_."] ]] ================================================ FILE: lib/ace/mode/_test/tokens_actionscript.json ================================================ [[ "start", ["text","package code"] ],[ "start", ["text","{"] ],[ "punctuation.definition.comment.actionscript.2", ["text"," "], ["punctuation.definition.comment.actionscript.2","/*"], ["comment.block.actionscript.2","****************************************"] ],[ "punctuation.definition.comment.actionscript.2", ["comment.block.actionscript.2","\t * based on textmate actionscript bundle"] ],[ "start", ["comment.block.actionscript.2","\t ***************************************"], ["punctuation.definition.comment.actionscript.2","*/"] ],[ "start", ["text","\t "] ],[ "start", ["text","\t"], ["keyword.control.actionscript.2","import"], ["text"," fl.events.SliderEvent;"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["keyword.control.actionscript.2","public"], ["text"," "], ["storage.type.class.actionscript.2","class"], ["meta.class.actionscript.2"," "], ["entity.name.type.class.actionscript.2","Foo"], ["meta.class.actionscript.2"," "], ["storage.modifier.extends.actionscript.2","extends"], ["meta.class.actionscript.2"," "], ["entity.other.inherited-class.actionscript.2","MovieClip"] ],[ "start", ["text","\t{"] ],[ "start", ["text","\t\t"], ["punctuation.definition.comment.actionscript.2","//*************************"] ],[ "start", ["text","\t\t"], ["punctuation.definition.comment.actionscript.2","// Properties:"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["keyword.control.actionscript.2","public"], ["text"," "], ["keyword.control.actionscript.2","var"], ["text"," activeSwatch"], ["keyword.operator.symbolic.actionscript.2",":"], ["support.class.actionscript.2","MovieClip"], ["text",";"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["punctuation.definition.comment.actionscript.2","// Color offsets"] ],[ "start", ["text","\t\t"], ["keyword.control.actionscript.2","public"], ["text"," "], ["keyword.control.actionscript.2","var"], ["text"," c1"], ["keyword.operator.symbolic.actionscript.2",":"], ["storage.type.actionscript.2","Number"], ["text"," "], ["keyword.operator.symbolic.actionscript.2","="], ["text"," "], ["constant.numeric.actionscript.2","0"], ["text",";\t"], ["punctuation.definition.comment.actionscript.2","// R"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["punctuation.definition.comment.actionscript.2","//*************************"] ],[ "start", ["text","\t\t"], ["punctuation.definition.comment.actionscript.2","// Constructor:"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\t"], ["keyword.control.actionscript.2","public"], ["text"," "], ["storage.type.function.actionscript.2","function"], ["meta.function.actionscript.2"," "], ["entity.name.function.actionscript.2","Foo"], ["punctuation.definition.parameters.begin.actionscript.2","("], ["punctuation.definition.parameters.end.actionscript.2",")"] ],[ "start", ["text","\t\t{"] ],[ "start", ["text","\t\t\t"], ["punctuation.definition.comment.actionscript.2","// Respond to mouse events"] ],[ "start", ["text","\t\t\tswatch1_btn."], ["support.function.actionscript.2","addEventListener"], ["text","(MouseEvent.CLICK,swatchHandler,"], ["constant.language.actionscript.2","false"], ["text",","], ["constant.numeric.actionscript.2","0"], ["text",","], ["constant.language.actionscript.2","false"], ["text",");"] ],[ "start", ["text","\t\t\tpreviewBox_btn."], ["support.function.actionscript.2","addEventListener"], ["text","(MouseEvent.MOUSE_DOWN,dragPressHandler);"] ],[ "start", ["text","\t\t\t"] ],[ "start", ["text","\t\t\t"], ["punctuation.definition.comment.actionscript.2","// Respond to drag events"] ],[ "start", ["text","\t\t\tred_slider."], ["support.function.actionscript.2","addEventListener"], ["text","(SliderEvent.THUMB_DRAG,sliderHandler);"] ],[ "start", ["text","\t\t\t"] ],[ "start", ["text","\t\t\t"], ["punctuation.definition.comment.actionscript.2","// Draw a frame later"] ],[ "start", ["text","\t\t\t"], ["support.function.actionscript.2","addEventListener"], ["text","(Event.ENTER_FRAME,"], ["support.function.actionscript.2","draw"], ["text",");"] ],[ "start", ["text","\t\t}"] ],[ "start", ["text"," "] ],[ "start", ["text","\t\tprotected "], ["storage.type.function.actionscript.2","function"], ["meta.function.actionscript.2"," "], ["entity.name.function.actionscript.2","clickHandler"], ["punctuation.definition.parameters.begin.actionscript.2","("], ["variable.parameter.function.actionscript.2","event:MouseEvent"], ["punctuation.definition.parameters.end.actionscript.2",")"], ["keyword.operator.symbolic.actionscript.2",":"], ["support.function.actionscript.2","void"] ],[ "start", ["text","\t\t{"] ],[ "start", ["text","\t\t\tcar.transform.colorTransform "], ["keyword.operator.symbolic.actionscript.2","="], ["text"," "], ["keyword.control.actionscript.2","new"], ["text"," ColorTransform("], ["constant.numeric.actionscript.2","0"], ["text",","], ["constant.numeric.actionscript.2","0"], ["text",","], ["constant.numeric.actionscript.2","0"], ["text",","], ["constant.numeric.actionscript.2","1"], ["text",",c1,c2,c3);"] ],[ "start", ["text","\t\t}"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t\tprotected "], ["storage.type.function.actionscript.2","function"], ["meta.function.actionscript.2"," "], ["entity.name.function.actionscript.2","changeRGBHandler"], ["punctuation.definition.parameters.begin.actionscript.2","("], ["variable.parameter.function.actionscript.2","event:Event"], ["punctuation.definition.parameters.end.actionscript.2",")"], ["keyword.operator.symbolic.actionscript.2",":"], ["support.function.actionscript.2","void"] ],[ "start", ["text","\t\t{"] ],[ "start", ["text","\t\t\tc1 "], ["keyword.operator.symbolic.actionscript.2","="], ["text"," "], ["storage.type.actionscript.2","Number"], ["text","(c1_txt."], ["support.function.actionscript.2","text"], ["text",");"] ],[ "start", ["text"," "] ],[ "start", ["text","\t\t\t"], ["keyword.control.actionscript.2","if"], ["text","("], ["keyword.operator.symbolic.actionscript.2","!"], ["text","(c1>"], ["keyword.operator.symbolic.actionscript.2","="], ["constant.numeric.actionscript.2","0"], ["text",")){"] ],[ "start", ["text","\t\t\t\tc1 "], ["keyword.operator.symbolic.actionscript.2","="], ["text"," "], ["constant.numeric.actionscript.2","0"], ["text",";"] ],[ "start", ["text","\t\t\t}\t\t\t"] ],[ "start", ["text","\t\t\t"] ],[ "start", ["text","\t\t\tupdateSliders();"] ],[ "start", ["text","\t\t}"] ],[ "start", ["text","\t}"] ],[ "start", ["text","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_ada.json ================================================ [[ "start", ["keyword","with"], ["text"," "], ["identifier","Ada"], ["text","."], ["identifier","Text_IO"], ["text","; "], ["keyword","use"], ["text"," "], ["identifier","Ada"], ["text","."], ["identifier","Text_IO"], ["text",";"] ],[ "start", ["keyword","procedure"], ["text"," "], ["identifier","Hello"], ["text"," "], ["keyword","is"] ],[ "start", ["keyword","begin"] ],[ "start", ["text"," "], ["identifier","Put_Line"], ["paren.lparen","("], ["string","\"Hello, world!\""], ["paren.rparen",")"], ["text",";"] ],[ "start", ["keyword","end"], ["text"," "], ["identifier","Hello"], ["text",";"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_asciidoc.json ================================================ [[ "literalBlock", ["support.function","------------------------------------"] ],[ "dissallowDelimitedBlock", ["support.function","-----------------------------------"] ],[ "text", ["string.italic","_ita_lic_"], ["text",", "], ["keyword.bold","*bo*ld*"], ["text",", "], ["support.function","+mo+no+"], ["text",", normal. "] ],[ "text", ["keyword","``"], ["text","double quoted"], ["keyword","''"], ["text",", `single quoted'."] ],[ "text", ["text"," normal, ^super^, "], ["keyword","~sub~"], ["text","."] ],[ "start" ],[ "text", ["text","''''"] ],[ "text", ["text","Escaped:"] ],[ "text", ["constant.language.escape","\\_"], ["text","italic_, "], ["support.function","+++"], ["text","_italic_"], ["support.function","+++"], ["text",","] ],[ "smallPassthrough", ["text","t"], ["constant.language.escape","\\_"], ["text","_e"], ["string.italic","__st, +++t__"], ["text","e__st"], ["support.function","+++"], ["text",","] ],[ "smallPassthrough", ["support.function","+++"], ["text","bold"], ["support.function","+++"], ["text",", $$<"], ["support.function","b"], ["text",">"], ["support.function","normal"], ["text","$$"] ],[ "smallPassthrough", ["text","\\&#"], ["support.function","182"], ["text","; &#"], ["support.function","182"], ["text",";"] ],[ "smallPassthrough", ["text","\\`"], ["support.function","not"], ["text"," "], ["support.function","single"], ["text"," "], ["support.function","quoted"], ["text","'"] ],[ "smallPassthrough", ["text","\\`\\`"], ["support.function","not"], ["text"," "], ["support.function","double"], ["text"," "], ["support.function","quoted"], ["text","''"] ],[ "dissallowDelimitedBlock" ],[ "text" ],[ "start", ["string.regexp","[fffff]"] ],[ "passthroughBlock", ["string","+++++++++++++++++++++++++++++++++++++"] ],[ "passthroughBlock", ["support.function","(C) "], ["constant.character","{ss}"], ["support.function"," ss"] ],[ "dissallowDelimitedBlock", ["support.function","+++++++++++++++++++++++++++++++++++++"] ],[ "text" ],[ "listingBlock", ["support.function","............."] ],[ "listingBlock", ["support.function","callout "], ["constant.numeric","<1>"] ],[ "dissallowDelimitedBlock", ["support.function",".............."] ],[ "text" ],[ "text", ["text","> 1"] ],[ "text", ["text","1> 2"] ],[ "text", ["text","<2> 3"] ],[ "start" ],[ "text", ["text","Escaped:"] ],[ "text", ["constant.language.escape","\\_"], ["text","italic_,"] ],[ "text", ["text","t"], ["constant.language.escape","\\_"], ["text","_e"], ["string.italic","__st, o__"] ],[ "start" ],[ "start", ["constant.numeric",".optional title"] ],[ "listingBlock", ["support.function","............."] ],[ "listingBlock", ["support.function","callout "], ["constant.numeric","<1>"] ],[ "dissallowDelimitedBlock", ["support.function",".............."] ],[ "text" ],[ "start" ],[ "text", ["keyword",":macro:"], ["text"," dddd"] ],[ "start" ],[ "start", ["constant.numeric",".lists"] ],[ "listText", ["keyword",". "], ["text","1"] ],[ "listText", ["keyword",".. "], ["text","2"] ],[ "listText", ["keyword","... "], ["text","d"] ],[ "listText", ["keyword","..... "], ["text","big"] ],[ "start", ["keyword","+"] ],[ "text", ["text","continue"], ["keyword"," +"] ],[ "text", ["text","next line"] ],[ "text", ["text","xi) no "], ["support.function","++la+tin++"] ],[ "start" ],[ "listText", ["keyword","xi) "], ["text","la"], ["support.function","++tin++"] ],[ "listText", ["keyword","2. "], ["text","num"], ["string.italic","__ber__"], ["text"," [red]"], ["keyword","#"], ["text","red"], ["keyword","#"] ],[ "start", ["keyword","--"] ],[ "listText", ["keyword"," 5. "], ["text","f "], ["keyword","<>"], ["text"," "], ["constant.character","{macro}"] ],[ "start", ["keyword","--"] ],[ "text", ["markup.list.macro","image::"], ["keyword","path"], ["string","[beauty]"], ["text"," "], ["constant.language.escape","->"], ["text","--"], ["constant.language.escape","<= --"], ["text"," replacements"] ],[ "start" ],[ "indentedBlock", ["support.function"," image::s"] ],[ "indentedBlock", ["support.function","sssss"] ],[ "indentedBlock", ["support.function","sss "] ],[ "indentedBlock", ["support.function","sssss"] ],[ "start" ],[ "start" ],[ "start", ["markup.heading","== 1"] ],[ "indentedBlock", ["support.function"," heading"] ],[ "start", ["markup.heading","=== not a heading"] ],[ "start", ["keyword","===================================="] ],[ "start" ],[ "start", ["keyword","=================================="] ],[ "text", ["text","====4 "] ],[ "text", ["text","NOTE: above"] ],[ "start" ],[ "text", ["keyword","NOTE:"], ["text"," above"] ],[ "start" ],[ "start", ["string.regexp","[[x6]]"] ],[ "text", ["keyword","WARNING:"], ["text"," "] ],[ "start" ],[ "start", ["string.regexp","[options[]]"] ],[ "literalBlock", ["support.function","---------------------------"] ],[ "literalBlock", ["support.function","literal"] ],[ "dissallowDelimitedBlock", ["support.function","---------------------------"] ],[ "text" ],[ "start" ],[ "start", ["markup.heading","= Tables"] ],[ "tableBlock", ["doc.comment","|===================================="] ],[ "tableBlock", ["doc.comment","|"], ["text"," "], ["string.italic","_italic_"], ["text"," "], ["doc.comment","|"], ["text"," "], ["keyword.bold","*bold*"], ["text"," "], ["doc.comment","|"], ["text"," text "], ["doc.comment","|"], ["text"," "], ["constant.language.escape","(R)"] ],[ "tableBlock" ],[ "dissallowDelimitedBlock", ["doc.comment","|===================================="] ],[ "text" ],[ "start" ],[ "start", ["string.regexp","[more, options]"] ],[ "commentBlock", ["doc.comment","///////////"] ],[ "commentBlock", ["doc.comment","comment"] ],[ "dissallowDelimitedBlock", ["doc.comment","///////////"] ],[ "text", ["comment","// one line comment"] ],[ "start" ],[ "start" ],[ "start" ],[ "text", ["text","[red]"], ["keyword","#"], ["text","red text"], ["keyword","#"], ["text"," [yellow-background]"], ["keyword","#"], ["text","on yellow"], ["keyword","#"] ],[ "text", ["text","[big]"], ["keyword","#"], ["text","large"], ["keyword","#"], ["text"," [red yellow-background big]"], ["keyword.bold","*all bold*"] ],[ "start" ],[ "start", ["text","\t"] ],[ "text", ["markup.underline.list","https://site"], ["text"," text <"], ["markup.underline.list","mail@i.am"], ["text","> "], ["markup.underline.list","callto:ace"], ["text"," "], ["link","http://ace.ajaxorg.com"], ["variable.language","[awesome]"] ],[ "text", ["text"," .still normal text"] ],[ "start", ["constant.numeric",".break out thoug should not"] ],[ "literalBlock", ["support.function","---------------------------"] ],[ "literalBlock", ["support.function","///////////////////////////"] ],[ "dissallowDelimitedBlock", ["support.function","---------------------------"] ],[ "text" ],[ "start" ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_assembly_x86.json ================================================ [[ "start", ["support.function.directive.assembly","section"], ["text","\t.text"] ],[ "start", ["text"," "], ["support.function.directive.assembly","global"], ["text"," "], ["entity.name.function.assembly","main"], ["text"," "], ["comment.assembly",";must be declared for using gcc"] ],[ "start" ],[ "start", ["entity.name.function.assembly","main:"], ["text","\t "], ["comment.assembly",";tell linker entry point"] ],[ "start" ],[ "start", ["text","\t"], ["keyword.control.assembly","mov"], ["text","\t"], ["variable.parameter.register.assembly","edx"], ["text",", len\t "], ["comment.assembly",";message length"] ],[ "start", ["text","\t"], ["keyword.control.assembly","mov"], ["text","\t"], ["variable.parameter.register.assembly","ecx"], ["text",", msg\t "], ["comment.assembly",";message to write"] ],[ "start", ["text","\t"], ["keyword.control.assembly","mov"], ["text","\t"], ["variable.parameter.register.assembly","ebx"], ["text",", "], ["constant.character.decimal.assembly","1"], ["text","\t "], ["comment.assembly",";file descriptor (stdout)"] ],[ "start", ["text","\t"], ["keyword.control.assembly","mov"], ["text","\t"], ["variable.parameter.register.assembly","eax"], ["text",", "], ["constant.character.decimal.assembly","4"], ["text","\t "], ["comment.assembly",";system call number (sys_write)"] ],[ "start", ["text","\t"], ["keyword.control.assembly","int"], ["text","\t"], ["constant.character.hexadecimal.assembly","0x80"], ["text","\t "], ["comment.assembly",";call kernel"] ],[ "start" ],[ "start", ["text","\t"], ["keyword.control.assembly","mov"], ["text","\t"], ["variable.parameter.register.assembly","eax"], ["text",", "], ["constant.character.decimal.assembly","1"], ["text","\t "], ["comment.assembly",";system call number (sys_exit)"] ],[ "start", ["text","\t"], ["keyword.control.assembly","int"], ["text","\t"], ["constant.character.hexadecimal.assembly","0x80"], ["text","\t "], ["comment.assembly",";call kernel"] ],[ "start" ],[ "start", ["support.function.directive.assembly","section"], ["text","\t.data"] ],[ "start" ],[ "start", ["entity.name.function.assembly","msg"], ["text","\t"], ["support.function.directive.assembly","db"], ["text","\t"], ["string.assembly","'Hello, world!'"], ["text",","], ["constant.character.hexadecimal.assembly","0xa"], ["text","\t"], ["comment.assembly",";our dear string"] ],[ "start", ["entity.name.function.assembly","len"], ["text","\t"], ["support.function.directive.assembly","equ"], ["text","\t$ - msg\t\t\t"], ["comment.assembly",";length of our dear string"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_autohotkey.json ================================================ [[ "start", ["punctuation.ahk","#"], ["keyword.command.ahk","NoEnv"] ],[ "start", ["keyword.command.ahk","SetBatchLines"], ["text"," "], ["constant.numeric","-1"] ],[ "start" ],[ "start", ["keyword.command.ahk","CoordMode"], ["text"," "], ["variable.parameter","Mouse"], ["punctuation.ahk",","], ["text"," "], ["variable.parameter","Screen"] ],[ "start", ["keyword.command.ahk","OnExit"], ["text"," "], ["variable.parameter","GuiClose"] ],[ "start" ],[ "start", ["text","zoom "], ["keyword.operator.ahk",":="], ["text"," 9"] ],[ "start" ],[ "start", ["text","computeSize"], ["punctuation.ahk","(){"] ],[ "start", ["text","\t"], ["keyword.control.ahk","global"], ["text"," as_x"] ],[ "start", ["text","\tas_x "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","Round"], ["punctuation.ahk","("], ["text","ws_x"], ["keyword.operator.ahk","/"], ["text","zoom"], ["keyword.operator.ahk","/"], ["text","2 "], ["keyword.operator.ahk","-"], ["text"," 0.5"], ["punctuation.ahk",")"] ],[ "start", ["text","\t"], ["keyword.control.ahk","if"], ["text"," "], ["punctuation.ahk","("], ["text","zoom"], ["keyword.operator.ahk",">"], ["text","1"], ["punctuation.ahk",")"], ["text"," "], ["punctuation.ahk","{"] ],[ "start", ["text","\t\tpix "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","Round"], ["punctuation.ahk","("], ["text","zoom"], ["punctuation.ahk",")"] ],[ "start", ["text","\t"], ["punctuation.ahk","}"], ["text"," ele "], ["punctuation.ahk","{"] ],[ "start", ["text","\t\tpix "], ["keyword.operator.ahk",":="], ["text"," 1"] ],[ "start", ["text","\t"], ["punctuation.ahk","}"] ],[ "start", ["text"," "], ["keyword.command.ahk","ToolTip"], ["text"," Message "], ["punctuation.ahk","%"], ["text","as_x"], ["punctuation.ahk","%"], ["text"," "], ["punctuation.ahk","%"], ["text","zoom"], ["punctuation.ahk","%"], ["text"," "], ["punctuation.ahk","%"], ["text","ws_x"], ["punctuation.ahk","%"], ["text"," "], ["punctuation.ahk","%"], ["text","hws_x"], ["punctuation.ahk","%"], ["text"," "] ],[ "start", ["punctuation.ahk","}"] ],[ "start" ],[ "start", ["text","hdc_frame "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","DllCall"], ["punctuation.ahk","("], ["punctuation.quote.double","\""], ["string.quoted.ahk","GetDC"], ["punctuation.quote.double","\""], ["punctuation.ahk",","], ["text"," UInt"], ["punctuation.ahk",","], ["text"," MagnifierID"], ["punctuation.ahk",")"] ],[ "start" ],[ "start", ["comment.line.ahk","; comment"] ],[ "start", ["text","DrawCross"], ["punctuation.ahk","("], ["keyword.control.ahk","byRef"], ["text"," x"], ["keyword.operator.ahk","="], ["punctuation.quote.double","\""], ["punctuation.quote.double","\""], ["punctuation.ahk",","], ["text"," rX"], ["punctuation.ahk",","], ["text","rY"], ["punctuation.ahk",","], ["text","z"], ["punctuation.ahk",","], ["text"," dc"], ["punctuation.ahk","){"] ],[ "start", ["text"," "], ["comment.line.ahk"," ;specify the style, thickness and color of the cross lines"] ],[ "start", ["text"," h_pen "], ["keyword.operator.ahk",":="], ["text"," "], ["support.function.ahk","DllCall"], ["punctuation.ahk","("], ["text"," "], ["punctuation.quote.double","\""], ["string.quoted.ahk","gdi32.dll\\CreatePen"], ["punctuation.quote.double","\""], ["punctuation.ahk",","], ["text"," "], ["constant.language","Int"], ["punctuation.ahk",","], ["text"," 0"], ["punctuation.ahk",","], ["text"," "], ["constant.language","Int"], ["punctuation.ahk",","], ["text"," 1"], ["punctuation.ahk",","], ["text"," UInt"], ["punctuation.ahk",","], ["text"," 0x0000FF"], ["punctuation.ahk",")"] ],[ "start", ["punctuation.ahk","}"] ],[ "start" ],[ "start", ["comment.line.ahk",";Ctrl ^; Shift +; Win #; Alt !"] ],[ "start", ["text","^"], ["support.constant.ahk","NumPadAdd"], ["keyword.operator.ahk","::"] ],[ "start", ["text","^"], ["support.constant.ahk","WheelUp"], ["keyword.operator.ahk","::"], ["text"," "] ],[ "start", ["text","^;"], ["keyword.operator.ahk","::"], ["text"," "], ["comment.line.ahk"," ;comment"] ],[ "start", ["text"," "], ["keyword.control.ahk","If"], ["punctuation.ahk","("], ["text","zoom "], ["keyword.operator.ahk","<"], ["text"," ws_x "], ["variable.parameter","and"], ["text"," "], ["punctuation.ahk","("], ["text"," "], ["variable.predefined.ahk","A_ThisHotKey"], ["text"," "], ["keyword.operator.ahk","="], ["text"," "], ["punctuation.quote.double","\""], ["string.quoted.ahk","^WheelUp"], ["punctuation.quote.double","\""], ["text"," "], ["variable.parameter","or"], ["text"," "], ["variable.predefined.ahk","A_ThisHotKey"], ["text"," "], ["keyword.operator.ahk","="], ["punctuation.quote.double","\""], ["string.quoted.ahk","^NumPadAdd"], ["punctuation.quote.double","\""], ["punctuation.ahk",")"], ["text"," "], ["punctuation.ahk",")"] ],[ "start", ["text","\t\tzoom "], ["keyword.operator.ahk","*="], ["text"," 1.189207115 "], ["comment.line.ahk"," ; sqrt(sqrt(2))"] ],[ "start", ["text","\t"], ["keyword.command.ahk","Gosub"], ["punctuation.ahk",","], ["text","setZoom"] ],[ "start", ["keyword.control.ahk","return"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_batchfile.json ================================================ [[ "start", ["comment.line.colons.dosbatch",":: batch file highlighting in Ace!"] ],[ "start", ["text","@"], ["keyword.command.dosbatch","echo"], ["text"," off"] ],[ "start" ],[ "start", ["keyword.control.statement.dosbatch","CALL"], ["text"," "], ["keyword.command.dosbatch","set"], ["text"," var1="], ["constant.numeric","%cd%"] ],[ "start", ["keyword.command.dosbatch","echo"], ["text"," unhide everything in "], ["constant.numeric","%var1%"], ["text","!"] ],[ "start" ],[ "start", ["comment.line.colons.dosbatch",":: FOR loop in bat is super strange!"] ],[ "start", ["keyword.control.repeat.dosbatch","FOR"], ["text"," /f "], ["punctuation.definition.string.begin.shell","\""], ["string.quoted.double.dosbatch","tokens=*"], ["punctuation.definition.string.end.shell","\""], ["text"," "], ["constant.numeric","%%G"], ["text"," IN ('"], ["keyword.command.dosbatch","dir"], ["text"," /A:D /b') DO ("] ],[ "start", ["keyword.command.dosbatch","echo"], ["text"," "], ["constant.numeric","%var1%%%G"] ],[ "start", ["keyword.command.dosbatch","attrib"], ["text"," -r -a -h -s "], ["punctuation.definition.string.begin.shell","\""], ["constant.numeric","%var1%%%G"], ["punctuation.definition.string.end.shell","\""], ["text"," /D /S"] ],[ "start", ["text",")"] ],[ "start" ],[ "start", ["keyword.command.dosbatch","pause"] ],[ "start" ],[ "start", ["doc.comment","REM"], ["comment"," that's all"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_c9search.json ================================================ [[ ["start",{}], ["text","Searching for '"], ["text","var"], ["text","' in"], ["text"," /.c9/metadata/workspace/plugins "], ["text","(regexp, case sensitive, whole word)"], "Searching for \u0001var\u0001 in\u0001/.c9/metadata/workspace/plugins\u0001\u0001regexp, case sensitive, whole word\u0001" ],[ ["start",{}] ],[ ["start",{}], ["string","configs/default.js"], ["text",":"] ],[ ["start",{}], ["c9searchresults.constant.numeric"," 1"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," fs = require(\"fs\");"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t2"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," argv = require('optimist').argv;"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t3"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," path = require(\"path\");"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t5"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," clientExtensions = {};"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t6"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," clientDirs = fs.readdirSync(__dirname + \"/../plugins-client\");"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t7"], ["c9searchresults.text",": "], ["c9searchresults.text","for ("], ["c9searchresults.keyword","var"], ["c9searchresults.text"," i = 0; i < clientDirs.length; i++) {"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t8"], ["c9searchresults.text",": "], ["c9searchresults.text"," "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," dir = clientDirs[i];"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t12"], ["c9searchresults.text",": "], ["c9searchresults.text"," "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," name = dir.split(\".\")[1];"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t16"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t17"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," fsUrl = \"/workspace\";"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t19"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," port = argv.p || process.env.PORT || 3131;"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t20"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," host = argv.l || \"localhost\";"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t22"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," config = {"] ],[ ["start",{}] ],[ ["start",{}], ["string","configs/local.js"], ["text",":"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t2"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," config = require(\"./default\");"] ],[ ["start",{}] ],[ ["start",{}], ["string","configs/packed.js"], ["text",":"] ],[ ["start",{}], ["c9searchresults.constant.numeric","\t1"], ["c9searchresults.text",": "], ["c9searchresults.keyword","var"], ["c9searchresults.text"," config = require(\"./default\");"] ],[ ["start",{}] ],[ ["start",{}] ],[ ["start",{}], ["text","Found "], ["constant.numeric","15"], ["text"," matches in "], ["constant.numeric","3"], ["text"," files"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_c_cpp.json ================================================ [[ "start", ["comment","// compound assignment operators"] ],[ "start" ],[ "start", ["keyword","#include"], ["constant.other"," "] ],[ "start" ],[ "directive", ["keyword","#include"], ["constant.other.multiline"," \\"] ],[ "start", ["constant.other"," "] ],[ "start" ],[ "directive", ["keyword","#include"], ["constant.other.multiline"," \\"] ],[ "directive", ["constant.other.multiline"," \\"] ],[ "start", ["constant.other"," "] ],[ "start" ],[ "directive", ["keyword","#include"], ["constant.other.multiline"," \\"] ],[ "directive", ["constant.other.multiline"," \\"] ],[ "start", ["constant.other"," \"iostream\""] ],[ "start" ],[ "start", ["keyword","#include"], ["constant.other"," "] ],[ "start", ["keyword","#include"], ["constant.other"," \"boost/asio/io_service.hpp\""] ],[ "start" ],[ "directive", ["keyword","#include"], ["constant.other.multiline"," \\"] ],[ "directive", ["constant.other.multiline"," \\"] ],[ "directive", ["constant.other.multiline"," \"iostream\" \\"] ],[ "directive", ["constant.other.multiline"," \"string\" \\"] ],[ "start", ["constant.other"," "] ],[ "start", ["text"," "] ],[ "start", ["keyword.control","using"], ["text"," "], ["keyword.operator","namespace"], ["text"," "], ["identifier","std"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["comment","//"] ],[ "start", ["storage.type","int"], ["text"," "], ["identifier","main"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","int"], ["text"," "], ["identifier","a"], ["punctuation.operator",","], ["text"," "], ["identifier","b"], ["keyword.operator","="], ["constant.numeric","3"], ["punctuation.operator",";"], ["text"," "], ["comment","/* foobar */"] ],[ "singleLineComment", ["text"," "], ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","b"], ["punctuation.operator",";"], ["text"," "], ["comment","// single line comment\\"] ],[ "start", ["comment"," continued"] ],[ "start", ["text"," "], ["identifier","a"], ["keyword.operator","+="], ["constant.numeric","2"], ["punctuation.operator",";"], ["text"," "], ["comment","// equivalent to a=a+2"] ],[ "start", ["text"," "], ["identifier","cout"], ["text"," "], ["keyword.operator","<<"], ["text"," "], ["identifier","a"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","#if"], ["text"," "], ["identifier","VERBOSE"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","2"] ],[ "start", ["text"," "], ["identifier","prints"], ["paren.lparen","("], ["string.start","\""], ["string","trace message"], ["constant.language.escape","\\n"], ["string.end","\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","#endif"] ],[ "start", ["text"," "], ["keyword.control","return"], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","/* Print an error message and get out */"] ],[ "directive", ["keyword","#define"], ["constant.other.multiline"," ABORT \\"] ],[ "directive", ["constant.other.multiline"," do { \\"] ],[ "directive", ["constant.other.multiline"," print( \"Abort\\n\" ); \\"] ],[ "directive", ["constant.other.multiline"," exit(8); \\"] ],[ "start", ["constant.other","} while (0) "], ["comment","/* Note: No semicolon */"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_cirru.json ================================================ [[ "start", ["comment.line.double-dash","-- https://github.com/Cirru/cirru-gopher/blob/master/code/scope.cr,"] ],[ "start" ],[ "line", ["support.function","set"], ["text"," "], ["variable.parameter","a"], ["text"," "], ["storage.modifier","("], ["support.function","int"], ["text"," "], ["constant.numeric","2"], ["storage.modifier",")"] ],[ "start" ],[ "line", ["support.function","print"], ["text"," "], ["storage.modifier","("], ["support.function","self"], ["storage.modifier",")"] ],[ "start" ],[ "line", ["support.function","set"], ["text"," "], ["variable.parameter","c"], ["text"," "], ["storage.modifier","("], ["support.function","child"], ["storage.modifier",")"] ],[ "start" ],[ "line", ["support.function","under"], ["text"," "], ["variable.parameter","c"] ],[ "line", ["markup.raw"," "], ["support.function","under"], ["text"," "], ["variable.parameter","parent"] ],[ "line", ["markup.raw"," "], ["support.function","print"], ["text"," "], ["variable.parameter","a"] ],[ "start" ],[ "line", ["support.function","print"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","get"], ["text"," "], ["variable.parameter","c"], ["text"," "], ["variable.parameter","a"] ],[ "start" ],[ "line", ["support.function","set"], ["text"," "], ["variable.parameter","c"], ["text"," "], ["variable.parameter","x"], ["text"," "], ["storage.modifier","("], ["support.function","int"], ["text"," "], ["constant.numeric","3"], ["storage.modifier",")"] ],[ "line", ["support.function","print"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","get"], ["text"," "], ["variable.parameter","c"], ["text"," "], ["variable.parameter","x"] ],[ "start" ],[ "line", ["support.function","set"], ["text"," "], ["variable.parameter","just-print"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","code"] ],[ "line", ["markup.raw"," "], ["support.function","print"], ["text"," "], ["variable.parameter","a"] ],[ "start" ],[ "line", ["support.function","print"], ["text"," "], ["variable.parameter","just-print"] ],[ "start" ],[ "line", ["support.function","eval"], ["text"," "], ["storage.modifier","("], ["support.function","self"], ["storage.modifier",")"], ["text"," "], ["variable.parameter","just-print"] ],[ "line", ["support.function","eval"], ["text"," "], ["variable.parameter","just-print"] ],[ "start" ],[ "line", ["support.function","print"], ["text"," "], ["storage.modifier","("], ["support.function","string"], ["text"," "], ["string.quoted.double","\"string with space\""], ["storage.modifier",")"] ],[ "line", ["support.function","print"], ["text"," "], ["storage.modifier","("], ["support.function","string"], ["text"," "], ["string.quoted.double","\"escapes "], ["constant.character.escape","\\n"], ["string.quoted.double"," "], ["constant.character.escape","\\\"\\\\"], ["string.quoted.double","\""], ["storage.modifier",")"] ],[ "start" ],[ "start", ["support.function","brackets"], ["text"," "], ["storage.modifier","((((()))))"] ],[ "start" ],[ "line", ["string.quoted.double","\"eval\""], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","string"], ["text"," "], ["string.quoted.double","\"eval\""] ],[ "start" ],[ "line", ["support.function","print"], ["text"," "], ["storage.modifier","("], ["support.function","add"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["storage.modifier","("], ["support.function","int"], ["text"," "], ["constant.numeric","1"], ["storage.modifier",")"], ["text"," "], ["storage.modifier","("], ["support.function","int"], ["text"," "], ["constant.numeric","2"], ["storage.modifier","))"] ],[ "start" ],[ "start", ["support.function","print"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","unwrap"], ["text"," "], ["storage.modifier","$"] ],[ "line", ["text"," "], ["support.function","map"], ["text"," "], ["storage.modifier","("], ["support.function","a"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","int"], ["text"," "], ["constant.numeric","1"], ["storage.modifier",")"], ["text"," "], ["storage.modifier","("], ["support.function","b"], ["text"," "], ["storage.modifier","$"], ["text"," "], ["support.function","int"], ["text"," "], ["constant.numeric","2"], ["storage.modifier",")"] ],[ "start" ],[ "line", ["support.function","print"], ["text"," "], ["variable.parameter","a"] ],[ "line", ["markup.raw"," "], ["support.function","int"], ["text"," "], ["constant.numeric","1"] ],[ "line", ["markup.raw"," "], ["storage.modifier",","], ["text"," "], ["variable.parameter","b"], ["text"," "], ["variable.parameter","c"] ],[ "line", ["markup.raw"," "], ["support.function","int"], ["text"," "], ["constant.numeric","2"] ],[ "line", ["markup.raw"," "], ["storage.modifier",","], ["text"," "], ["variable.parameter","d"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_clojure.json ================================================ [[ "start", ["keyword","("], ["support.function","defn"], ["text"," "], ["identifier","parting"] ],[ "start", ["text"," "], ["string","\"returns a String parting in a given language\""] ],[ "start", ["text"," "], ["keyword","([]"], ["text"," "], ["keyword","("], ["identifier","parting"], ["text"," "], ["string","\"World\""], ["keyword","))"] ],[ "start", ["text"," "], ["keyword","(["], ["support.function","name"], ["keyword","]"], ["text"," "], ["keyword","("], ["identifier","parting"], ["text"," "], ["support.function","name"], ["text"," "], ["string","\"en\""], ["keyword","))"] ],[ "start", ["text"," "], ["keyword","(["], ["support.function","name"], ["text"," "], ["identifier","language"], ["keyword","]"] ],[ "start", ["text"," "], ["comment","; condp is similar to a case statement in other languages."] ],[ "start", ["text"," "], ["comment","; It is described in more detail later."] ],[ "start", ["text"," "], ["comment","; It is used here to take different actions based on whether the"] ],[ "start", ["text"," "], ["comment","; parameter \"language\" is set to \"en\", \"es\" or something else."] ],[ "start", ["text"," "], ["keyword","("], ["support.function","condp"], ["text"," "], ["constant.language","="], ["text"," "], ["identifier","language"] ],[ "start", ["text"," "], ["string","\"en\""], ["text"," "], ["keyword","("], ["support.function","str"], ["text"," "], ["string","\"Goodbye, \""], ["text"," "], ["support.function","name"], ["keyword",")"] ],[ "start", ["text"," "], ["string","\"es\""], ["text"," "], ["keyword","("], ["support.function","str"], ["text"," "], ["string","\"Adios, \""], ["text"," "], ["support.function","name"], ["keyword",")"] ],[ "start", ["text"," "], ["keyword","(throw"], ["text"," "], ["keyword","("], ["identifier","IllegalArgumentException"], ["text","."] ],[ "start", ["text"," "], ["keyword","("], ["support.function","str"], ["text"," "], ["string","\"unsupported language \""], ["text"," "], ["identifier","language"], ["keyword","))))))"] ],[ "start" ],[ "start", ["keyword","("], ["support.function","println"], ["text"," "], ["keyword","("], ["identifier","parting"], ["keyword","))"], ["text"," "], ["comment","; -> Goodbye, World"] ],[ "start", ["keyword","("], ["support.function","println"], ["text"," "], ["keyword","("], ["identifier","parting"], ["text"," "], ["string","\"Mark\""], ["keyword","))"], ["text"," "], ["comment","; -> Goodbye, Mark"] ],[ "start", ["keyword","("], ["support.function","println"], ["text"," "], ["keyword","("], ["identifier","parting"], ["text"," "], ["string","\"Mark\""], ["text"," "], ["string","\"es\""], ["keyword","))"], ["text"," "], ["comment","; -> Adios, Mark"] ],[ "start", ["keyword","("], ["support.function","println"], ["text"," "], ["keyword","("], ["identifier","parting"], ["text"," "], ["string","\"Mark\""], ["text",", "], ["string","\"xy\""], ["keyword","))"], ["text"," "], ["comment","; -> java.lang.IllegalArgumentException: unsupported language xy"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_cobol.json ================================================ [[ "start", ["identifier","TODO"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_coffee.json ================================================ [[ "start", ["comment","#test: tokenize keyword"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["constant.numeric","1"], ["punctuation.operator",".."], ["constant.numeric","2"], ["paren.rparen",")"] ],[ "start", ["comment","#test: tokenize regexp"] ],[ "start", ["string.regex","/\"[a]/"] ],[ "start", ["comment","#test: tokenize functions"] ],[ "start", ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{args}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{a1, a2}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{@a1, a2}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["paren.lparen","("], ["variable.parameter","{args}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{args}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{0abc}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["identifier","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["paren","{"], ["keyword.operator","/"], ["identifier","abc"], ["paren","}"], ["paren.rparen",")"], ["text"," "], ["storage.type","=>"] ],[ "start", ["text"," "], ["identifier","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["paren","{"], ["identifier","abc"], ["keyword.operator","/"], ["paren","}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{#abc}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{abc#}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["identifier","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["paren","{"], ["paren.rparen",")"], ["identifier","abc"], ["paren","}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["identifier","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["paren","{"], ["identifier","abc"], ["paren.rparen",")"], ["paren","}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{a{bc}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","{ }"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["paren.lparen","("], ["variable.parameter","{}"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","args"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","arg1, arg2"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","arg1 = 1, arg2 = 'name'"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","@arg1 = /abc/, arg2 = 'name'"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["comment","#test: tokenize function: invalid case:"] ],[ "start", ["text"," "], ["identifier","foo"], ["keyword.operator","="], ["paren.lparen","("], ["keyword.operator","/"], ["identifier","args"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter"," "], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["paren.lparen","("], ["variable.parameter"," "], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["variable.language","window"], ["punctuation.operator","."], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["variable.parameter","args"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["entity.name.function","foo"], ["text"," "], ["keyword.operator",":"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["comment","#test: tokenize callback function"] ],[ "start", ["text"," "], ["identifier","foo"], ["text"," "], ["identifier","bar"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["paren.lparen","("], ["variable.parameter","args"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["text"," "], ["identifier","foo"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","2"], ["text"," "], ["paren.lparen","("], ["variable.parameter","x"], ["paren.rparen",")"], ["text"," "], ["storage.type","->"] ],[ "start", ["comment","#test: tokenize class"] ],[ "start", ["keyword","class"], ["text"," "], ["language.support.class","Foo"] ],[ "start", ["keyword","class"], ["text"," "], ["language.support.class","Foo"], ["text"," "], ["keyword","extends"], ["text"," "], ["language.support.class","Bar"] ],[ "start", ["comment","#test: tokenize illegal name property"] ],[ "start", ["identifier","foo"], ["punctuation.operator","."], ["identifier","static"], ["punctuation.operator","."], ["identifier","function"] ],[ "start", ["comment","#!test tokenize string with interpolation"] ],[ "start", ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","\""], ["paren.string","#{"], ["text"," "], ["constant.numeric","22"], ["text"," "], ["keyword.operator","/"], ["text"," "], ["constant.numeric","7"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["paren","{"], ["identifier","x"], ["keyword.operator",":"], ["text"," "], ["string.start","\""], ["paren.string","#{"], ["identifier","a"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","b"], ["paren.string","}"], ["string.end","\""], ["paren","}"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","2"], ["paren.string","}"], ["string.end","\""] ],[ "start", ["string.start","\""], ["string"," "], ["paren.string","#{"], ["text"," "], ["string.start","\""], ["string.end","\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["paren","{}"], ["text"," "], ["paren.string","}"], ["string"," )"], ["string.end","\""], ["text"," "] ],[ "qqdoc", ["string","\"\"\"heredoc"] ],[ "start", ["string"," \"\"\""] ],[ "start", ["keyword","do"], ["text"," "], ["storage.type","->"] ],[ "comment", ["text"," "], ["comment","###"] ],[ "comment", ["comment"," herecomment"] ],[ "start", ["comment"," ###"] ],[ "heregex", ["text"," "], ["identifier","re"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.regex","/regex/imgy"], ["punctuation.operator","."], ["identifier","test"], ["text"," "], ["string.regex","///"] ],[ "heregex", ["comment.regex"," "], ["string.regex","heregex"], ["comment.regex"," # comment"] ],[ "start", ["string.regex"," ///imgy"] ],[ "js", ["text"," "], ["keyword","this"], ["text"," "], ["keyword","isnt"], ["keyword.operator",":"], ["text"," "], ["string","`just "] ],[ "start", ["string"," JavaScript`"] ],[ "start", ["text"," "], ["constant.language","undefined"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_coldfusion.json ================================================ [[ "start", ["comment.start",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["keyword.tag-name.xml","cfset"], ["text.tag-whitespace.xml"," "], ["comment.start",""], ["comment"," z "], ["comment.end","--->"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","welcome"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Hello World!\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["comment.start.xml",""], ["comment.xml"," z "], ["comment.end.xml","-->"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["keyword.tag-name.xml","cfoutput"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","#welcome#"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "cfjs-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.cfscript.tag-name.xml","cfscript"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "cfjs-no_regex", ["text"," "], ["identifier","Dateformat"], ["paren.lparen","("], ["identifier","now"], ["paren.lparen","("], ["paren.rparen","))"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_csharp.json ================================================ [[ "start", ["keyword","public"], ["text"," "], ["keyword","void"], ["text"," "], ["identifier","HelloWorld"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","//Say Hello!"] ],[ "start", ["text"," "], ["identifier","Console"], ["punctuation.operator","."], ["identifier","WriteLine"], ["paren.lparen","("], ["string.start","\""], ["string","Hello World"], ["string.end","\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_csound_document.json ================================================ [[ "start", ["text.csound-document","/*"] ],[ "start", ["text.csound-document"," * comment"] ],[ "start", ["text.csound-document"," */"] ],[ "start", ["text.csound-document","; comment"] ],[ "start", ["text.csound-document","// comment"] ],[ "start", ["text.csound-document","/"] ],[ "synthesizer", ["meta.tag.punctuation.tag-open.csound-document","<"], ["entity.name.tag.begin.csound-document","CsoundSynthesizer"], ["meta.tag.punctuation.tag-close.csound-document",">"] ],[ "csound-start", ["meta.tag.punctuation.tag-open.csound-document","<"], ["entity.name.tag.begin.csound-document","CsInstruments"], ["meta.tag.punctuation.tag-close.csound-document",">"] ],[ "csound-start", ["variable.language.csound","0dbfs"], ["text"," "], ["keyword.operator.csound","="], ["text"," "], ["constant.numeric.integer.decimal.csound","1"] ],[ "csound-start", ["support.function.csound","prints"], ["text"," "], ["punctuation.definition.string.begin.csound","\""], ["string.quoted.csound","hello, world"], ["constant.character.escape.csound","\\n"], ["punctuation.definition.string.end.csound","\""] ],[ "synthesizer", ["meta.tag.punctuation.end-tag-open.csound-document",""] ],[ "csound-score-start", ["meta.tag.punctuation.tag-open.csound-document","<"], ["entity.name.tag.begin.csound-document","CsScore"], ["meta.tag.punctuation.tag-close.csound-document",">"] ],[ "csound-score-start", ["keyword.control.csound-score","i"], ["text"," "], ["constant.numeric.integer.decimal.csound","1"], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text"," "], ["constant.numeric.integer.decimal.csound","0"] ],[ "synthesizer", ["meta.tag.punctuation.end-tag-open.csound-document",""] ],[ "html-start", ["meta.tag.punctuation.tag-open.csound-document","<"], ["entity.name.tag.begin.csound-document","html"], ["meta.tag.punctuation.tag-close.csound-document",">"] ],[ "html-start", ["xml-pe.doctype.xml",""] ],[ "synthesizer", ["meta.tag.punctuation.end-tag-open.csound-document",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.csound-document",""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_csound_orchestra.json ================================================ [[ "punctuation.definition.comment.begin.csound", ["punctuation.definition.comment.begin.csound","/*"] ],[ "punctuation.definition.comment.begin.csound", ["comment.block.csound"," * comment"] ],[ "start", ["comment.block.csound"," "], ["punctuation.definition.comment.end.csound","*/"] ],[ "start", ["comment.line.semicolon.csound","; comment"] ],[ "start", ["comment.line.double-slash.csound","// comment"] ],[ "start" ],[ "start", ["keyword.function.csound","instr"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["entity.name.function.csound","1"], ["text",","], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["entity.name.function.csound","N_a_M_e_"], ["text",","], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["text","+"], ["entity.name.function.csound","Name"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["comment.line.double-slash.csound","//"] ],[ "start", ["text"," "], ["text.csound","iDuration"], ["text"," "], ["keyword.operator.csound","="], ["text"," "], ["support.variable.csound","p3"] ],[ "start", ["text"," "], ["support.function.csound","outc"], ["punctuation.type-annotation.csound",":"], ["type-annotation.storage.type.csound","a"], ["text","("], ["text.csound","aSignal"], ["text",")"] ],[ "start", ["keyword.other.csound","endin"] ],[ "start" ],[ "start", ["keyword.function.csound","opcode"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["entity.name.function.opcode.csound","aUDO"], ["text",","], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["storage.type.csound","i[]"], ["text",","], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["storage.type.csound","aik"], ["comment.line.double-slash.csound","//"] ],[ "start", ["text"," "], ["text.csound","aUDO"] ],[ "start", ["keyword.other.csound","endop"] ],[ "start" ],[ "start", ["constant.numeric.integer.decimal.csound","123"], ["text"," "], ["constant.numeric.integer.decimal.csound","0123456789"] ],[ "start", ["storage.type.number.csound","0x"], ["constant.numeric.integer.hexadecimal.csound","abcdef0123456789"], ["text"," "], ["storage.type.number.csound","0X"], ["constant.numeric.integer.hexadecimal.csound","ABCDEF"] ],[ "start", ["constant.numeric.float.csound","1e2"], ["text"," "], ["constant.numeric.float.csound","3e+4"], ["text"," "], ["constant.numeric.float.csound","5e-6"], ["text"," "], ["constant.numeric.float.csound","7E8"], ["text"," "], ["constant.numeric.float.csound","9E+0"], ["text"," "], ["constant.numeric.float.csound","1E-2"], ["text"," "], ["constant.numeric.float.csound","3."], ["text"," "], ["constant.numeric.float.csound","4.56"], ["text"," "], ["constant.numeric.float.csound",".789"] ],[ "start" ],[ "start", ["punctuation.definition.string.begin.csound","\""], ["string.quoted.csound","characters"], ["entity.name.function.preprocessor.csound","$MACRO."], ["punctuation.definition.string.end.csound","\""] ],[ "start", ["punctuation.definition.string.begin.csound","\""], ["constant.character.escape.csound","\\\\\\a\\b\\n\\r\\t\\012\\345\\67\\\""], ["punctuation.definition.string.end.csound","\""] ],[ "start" ],[ ["#tmp","braced string","start","braced string"], ["punctuation.definition.string.begin.csound","{{"] ],[ ["#tmp","braced string","start","braced string"], ["string.braced.csound","characters$MACRO."] ],[ "start", ["punctuation.definition.string.end.csound","}}"] ],[ "start", ["punctuation.definition.string.begin.csound","{{"], ["constant.character.escape.csound","\\\\\\a\\b\\n\\r\\t\\\"\\012\\345\\67"], ["punctuation.definition.string.end.csound","}}"] ],[ "start" ],[ "start", ["keyword.operator.csound","+"], ["text"," "], ["keyword.operator.csound","-"], ["text"," "], ["keyword.operator.csound","~"], ["text"," "], ["keyword.operator.csound","¬"], ["text"," "], ["keyword.operator.csound","!"], ["text"," "], ["keyword.operator.csound","*"], ["text"," "], ["keyword.operator.csound","/"], ["text"," "], ["keyword.operator.csound","^"], ["text"," "], ["keyword.operator.csound","%"], ["text"," "], ["keyword.operator.csound","<<"], ["text"," "], ["keyword.operator.csound",">>"], ["text"," "], ["keyword.operator.csound","<"], ["text"," "], ["keyword.operator.csound",">"], ["text"," "], ["keyword.operator.csound","<="], ["text"," "], ["keyword.operator.csound",">="], ["text"," "], ["keyword.operator.csound","=="], ["text"," "], ["keyword.operator.csound","!="], ["text"," "], ["keyword.operator.csound","&"], ["text"," "], ["keyword.operator.csound","#"], ["text"," "], ["keyword.operator.csound","|"], ["text"," "], ["keyword.operator.csound","&&"], ["text"," "], ["keyword.operator.csound","||"], ["text"," "], ["keyword.operator.csound","?"], ["text"," "], ["keyword.operator.csound",":"], ["text"," "], ["keyword.operator.csound","+="], ["text"," "], ["keyword.operator.csound","-="], ["text"," "], ["keyword.operator.csound","*="], ["text"," "], ["keyword.operator.csound","/="] ],[ "start" ],[ "start", ["variable.language.csound","0dbfs"], ["text"," "], ["variable.language.csound","A4"], ["text"," "], ["variable.language.csound","kr"], ["text"," "], ["variable.language.csound","ksmps"], ["text"," "], ["variable.language.csound","nchnls"], ["text"," "], ["variable.language.csound","nchnls_i"], ["text"," "], ["variable.language.csound","sr"] ],[ "start" ],[ "start", ["keyword.control.csound","do"], ["text"," "], ["keyword.control.csound","else"], ["text"," "], ["keyword.control.csound","elseif"], ["text"," "], ["keyword.control.csound","endif"], ["text"," "], ["keyword.control.csound","enduntil"], ["text"," "], ["keyword.control.csound","fi"], ["text"," "], ["keyword.control.csound","if"], ["text"," "], ["keyword.control.csound","ithen"], ["text"," "], ["keyword.control.csound","kthen"], ["text"," "], ["keyword.control.csound","od"], ["text"," "], ["keyword.control.csound","then"], ["text"," "], ["keyword.control.csound","until"], ["text"," "], ["keyword.control.csound","while"] ],[ "start", ["keyword.control.csound","return"], ["text"," "], ["keyword.control.csound","rireturn"] ],[ "start" ],[ "start", ["entity.name.label.csound","aLabel"], ["entity.punctuation.label.csound",":"] ],[ "start", ["text.csound"," "], ["entity.name.label.csound","label2"], ["entity.punctuation.label.csound",":"] ],[ "start" ],[ "start", ["keyword.control.csound","goto"], ["text.csound"," "], ["entity.name.label.csound","aLabel"] ],[ "start", ["keyword.control.csound","reinit"], ["text.csound"," "], ["entity.name.label.csound","aLabel"] ],[ "start", ["keyword.control.csound","cggoto"], ["text"," "], ["constant.numeric.integer.decimal.csound","1"], ["keyword.operator.csound","=="], ["constant.numeric.integer.decimal.csound","0"], ["text.csound",", "], ["entity.name.label.csound","aLabel"] ],[ "start", ["keyword.control.csound","timout"], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text.csound",","], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text.csound",", "], ["entity.name.label.csound","aLabel"] ],[ "start", ["keyword.control.csound","loop_ge"], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text.csound",","], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text.csound",","], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text.csound",", "], ["entity.name.label.csound","aLabel"] ],[ "start" ],[ ["#tmp","csound-score-start","start","Csound score opcode"], ["support.function.csound","readscore"], ["text"," "], ["punctuation.definition.string.begin.csound","{{"] ],[ ["#tmp","csound-score-start","start","Csound score opcode"], ["keyword.control.csound-score","i"], ["text"," "], ["constant.numeric.integer.decimal.csound","1"], ["text"," "], ["constant.numeric.integer.decimal.csound","0"], ["text"," "], ["constant.numeric.integer.decimal.csound","0"] ],[ "start", ["punctuation.definition.string.end.csound","}}"] ],[ ["#tmp","python-start","start","Python opcode"], ["support.function.csound","pyrun"], ["text"," "], ["punctuation.definition.string.begin.csound","{{"] ],[ ["#tmp","python-start","start","Python opcode"], ["comment","# Python"] ],[ "start", ["punctuation.definition.string.end.csound","}}"] ],[ ["#tmp","lua-start","start","Lua opcode"], ["support.function.csound","lua_exec"], ["text"," "], ["punctuation.definition.string.begin.csound","{{"] ],[ ["#tmp","lua-start","start","Lua opcode"], ["comment","-- Lua"] ],[ "start", ["punctuation.definition.string.end.csound","}}"] ],[ "start" ],[ "start", ["keyword.preprocessor.csound","#include"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["string.csound","\"file.udo\""] ],[ "start", ["keyword.preprocessor.csound","#include"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["string.csound","|file.udo|"] ],[ "start" ],[ "start", ["keyword.preprocessor.csound","#ifdef"], ["text"," "], ["entity.name.function.preprocessor.csound","MACRO"] ],[ "start", ["keyword.preprocessor.csound","#else"] ],[ "start", ["keyword.preprocessor.csound","#ifndef"], ["text"," "], ["entity.name.function.preprocessor.csound","MACRO"] ],[ "start", ["keyword.preprocessor.csound","#endif"] ],[ "start", ["keyword.preprocessor.csound","#undef"], ["text"," "], ["entity.name.function.preprocessor.csound","MACRO"] ],[ "start" ],[ "start", ["keyword.preprocessor.csound","# define"], ["text"," "], ["entity.name.function.preprocessor.csound","MACRO"], ["punctuation.definition.macro.begin.csound","#"], ["text.csound","macro_body"], ["punctuation.definition.macro.end.csound","#"] ],[ "define directive", ["keyword.preprocessor.csound","#define"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"] ],[ "define directive", ["entity.name.function.preprocessor.csound","MACRO"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"] ],[ "macro body", ["punctuation.definition.macro.begin.csound","#"], ["constant.character.escape.csound","\\#"], ["text.csound","macro"] ],[ "start", ["text.csound","body"], ["constant.character.escape.csound","\\#"], ["punctuation.definition.macro.end.csound","#"] ],[ "start" ],[ "start", ["keyword.preprocessor.csound","#define"], ["text"," "], ["entity.name.function.preprocessor.csound","MACRO"], ["punctuation.definition.macro-parameter-name-list.begin.csound","("], ["variable.parameter.preprocessor.csound","ARG1"], ["text","#"], ["variable.parameter.preprocessor.csound","ARG2"], ["punctuation.definition.macro-parameter-name-list.end.csound",")"], ["text"," "], ["punctuation.definition.macro.begin.csound","#"], ["text.csound","macro_body"], ["punctuation.definition.macro.end.csound","#"] ],[ "define directive", ["keyword.preprocessor.csound","#define"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"] ],[ "define directive", ["entity.name.function.preprocessor.csound","MACRO"], ["punctuation.definition.macro-parameter-name-list.begin.csound","("], ["variable.parameter.preprocessor.csound","ARG1"], ["text","'"], ["variable.parameter.preprocessor.csound","ARG2"], ["text","'"], ["variable.parameter.preprocessor.csound","ARG3"], ["punctuation.definition.macro-parameter-name-list.end.csound",")"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"] ],[ "macro body", ["punctuation.definition.macro.begin.csound","#"], ["constant.character.escape.csound","\\#"], ["text.csound","macro"] ],[ "start", ["text.csound","body"], ["constant.character.escape.csound","\\#"], ["punctuation.definition.macro.end.csound","#"] ],[ "start" ],[ "start", ["entity.name.function.preprocessor.csound","$MACRO"], ["text"," "], ["entity.name.function.preprocessor.csound","$MACRO."] ],[ "start", ["entity.name.function.preprocessor.csound","$MACRO"], ["punctuation.definition.macro-parameter-value-list.begin.csound","("], ["text","x"], ["punctuation.definition.macro-parameter-value-list.end.csound",")"] ],[ "start", ["keyword.preprocessor.csound","@0"] ],[ "start", ["keyword.preprocessor.csound","@@ 1"] ],[ "start", ["entity.name.function.preprocessor.csound","$MACRO."], ["punctuation.definition.macro-parameter-value-list.begin.csound","("], ["punctuation.macro-parameter-value-parenthetical.begin.csound","(("], ["text.csound","x"], ["keyword.operator.csound","#"], ["text.csound","y"], ["constant.character.escape.csound","\\)"], ["punctuation.macro-parameter-value-parenthetical.end.csound","))"], ["punctuation.macro-parameter-value-separator.csound","'"], ["text"," "], ["punctuation.definition.string.begin.csound","\""], ["invalid.illegal.csound","(#'"], ["string.quoted.csound","x"], ["invalid.illegal.csound",")"], ["constant.character.escape.csound","\\)"], ["string.quoted.csound","x"], ["constant.character.escape.csound","\\)"], ["invalid.illegal.csound",")"], ["punctuation.definition.string.end.csound","\""], ["punctuation.macro-parameter-value-separator.csound","#"], ["text"," "], ["punctuation.definition.string.begin.csound","{{"], ["string.braced.csound","x"], ["constant.character.escape.csound","\\)"], ["invalid.illegal.csound.csound",")"], ["string.braced.csound","x"], ["invalid.illegal.csound.csound",")"], ["constant.character.escape.csound","\\)"], ["invalid.illegal.csound.csound","(#'"], ["punctuation.definition.string.end.csound","}}"], ["punctuation.definition.macro-parameter-value-list.end.csound",")"], ["comment.line.semicolon.csound",";"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_csound_score.json ================================================ [[ "punctuation.definition.comment.begin.csound", ["punctuation.definition.comment.begin.csound","/*"] ],[ "punctuation.definition.comment.begin.csound", ["comment.block.csound"," * comment"] ],[ "start", ["comment.block.csound"," "], ["punctuation.definition.comment.end.csound","*/"] ],[ "start", ["comment.line.semicolon.csound","; comment"] ],[ "start", ["comment.line.double-slash.csound","// comment"] ],[ "start", ["keyword.control.csound-score","a"], ["text"," "], ["keyword.control.csound-score","b"], ["text"," "], ["keyword.control.csound-score","C"], ["text"," "], ["keyword.control.csound-score","d"], ["text"," "], ["keyword.control.csound-score","e"], ["text"," "], ["keyword.control.csound-score","f"], ["text"," "], ["keyword.control.csound-score","i"], ["text"," "], ["keyword.control.csound-score","q"], ["text"," "], ["keyword.control.csound-score","s"], ["text"," "], ["keyword.control.csound-score","t"], ["text"," "], ["keyword.control.csound-score","v"], ["text"," "], ["keyword.control.csound-score","x"], ["text"," "], ["keyword.control.csound-score","y"] ],[ "start", ["constant.numeric.language.csound-score","z"] ],[ "start", ["keyword.control.csound-score","np"], ["constant.numeric.integer.decimal.csound-score","0"], ["text"," "], ["keyword.control.csound-score","nP"], ["constant.numeric.integer.decimal.csound-score","1"], ["text"," "], ["keyword.control.csound-score","Np"], ["constant.numeric.integer.decimal.csound-score","2"], ["text"," "], ["keyword.control.csound-score","NP"], ["constant.numeric.integer.decimal.csound-score","3"] ],[ "start", ["keyword.other.csound-score","m"], ["punctuation.definition.comment.begin.csound","/*"], ["punctuation.definition.comment.end.csound","*/"], ["entity.name.label.csound-score","label"], ["comment.line.semicolon.csound",";"] ],[ "start", ["keyword.other.csound-score","n"], ["text"," "], ["entity.name.label.csound-score","label"] ],[ "start", ["constant.numeric.integer.decimal.csound","123"], ["text"," "], ["constant.numeric.integer.decimal.csound","0123456789"] ],[ "start", ["storage.type.number.csound","0x"], ["constant.numeric.integer.hexadecimal.csound","abcdef0123456789"], ["text"," "], ["storage.type.number.csound","0X"], ["constant.numeric.integer.hexadecimal.csound","ABCDEF"] ],[ "start", ["constant.numeric.float.csound","1e2"], ["text"," "], ["constant.numeric.float.csound","3e+4"], ["text"," "], ["constant.numeric.float.csound","5e-6"], ["text"," "], ["constant.numeric.float.csound","7E8"], ["text"," "], ["constant.numeric.float.csound","9E+0"], ["text"," "], ["constant.numeric.float.csound","1E-2"], ["text"," "], ["constant.numeric.float.csound","3."], ["text"," "], ["constant.numeric.float.csound","4.56"], ["text"," "], ["constant.numeric.float.csound",".789"] ],[ "start", ["punctuation.definition.string.begin.csound-score","\""], ["string.quoted.csound-score","characters"], ["entity.name.function.preprocessor.csound","$MACRO."], ["punctuation.definition.string.end.csound-score","\""] ],[ ["#tmp","loop after macro name","start","loop after macro name"], ["punctuation.braced-loop.begin.csound-score","{"], ["text"," "], ["constant.numeric.integer.decimal.csound-score","1"], ["text"," "], ["entity.name.function.preprocessor.csound-score","I"] ],[ ["#tmp","loop after macro name","start","loop after macro name","loop after macro name"], ["text"," "], ["punctuation.braced-loop.begin.csound-score","{"], ["text"," "], ["constant.numeric.integer.decimal.csound-score","2"], ["text"," "], ["entity.name.function.preprocessor.csound-score","J"] ],[ ["#tmp","loop after macro name","start","loop after macro name","loop after macro name","loop after macro name"], ["text"," "], ["punctuation.braced-loop.begin.csound-score","{"], ["text"," "], ["constant.numeric.integer.decimal.csound-score","3"], ["text"," "], ["entity.name.function.preprocessor.csound-score","K"] ],[ ["#tmp","loop after macro name","start","loop after macro name","loop after macro name","loop after macro name"], ["text"," "], ["entity.name.function.preprocessor.csound","$I"], ["text"," "], ["entity.name.function.preprocessor.csound","$J"], ["text"," "], ["entity.name.function.preprocessor.csound","$K"] ],[ ["#tmp","loop after macro name","start","loop after macro name","loop after macro name"], ["text"," "], ["punctuation.braced-loop.end.csound-score","}"] ],[ ["#tmp","loop after macro name","start","loop after macro name"], ["text"," "], ["punctuation.braced-loop.end.csound-score","}"] ],[ "start", ["punctuation.braced-loop.end.csound-score","}"] ],[ "start", ["keyword.preprocessor.csound","#include"], ["text"," "], ["string.csound","\"score.sco\""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_css.json ================================================ [[ "ruleset", ["variable",".text-layer"], ["text"," "], ["paren.lparen","{"] ],[ "ruleset", ["text"," "], ["support.type","font"], ["text",": "], ["constant.numeric","12"], ["keyword","px"], ["text"," Monaco, "], ["string.start","\""], ["string","Courier New"], ["string.end","\""], ["text",", "], ["support.constant.fonts","monospace"], ["text",";"] ],[ "ruleset", ["text"," "], ["support.type","cursor"], ["text",": "], ["support.constant","text"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "ruleset", ["variable",".blinker"], ["text"," "], ["paren.lparen","{"] ],[ "ruleset", ["text"," "], ["support.type","animation"], ["text",": blink "], ["constant.numeric","1"], ["keyword","s"], ["text"," "], ["support.constant","linear"], ["text"," infinite alternate;"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["string","@"], ["keyword","keyframes"], ["text"," blink "], ["paren.lparen","{"] ],[ "ruleset", ["text"," "], ["constant.numeric","0"], ["keyword","%"], ["text",", "], ["constant.numeric","40"], ["keyword","%"], ["text"," "], ["paren.lparen","{"] ],[ ["comment","ruleset"], ["text"," "], ["support.type","opacity"], ["text",": "], ["constant.numeric","0"], ["text","; "], ["comment","/*"] ],[ "ruleset", ["comment"," */"] ],[ "ruleset", ["text"," "], ["support.type","opacity"], ["text",": "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "ruleset", ["text"," "], ["constant.numeric","40.5"], ["keyword","%"], ["text",", "], ["constant.numeric","100"], ["keyword","%"], ["text"," "], ["paren.lparen","{"] ],[ "ruleset", ["text"," "], ["support.type","opacity"], ["text",": "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "media", ["string","@"], ["keyword","document"], ["text"," "], ["support.function","url("], ["string","http://c9.io/"], ["support.function",")"], ["text",", "], ["support.function","url-prefix("], ["string","http://ace.c9.io/build/"], ["support.function",")"], ["text",","] ],[ "media", ["text"," "], ["support.function","domain("], ["string","c9.io"], ["support.function",")"], ["text",", "], ["support.function","regexp("], ["string","\"https:.*\""], ["support.function",")"], ["text"," "], ["comment","/**/"] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","/**/"] ],[ "start", ["text"," "], ["constant","img"], ["text","["], ["constant","title"], ["text","]"], ["string",":before"], ["text"," "] ],[ "ruleset", ["text"," "], ["paren.lparen","{"] ],[ ["string.start0","ruleset"], ["text"," "], ["support.type","content"], ["text",": "], ["support.function","attr"], ["text","(title) "], ["string.start","\""], ["constant.language.escape","\\A"], ["string","Image "], ["constant.language.escape","\\"] ],[ "ruleset", ["string"," retrieved from"], ["string.end","\""] ],[ ["comment","ruleset"], ["text"," "], ["support.function","attr"], ["text","(src); "], ["comment","/*"] ],[ "ruleset", ["comment"," */"] ],[ "ruleset", ["text"," "], ["support.type","white-space"], ["text",": "], ["support.constant","pre"], ["text",";"] ],[ "ruleset", ["text"," "], ["support.type","display"], ["text",": "], ["support.constant","block"], ["text",";"] ],[ "ruleset", ["text"," "], ["support.type","background"], ["text",": "], ["support.function","url("], ["string","asdasd"], ["support.function",")"], ["text","; "], ["string.start","\""], ["string","err"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_curly.json ================================================ [[ "start", ["text.xml","tokenize Curly template"], ["variable","{{"], ["text","test"], ["variable","}}"] ],[ "start", ["text.xml","tokenize embedded script"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","a"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","'a'"], ["meta.tag.punctuation.tag-close.xml",">"], ["storage.type","var"], ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml","'123'"] ],[ "start", ["text.xml","tokenize multiline attribute value with double quotes"] ],[ ["string.attribute-value.xml0","tag_stuff"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"abc{{xyz}}"] ],[ "start", ["string.attribute-value.xml","def\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml","tokenize multiline attribute value with single quotes"] ],[ ["string.attribute-value.xml","tag_stuff"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","'abc"] ],[ "start", ["string.attribute-value.xml","def\\\"'"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_d.json ================================================ [[ "start", ["comment.shebang","#!/usr/bin/env rdmd"] ],[ "start", ["comment","// Computes average line length for standard input."] ],[ "start", ["keyword","import"], ["text"," "], ["variable.module","std.stdio"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword.type","void"], ["text"," "], ["identifier","main"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.type","ulong"], ["text"," "], ["identifier","lines"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.type","double"], ["text"," "], ["identifier","sumLength"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.control","foreach"], ["text"," "], ["paren.lparen","("], ["identifier","line"], ["punctuation.operator",";"], ["text"," "], ["identifier","stdin"], ["punctuation.operator","."], ["identifier","byLine"], ["paren.lparen","("], ["paren.rparen","))"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.operator","++"], ["identifier","lines"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["identifier","sumLength"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["identifier","line"], ["punctuation.operator","."], ["identifier","length"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["identifier","writeln"], ["paren.lparen","("], ["string","\"Average line length: \""], ["punctuation.operator",","] ],[ "start", ["text"," "], ["identifier","lines"], ["text"," "], ["keyword.operator","?"], ["text"," "], ["identifier","sumLength"], ["text"," "], ["keyword.operator","/"], ["text"," "], ["identifier","lines"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_dart.json ================================================ [[ "start", ["identifier","main"], ["text","() {"] ],[ "start", ["text"," "], ["identifier","print"], ["text","("], ["string","'Hello World!'"], ["text",");"] ],[ "start", ["text","}"] ],[ "start" ],[ "start" ],[ "start", ["storage.type.primitive.dart","int"], ["text"," "], ["identifier","fib"], ["text","("], ["storage.type.primitive.dart","int"], ["text"," "], ["identifier","n"], ["text",") "], ["keyword.operator.assignment.dart","="], ["keyword.operator.comparison.dart",">"], ["text"," ("], ["identifier","n"], ["text"," "], ["keyword.operator.comparison.dart",">"], ["text"," "], ["constant.numeric","1"], ["text",") "], ["keyword.control.ternary.dart","?"], ["text"," ("], ["identifier","fib"], ["text","("], ["identifier","n"], ["text"," "], ["keyword.operator.arithmetic.dart","-"], ["text"," "], ["constant.numeric","1"], ["text",") "], ["keyword.operator.arithmetic.dart","+"], ["text"," "], ["identifier","fib"], ["text","("], ["identifier","n"], ["text"," "], ["keyword.operator.arithmetic.dart","-"], ["text"," "], ["constant.numeric","2"], ["text",")) "], ["keyword.control.ternary.dart",":"], ["text"," "], ["identifier","n"], ["text",";"] ],[ "start", ["identifier","main"], ["text","() {"] ],[ "start", ["text"," "], ["identifier","print"], ["text","("], ["string","'fib(20) = ${fib(20)}'"], ["text",");"] ],[ "start", ["text","}"] ],[ "comment", ["comment","/*asd"] ],[ "comment", ["comment","asdad"] ],[ "start", ["comment","*/"] ],[ "start", ["constant.numeric","0.67"] ],[ "start", ["constant.numeric","77"] ],[ "start", ["text","."], ["constant.numeric","86"] ],[ "start" ],[ "start", ["keyword.other.import.dart","import"], ["text","("], ["string","\"http://dartwatch.com/myOtherLibrary.dart\""], ["text",");"] ],[ "start", ["keyword.other.import.dart","import"], ["text","("], ["string","\"myOtherLibrary.dart\""], ["text",", "], ["keyword.other.import.dart","prefix"], ["text",":"], ["string","\"lib1\""], ["text",");"] ],[ "start" ],[ "qqdoc", ["string","\"\"\"asdasdads"] ],[ "qqdoc", ["string","asdadsadsasd"] ],[ "start", ["string","asdasdasdad\"\"\""] ],[ "start", ["text"," "] ],[ "start", ["string","'23424'"] ],[ "start" ],[ "start", ["constant.numeric","0x234"] ],[ "start" ],[ "start", ["identifier","foo"], ["text"," "], ["keyword.operator.dart","is"], ["text"," "], ["identifier","bar"] ],[ "start" ],[ "start", ["storage.type.primitive.dart","int"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator.assignment.dart","="], ["text"," "], ["constant.numeric","4"], ["text"," "], ["keyword.operator.bitwise.dart","<<"], ["text"," "], ["constant.numeric","10"], ["text"," "] ],[ "start", ["comment","// Create a class for Point."] ],[ "start", ["keyword.declaration.dart","class"], ["text"," "], ["identifier","Point"], ["text"," {"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// Final variables cannot be changed once they are assigned."] ],[ "start", ["text"," "], ["comment","// Create two instance variables."] ],[ "start", ["text"," "], ["storage.modifier.dart","final"], ["text"," "], ["storage.type.primitive.dart","num"], ["text"," "], ["identifier","x"], ["text",", "], ["identifier","y"], ["text",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// A constructor, with syntactic sugar for setting instance variables."] ],[ "start", ["text"," "], ["identifier","Point"], ["text","("], ["variable.language.dart","this"], ["text","."], ["identifier","x"], ["text",", "], ["variable.language.dart","this"], ["text","."], ["identifier","y"], ["text",");"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// A named constructor with an initializer list."] ],[ "start", ["text"," "], ["identifier","Point"], ["text","."], ["identifier","origin"], ["text","() "], ["keyword.control.ternary.dart",":"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator.assignment.dart","="], ["text"," "], ["constant.numeric","0"], ["text",", "], ["identifier","y"], ["text"," "], ["keyword.operator.assignment.dart","="], ["text"," "], ["constant.numeric","0"], ["text",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// A method."] ],[ "start", ["text"," "], ["storage.type.primitive.dart","num"], ["text"," "], ["identifier","distanceTo"], ["text","("], ["identifier","Point"], ["text"," "], ["identifier","other"], ["text",") {"] ],[ "start", ["text"," "], ["storage.type.primitive.dart","var"], ["text"," "], ["identifier","dx"], ["text"," "], ["keyword.operator.assignment.dart","="], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator.arithmetic.dart","-"], ["text"," "], ["identifier","other"], ["text","."], ["identifier","x"], ["text",";"] ],[ "start", ["text"," "], ["storage.type.primitive.dart","var"], ["text"," "], ["identifier","dy"], ["text"," "], ["keyword.operator.assignment.dart","="], ["text"," "], ["identifier","y"], ["text"," "], ["keyword.operator.arithmetic.dart","-"], ["text"," "], ["identifier","other"], ["text","."], ["identifier","y"], ["text",";"] ],[ "start", ["text"," "], ["keyword.control.dart","return"], ["text"," "], ["identifier","sqrt"], ["text","("], ["identifier","dx"], ["text"," "], ["keyword.operator.arithmetic.dart","*"], ["text"," "], ["identifier","dx"], ["text"," "], ["keyword.operator.arithmetic.dart","+"], ["text"," "], ["identifier","dy"], ["text"," "], ["keyword.operator.arithmetic.dart","*"], ["text"," "], ["identifier","dy"], ["text",");"] ],[ "start", ["text"," }"] ],[ "start", ["text","}"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// Check for null."] ],[ "start", ["storage.type.primitive.dart","var"], ["text"," "], ["identifier","unicorn"], ["text",";"] ],[ "start", ["keyword.control.dart","assert"], ["text","("], ["identifier","unicorn"], ["text"," "], ["keyword.operator.comparison.dart","=="], ["text"," "], ["constant.language.dart","null"], ["text",");"] ],[ "start" ],[ "start", ["comment","// Check for NaN."] ],[ "start", ["storage.type.primitive.dart","var"], ["text"," "], ["identifier","iMeantToDoThis"], ["text"," "], ["keyword.operator.assignment.dart","="], ["text"," "], ["constant.numeric","0"], ["keyword.operator.arithmetic.dart","/"], ["constant.numeric","0"], ["text",";"] ],[ "start", ["keyword.control.dart","assert"], ["text","("], ["identifier","iMeantToDoThis"], ["text","."], ["identifier","isNaN"], ["text","());"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_diff.json ================================================ [[ "start", ["variable","diff"], ["variable"," --git"], ["keyword"," a/lib/ace/edit_session.js"], ["variable"," b/lib/ace/edit_session.js"] ],[ "start", ["variable","index 23fc3fc..ed3b273 100644"] ],[ "start", ["constant.numeric","---"], ["meta.tag"," a/lib/ace/edit_session.js"] ],[ "start", ["constant.numeric","+++"], ["meta.tag"," b/lib/ace/edit_session.js"] ],[ "start", ["constant","@@"], ["constant.numeric"," -51,6 +51,7 "], ["constant","@@"], ["comment.doc.tag"," var TextMode = require(\"./mode/text\").Mode;"] ],[ "start", ["invisible"," var Range = require(\"./range\").Range;"] ],[ "start", ["invisible"," var Document = require(\"./document\").Document;"] ],[ "start", ["invisible"," var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;"] ],[ "start", ["support.constant","+"], ["text","var SearchHighlight = require(\"./search_highlight\").SearchHighlight;"] ],[ "start", ["text"," "] ],[ "start", ["invisible"," /**"] ],[ "start", ["invisible"," * class EditSession"] ],[ "start", ["constant","@@"], ["constant.numeric"," -307,6 +308,13 "], ["constant","@@"], ["comment.doc.tag"," var EditSession = function(text, mode) {"] ],[ "start", ["invisible"," return token;"] ],[ "start", ["invisible"," };"] ],[ "start", ["text"," "] ],[ "start", ["support.constant","+"], ["text"," this.highlight = function(re) {"] ],[ "start", ["support.constant","+"], ["text"," if (!this.$searchHighlight) {"] ],[ "start", ["support.constant","+"], ["text"," var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");"] ],[ "start", ["support.constant","+"], ["text"," this.$searchHighlight = this.addDynamicMarker(highlight);"] ],[ "start", ["support.constant","+"], ["text"," }"] ],[ "start", ["support.constant","+"], ["text"," this.$searchHighlight.setRegexp(re);"] ],[ "start", ["support.constant","+"], ["text"," }"] ],[ "start", ["invisible"," /**"] ],[ "start", ["invisible"," * EditSession.setUndoManager(undoManager)"] ],[ "start", ["invisible"," * - undoManager (UndoManager): The new undo manager"] ],[ "start", ["constant","@@"], ["constant.numeric"," -556,7 +564,8 "], ["constant","@@"], ["comment.doc.tag"," var EditSession = function(text, mode) {"] ],[ "start", ["invisible"," type : type || \"line\","] ],[ "start", ["invisible"," renderer: typeof type == \"function\" ? type : null,"] ],[ "start", ["invisible"," clazz : clazz,"] ],[ "start", ["support.function","-"], ["string"," inFront: !!inFront"] ],[ "start", ["support.constant","+"], ["text"," inFront: !!inFront,"] ],[ "start", ["support.constant","+"], ["text"," id: id"] ],[ "start", ["invisible"," }"] ],[ "start", ["text"," "] ],[ "start", ["invisible"," if (inFront) {"] ],[ "start", ["variable","diff"], ["variable"," --git"], ["keyword"," a/lib/ace/editor.js"], ["variable"," b/lib/ace/editor.js"] ],[ "start", ["variable","index 834e603..b27ec73 100644"] ],[ "start", ["constant.numeric","---"], ["meta.tag"," a/lib/ace/editor.js"] ],[ "start", ["constant.numeric","+++"], ["meta.tag"," b/lib/ace/editor.js"] ],[ "start", ["constant","@@"], ["constant.numeric"," -494,7 +494,7 "], ["constant","@@"], ["comment.doc.tag"," var Editor = function(renderer, session) {"] ],[ "start", ["invisible"," * Emitted when a selection has changed."] ],[ "start", ["invisible"," **/"] ],[ "start", ["invisible"," this.onSelectionChange = function(e) {"] ],[ "start", ["support.function","-"], ["string"," var session = this.getSession();"] ],[ "start", ["support.constant","+"], ["text"," var session = this.session;"] ],[ "start", ["text"," "] ],[ "start", ["invisible"," if (session.$selectionMarker) {"] ],[ "start", ["invisible"," session.removeMarker(session.$selectionMarker);"] ],[ "start", ["constant","@@"], ["constant.numeric"," -509,12 +509,40 "], ["constant","@@"], ["comment.doc.tag"," var Editor = function(renderer, session) {"] ],[ "start", ["invisible"," this.$updateHighlightActiveLine();"] ],[ "start", ["invisible"," }"] ],[ "start", ["text"," "] ],[ "start", ["support.function","-"], ["string"," var self = this;"] ],[ "start", ["support.function","-"], ["string"," if (this.$highlightSelectedWord && !this.$wordHighlightTimer)"] ],[ "start", ["support.function","-"], ["string"," this.$wordHighlightTimer = setTimeout(function() {"] ],[ "start", ["support.function","-"], ["string"," self.session.$mode.highlightSelection(self);"] ],[ "start", ["support.function","-"], ["string"," self.$wordHighlightTimer = null;"] ],[ "start", ["support.function","-"], ["string"," }, 30, this);"] ],[ "start", ["support.constant","+"], ["text"," var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()"] ],[ "start", ["invisible"," };"] ],[ "start", ["variable","diff"], ["variable"," --git"], ["keyword"," a/lib/ace/search_highlight.js"], ["variable"," b/lib/ace/search_highlight.js"] ],[ "start", ["invisible","new file mode 100644"] ],[ "start", ["variable","index 0000000..b2df779"] ],[ "start", ["constant.numeric","---"], ["meta.tag"," /dev/null"] ],[ "start", ["constant.numeric","+++"], ["meta.tag"," b/lib/ace/search_highlight.js"] ],[ "start", ["constant","@@"], ["constant.numeric"," -0,0 +1,3 "], ["constant","@@"] ],[ "start", ["support.constant","+"], ["text","new"] ],[ "start", ["support.constant","+"], ["text","empty file"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_dot.json ================================================ [[ "start", ["comment","// Original source: http://www.graphviz.org/content/lion_share"] ],[ "start", ["comment","##\"A few people in the field of genetics are using dot to draw \"marriage node diagram\" pedigree drawings. Here is one I have done of a test pedigree from the FTREE pedigree drawing package (Lion Share was a racehorse).\" Contributed by David Duffy."] ],[ "start" ],[ "start", ["comment","##Command to get the layout: \"dot -Tpng thisfile > thisfile.png\""] ],[ "start" ],[ "start", ["keyword","digraph"], ["text"," Ped_Lion_Share "], ["paren.lparen","{"] ],[ "start", ["comment","# page = \"8.2677165,11.692913\" ;"] ],[ "start", ["variable","ratio"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"auto\""], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["text","mincross "], ["keyword.operator","="], ["text"," "], ["constant.numeric","2.0"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["variable","label"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Pedigree Lion_Share\""], ["text"," "], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["string","\"001\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"002\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"003\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"004\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"005\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"006\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"007\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"009\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"014\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"015\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"016\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"ZZ01\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"ZZ02\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"017\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"012\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"008\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"011\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"013\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"010\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"023\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"020\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"021\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"018\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"025\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"019\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"022\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"024\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"027\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","circle "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"026\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","white "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"028\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","box "], ["punctuation.operator",","], ["text"," "], ["variable","regular"], ["keyword.operator","="], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","fillcolor"], ["keyword.operator","="], ["text","grey "], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0001\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"001\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0001\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"007\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0001\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0001\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"017\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0002\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"001\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0002\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"ZZ02\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0002\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0002\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"012\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0003\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"002\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0003\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"003\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0003\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0003\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"008\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0004\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"002\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0004\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"006\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0004\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0004\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"011\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0005\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"002\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0005\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"ZZ01\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0005\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0005\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"013\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0006\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"004\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0006\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"009\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0006\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0006\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"010\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0007\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"005\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0007\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"015\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0007\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0007\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"023\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0008\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"005\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0008\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"016\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0008\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0008\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"020\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0009\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"005\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0009\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"012\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0009\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0009\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"021\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0010\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"008\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0010\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"017\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0010\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0010\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"018\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0011\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"011\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0011\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"023\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0011\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0011\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"025\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0012\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"013\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0012\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"014\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0012\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0012\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"019\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0013\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"010\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0013\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"021\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0013\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0013\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"022\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0014\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"019\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0014\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"020\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0014\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0014\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"024\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0015\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"022\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0015\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"025\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0015\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0015\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"027\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0016\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"024\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0016\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"018\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0016\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0016\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"026\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0017\""], ["text"," "], ["paren.lparen","["], ["variable","shape"], ["keyword.operator","="], ["text","diamond"], ["punctuation.operator",","], ["variable","style"], ["keyword.operator","="], ["text","filled"], ["punctuation.operator",","], ["variable","label"], ["keyword.operator","="], ["string","\"\""], ["punctuation.operator",","], ["variable","height"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["punctuation.operator",","], ["variable","width"], ["keyword.operator","="], ["text","."], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"026\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0017\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"027\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"marr0017\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","1"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["string","\"marr0017\""], ["text"," "], ["keyword.operator","->"], ["text"," "], ["string","\"028\""], ["text"," "], ["paren.lparen","["], ["variable","dir"], ["keyword.operator","="], ["text","none"], ["punctuation.operator",","], ["text"," "], ["variable","weight"], ["keyword.operator","="], ["constant.numeric","2"], ["paren.rparen","]"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_drools.json ================================================ [[ "block.comment", ["comment","/*"] ],[ "block.comment", ["comment.block"," * Copyright 2010 JBoss Inc"] ],[ "block.comment", ["comment.block"," *"] ],[ "block.comment", ["comment.block"," * Licensed under the Apache License, Version 2.0 (the \"License\");"] ],[ "block.comment", ["comment.block"," * you may not use this file except in compliance with the License."] ],[ "block.comment", ["comment.block"," * You may obtain a copy of the License at"] ],[ "block.comment", ["comment.block"," *"] ],[ "block.comment", ["comment.block"," * http://www.apache.org/licenses/LICENSE-2.0"] ],[ "block.comment", ["comment.block"," *"] ],[ "block.comment", ["comment.block"," * Unless required by applicable law or agreed to in writing, software"] ],[ "block.comment", ["comment.block"," * distributed under the License is distributed on an \"AS IS\" BASIS,"] ],[ "block.comment", ["comment.block"," * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied."] ],[ "block.comment", ["comment.block"," * See the License for the specific language governing permissions and"] ],[ "block.comment", ["comment.block"," * limitations under the License."] ],[ "start", ["comment.block"," */"] ],[ "start" ],[ "block.comment", ["comment","/*"] ],[ "block.comment", ["comment.block"," Original source"] ],[ "block.comment", ["comment.block"," https://github.com/droolsjbpm/drools/blob/master/drools-examples/"] ],[ "block.comment", ["comment.block"," http://docs.jboss.org/drools/"] ],[ "start", ["comment.block","*/"] ],[ "start", ["keyword","package"], ["text"," "], ["entity.name.type","com.example.ace"] ],[ "start" ],[ "start", ["keyword","import"], ["text"," "], ["entity.name.type","java.math.BigDecimal"] ],[ "start", ["keyword","import"], ["text"," "], ["keyword","function"], ["text"," "], ["entity.name.type","my.package.Foo.hello"] ],[ "start" ],[ "start", ["keyword","declare"], ["text"," "], ["entity.name.type","FactType"] ],[ "start", ["text"," "], ["entity.name.type","@author"], ["paren.lparen","("], ["text"," "], ["identifier","Bob"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable.other","id"], ["text"," "], ["text",":"], ["text"," "], ["support.class","String"] ],[ "start", ["text"," "], ["variable.other","name"], ["text"," "], ["text",":"], ["text"," "], ["support.class","String"], ["text"," "], ["entity.name.type","@maxLength"], ["paren.lparen","("], ["constant.numeric","100"], ["paren.rparen",")"], ["text"," "], ["entity.name.type","@notnull"] ],[ "start" ],[ "start", ["text"," "], ["variable.other","value"], ["text"," "], ["text",":"], ["text"," "], ["identifier","BigDecimal"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","declare"], ["text"," "], ["entity.name.type","FactType2"], ["text"," "], ["keyword","extends"], ["text"," "], ["entity.name.type","AnotherType"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","declare"], ["text"," "], ["keyword","trait"], ["text"," "], ["entity.name.type","TraitType"], ["text"," "], ["keyword","extends"], ["text"," "], ["entity.name.type","com.package.AnotherType"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start" ],[ "start", ["keyword","declare"], ["text"," "], ["keyword","trait"], ["text"," "], ["entity.name.type","GoldenCustomer"] ],[ "start", ["text"," "], ["variable.other","balance"], ["text"," "], ["text",":"], ["text"," "], ["keyword","long"], ["text"," "], ["entity.name.type","@Alias"], ["paren.lparen","("], ["text"," "], ["string","\"org.acme.foo.accountBalance\""], ["text"," "], ["paren.rparen",")"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","global"], ["text"," "], ["entity.name.type","org.slf4j.Logger"], ["text"," "], ["variable","logger"] ],[ "start" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc"," * "], ["comment.doc.tag","@param"], ["comment.doc"," name who we'll salute?"] ],[ "start", ["comment.doc"," */"] ],[ "start", ["keyword","function"], ["text"," "], ["support.class","String"], ["text"," "], ["identifier","hello"], ["paren.lparen","("], ["support.class","String"], ["text"," "], ["identifier","name"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["string","\"Hello \""], ["keyword.operator","+"], ["identifier","name"], ["keyword.operator","+"], ["string","\"!\""], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","rule"], ["text"," "], ["entity.name","\"Trim all strings\""] ],[ "start", ["text"," "], ["keyword","dialect"], ["text"," "], ["string","\"java\""] ],[ "start", ["text"," "], ["keyword","no"], ["keyword.operator","-"], ["keyword","loop"] ],[ "start", ["keyword","when"], ["text"," "], ["comment","// fdsfds"] ],[ "start", ["text"," "], ["variable.other","$s"], ["text"," "], ["text",":"], ["text"," "], ["support.class","String"], ["paren.lparen","("], ["identifier","a"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.language","null"], ["text"," "], ["keyword.operator","||"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","\"empty\""], ["text",", "], ["variable.other","$g"], ["text"," "], ["text",":"], ["text"," "], ["identifier","size"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Cheese"], ["paren.lparen","("], ["text"," "], ["identifier","name"], ["text"," "], ["keyword","matches"], ["text"," "], ["string","\"(Buffalo)?\\\\S*Mozarella\""], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","CheeseCounter"], ["paren.lparen","("], ["text"," "], ["identifier","cheeses"], ["text"," "], ["keyword","contains"], ["text"," "], ["identifier","$var"], ["text"," "], ["paren.rparen",")"], ["text"," "], ["comment","// contains with a variable"] ],[ "start", ["text"," "], ["identifier","CheeseCounter"], ["paren.lparen","("], ["text"," "], ["identifier","cheese"], ["text"," "], ["keyword","memberof"], ["text"," "], ["identifier","$matureCheeses"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Cheese"], ["paren.lparen","("], ["text"," "], ["identifier","name"], ["text"," "], ["keyword","soundslike"], ["text"," "], ["string","'foobar'"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Message"], ["paren.lparen","("], ["text"," "], ["identifier","routingValue"], ["text"," "], ["keyword","str"], ["paren.lparen","["], ["identifier","startsWith"], ["paren.rparen","]"], ["text"," "], ["string","\"R1\""], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Cheese"], ["paren.lparen","("], ["text"," "], ["identifier","name"], ["text"," "], ["keyword","in"], ["text"," "], ["paren.lparen","("], ["text"," "], ["string","\"stilton\""], ["text",", "], ["string","\"cheddar\""], ["text",", "], ["identifier","$cheese"], ["text"," "], ["paren.rparen",")"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Person"], ["paren.lparen","("], ["text"," "], ["keyword","eval"], ["paren.lparen","("], ["text"," "], ["identifier","age"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","girlAge"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["paren.rparen",")"], ["text",", "], ["identifier","sex"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","'M'"], ["text"," "], ["paren.rparen",")"] ],[ "java-start", ["keyword","then"] ],[ "java-doc-start", ["text"," "], ["comment.doc","/**"] ],[ "java-doc-start", ["comment.doc"," * "], ["comment.doc.tag.storage.type","TODO"], ["comment.doc"," There mus be better way"] ],[ "java-start", ["comment.doc"," */"] ],[ "java-start", ["text"," "], ["support.function","retract"], ["lparen","("], ["identifier","$s"], ["rparen",")"], ["text",";"] ],[ "java-start", ["text"," "], ["support.function","String"], ["text"," "], ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"fd\""], ["text",";"] ],[ "java-start", ["text"," "], ["identifier","a"], ["text","."], ["identifier","toString"], ["lparen","("], ["rparen",")"], ["text",";"] ],[ "java-start" ],[ "java-start", ["text"," "], ["support.function","insert"], ["lparen","("], ["identifier","$s"], ["text","."], ["identifier","trim"], ["lparen","("], ["rparen","))"], ["text",";"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","query"], ["text"," "], ["entity.name","isContainedIn"], ["paren.lparen","("], ["text"," "], ["support.class","String"], ["text"," "], ["identifier","x"], ["text",", "], ["support.class","String"], ["text"," "], ["identifier","y"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Location"], ["paren.lparen","("], ["text"," "], ["identifier","x"], ["text",", "], ["identifier","y"], ["text","; "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","or"] ],[ "start", ["text"," "], ["paren.lparen","("], ["text"," "], ["identifier","Location"], ["paren.lparen","("], ["text"," "], ["identifier","z"], ["text",", "], ["identifier","y"], ["text","; "], ["paren.rparen",")"], ["text"," "], ["keyword","and"], ["text"," "], ["identifier","isContainedIn"], ["paren.lparen","("], ["text"," "], ["identifier","x"], ["text",", "], ["identifier","z"], ["text","; "], ["paren.rparen",")"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","rule"], ["text"," "], ["entity.name","\"go\""], ["text"," "], ["keyword","salience"], ["text"," "], ["constant.numeric","10"] ],[ "start", ["keyword","when"] ],[ "start", ["text"," "], ["variable.other","$s"], ["text"," "], ["text",":"], ["text"," "], ["support.class","String"], ["paren.lparen","("], ["text"," "], ["paren.rparen",")"] ],[ "java-start", ["keyword","then"] ],[ "java-start", ["text"," "], ["support.function","System"], ["text","."], ["identifier","out"], ["text","."], ["identifier","println"], ["lparen","("], ["text"," "], ["identifier","$s"], ["text"," "], ["rparen",")"], ["text",";"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","rule"], ["text"," "], ["entity.name","\"When all English buses are not red\""] ],[ "start", ["keyword","when"] ],[ "start", ["text"," "], ["keyword","not"], ["paren.lparen","("], ["keyword","forall"], ["paren.lparen","("], ["text"," "], ["variable.other","$bus"], ["text"," "], ["text",":"], ["text"," "], ["identifier","Bus"], ["paren.lparen","("], ["text"," "], ["identifier","nationality"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","'english'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","Bus"], ["paren.lparen","("], ["text"," "], ["keyword","this"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","$bus"], ["text",", "], ["identifier","color"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","'red'"], ["text"," "], ["paren.rparen",")"], ["text"," "], ["paren.rparen","))"] ],[ "java-start", ["keyword","then"] ],[ "java-start", ["text"," "], ["comment","// What if all english buses are not red?"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","rule"], ["text"," "], ["entity.name","\"go1\""] ],[ "start", ["keyword","when"] ],[ "start", ["text"," "], ["support.class","String"], ["paren.lparen","("], ["text"," "], ["keyword","this"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","\"go1\""], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","isContainedIn"], ["paren.lparen","("], ["string","\"Office\""], ["text",", "], ["string","\"House\""], ["text","; "], ["paren.rparen",")"] ],[ "java-start", ["keyword","then"] ],[ "java-start", ["text"," "], ["support.function","System"], ["text","."], ["identifier","out"], ["text","."], ["identifier","println"], ["lparen","("], ["text"," "], ["string","\"office is in the house\""], ["text"," "], ["rparen",")"], ["text",";"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","rule"], ["text"," "], ["entity.name","\"go2\""] ],[ "start", ["keyword","when"] ],[ "start", ["text"," "], ["support.class","String"], ["paren.lparen","("], ["text"," "], ["keyword","this"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","\"go2\""], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","isContainedIn"], ["paren.lparen","("], ["string","\"Draw\""], ["text",", "], ["string","\"House\""], ["text","; "], ["paren.rparen",")"] ],[ "java-start", ["keyword","then"] ],[ "java-start", ["text"," "], ["support.function","System"], ["text","."], ["identifier","out"], ["text","."], ["identifier","println"], ["lparen","("], ["text"," "], ["string","\"Draw in the House\""], ["text"," "], ["rparen",")"], ["text",";"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc"," * Go Right"] ],[ "start", ["comment.doc"," */"] ],[ "start", ["keyword","rule"], ["text"," "], ["entity.name","GoRight"], ["text"," "], ["keyword","dialect"], ["text"," "], ["string","\"mvel\""], ["text"," "], ["keyword","salience"], ["text"," "], ["paren.lparen","("], ["support.class","Math"], ["text","."], ["identifier","abs"], ["paren.lparen","("], ["text"," "], ["identifier","$df"], ["text","."], ["identifier","colDiff"], ["text"," "], ["paren.rparen","))"], ["text"," "], ["keyword","when"] ],[ "start", ["text"," "], ["variable.other","$df"], ["text"," "], ["text",":"], ["text"," "], ["identifier","DirectionDiff"], ["paren.lparen","("], ["identifier","colDiff"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable.other","$target"], ["text"," "], ["text",":"], ["text"," "], ["identifier","Cell"], ["paren.lparen","("], ["text"," "], ["identifier","row"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","$df"], ["text","."], ["identifier","row"], ["text",", "], ["identifier","col"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["paren.lparen","("], ["identifier","$df"], ["text","."], ["identifier","col"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["paren.rparen",")"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","CellContents"], ["paren.lparen","("], ["text"," "], ["identifier","cell"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","$target"], ["text",", "], ["identifier","cellType"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["identifier","CellType"], ["text","."], ["identifier","WALL"], ["text"," "], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","not"], ["text"," "], ["identifier","Direction"], ["paren.lparen","("], ["identifier","character"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","$df"], ["text","."], ["identifier","fromChar"], ["text",", "], ["identifier","horizontal"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","Direction"], ["text","."], ["identifier","RIGHT"], ["text"," "], ["paren.rparen",")"] ],[ "java-start", ["keyword","then"] ],[ "java-start", ["text"," "], ["support.function","System"], ["text","."], ["identifier","out"], ["text","."], ["identifier","println"], ["lparen","("], ["text"," "], ["string","\"monster right\""], ["text"," "], ["rparen",")"], ["text",";"] ],[ "java-start", ["text"," "], ["support.function","retract"], ["lparen","("], ["text"," "], ["identifier","$df"], ["text"," "], ["rparen",")"], ["text",";"] ],[ "java-start", ["text"," "], ["support.function","insert"], ["lparen","("], ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Direction"], ["lparen","("], ["identifier","$df"], ["text","."], ["identifier","fromChar"], ["text",", "], ["identifier","Direction"], ["text","."], ["identifier","RIGHT"], ["text",", "], ["identifier","Direction"], ["text","."], ["identifier","NONE"], ["text"," "], ["rparen",")"], ["text"," "], ["rparen",")"], ["text",";"] ],[ "start", ["keyword","end"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_eiffel.json ================================================ [[ "start", ["keyword","note"] ],[ "start", ["text","\t"], ["identifier","description"], ["keyword.operator",":"], ["text"," "], ["string.quoted.double","\"Represents a person.\""] ],[ "start" ],[ "start", ["keyword","class"] ],[ "start", ["text","\t"], ["entity.name.type","PERSON"] ],[ "start" ],[ "start", ["keyword","create"] ],[ "start", ["text","\t"], ["identifier","make"], ["keyword.operator",","], ["text"," "], ["identifier","make_unknown"] ],[ "start" ],[ "start", ["keyword","feature"], ["text"," "], ["paren.lparen","{"], ["entity.name.type","NONE"], ["paren.rparen","}"], ["text"," "], ["comment.line.double-dash","-- Creation"] ],[ "start" ],[ "start", ["text","\t"], ["identifier","make"], ["text"," "], ["paren.lparen","("], ["identifier","a_name"], ["keyword.operator",":"], ["text"," "], ["keyword","like"], ["text"," "], ["identifier","name"], ["paren.rparen",")"] ],[ "start", ["text","\t\t\t"], ["comment.line.double-dash","-- Create a person with `a_name' as `name'."] ],[ "start", ["text","\t\t"], ["keyword","do"] ],[ "start", ["text","\t\t\t"], ["identifier","name"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["identifier","a_name"] ],[ "start", ["text","\t\t"], ["keyword","ensure"] ],[ "start", ["text","\t\t\t"], ["identifier","name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","a_name"] ],[ "start", ["text","\t\t"], ["keyword","end"] ],[ "start" ],[ "start", ["text","\t"], ["identifier","make_unknown"] ],[ "start", ["text","\t\t"], ["keyword","do"], ["text"," "], ["keyword","ensure"] ],[ "start", ["text","\t\t\t"], ["identifier","name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.language","Void"] ],[ "start", ["text","\t\t"], ["keyword","end"] ],[ "start" ],[ "start", ["keyword","feature"], ["text"," "], ["comment.line.double-dash","-- Access"] ],[ "start" ],[ "start", ["text","\t"], ["identifier","name"], ["keyword.operator",":"], ["text"," "], ["keyword","detachable"], ["text"," "], ["entity.name.type","STRING"] ],[ "start", ["text","\t\t\t"], ["comment.line.double-dash","-- Full name or Void if unknown."] ],[ "start" ],[ "start", ["keyword","end"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_ejs.json ================================================ [[ "start", ["xml-pe.doctype.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","head"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Cloud9 Rocks!"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","table"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"table\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Name"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Size"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["markup.list.meta.tag","<%"], ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["keyword.operator","!"], ["identifier","isRoot"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["markup.list.meta.tag","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"..\""], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml",".."], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["markup.list.meta.tag","<%"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["markup.list.meta.tag","%>"] ],[ "start", ["text.xml"," "], ["markup.list.meta.tag","<%"], ["text"," "], ["identifier","entries"], ["punctuation.operator","."], ["identifier","forEach"], ["paren.lparen","("], ["storage.type","function"], ["paren.lparen","("], ["identifier","entry"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["markup.list.meta.tag","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","span"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"glyphicon "], ["markup.list.meta.tag","<%="], ["text"," "], ["identifier","entry"], ["punctuation.operator","."], ["identifier","mime"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","'directory'"], ["text"," "], ["punctuation.operator","?"], ["text"," "], ["string","'folder'"], ["punctuation.operator",":"], ["text"," "], ["string","'file'"], ["markup.list.meta.tag","%>"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["markup.list.meta.tag","<%="], ["text"," "], ["identifier","entry"], ["punctuation.operator","."], ["identifier","name"], ["text"," "], ["markup.list.meta.tag","%>"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["markup.list.meta.tag","<%="], ["text"," "], ["identifier","entry"], ["punctuation.operator","."], ["identifier","name"], ["text"," "], ["markup.list.meta.tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["markup.list.meta.tag","<%="], ["text"," "], ["identifier","entry"], ["punctuation.operator","."], ["identifier","size"], ["text"," "], ["markup.list.meta.tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["markup.list.meta.tag","<%"], ["text"," "], ["paren.rparen","})"], ["text"," "], ["markup.list.meta.tag","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_elixir.json ================================================ [[ "start", ["keyword.control.module.elixir","defmodule"], ["meta.module.elixir"," "], ["entity.name.type.module.elixir","HelloModule"], ["text"," "], ["keyword.control.elixir","do"] ],[ "comment.documentation.heredoc", ["text"," "], ["comment.documentation.heredoc","@moduledoc \"\"\""] ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," This is supposed to be `markdown`."] ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," __Yes__ this is [mark](http://down.format)"] ],[ "comment.documentation.heredoc" ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," # Truly"] ],[ "comment.documentation.heredoc" ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," ## marked"] ],[ "comment.documentation.heredoc" ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," * with lists"] ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," * more"] ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," * and more"] ],[ "comment.documentation.heredoc" ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," Even.with(code)"] ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," blocks |> with |> samples"] ],[ "comment.documentation.heredoc" ],[ "comment.documentation.heredoc", ["comment.documentation.heredoc"," _Docs are first class citizens in Elixir_ (Jose Valim)"] ],[ "start", ["comment.documentation.heredoc"," \"\"\""] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["punctuation.definition.comment.elixir","#"], ["comment.line.number-sign.elixir"," A \"Hello world\" function"] ],[ "start", ["text"," "], ["keyword.control.elixir","def"], ["text"," some_fun "], ["keyword.control.elixir","do"] ],[ "start", ["text"," "], ["variable.other.constant.elixir","IO"], ["punctuation.separator.method.elixir","."], ["text","puts "], ["punctuation.definition.string.begin.elixir","\""], ["string.quoted.double.elixir","Juhu Kinners!"], ["punctuation.definition.string.end.elixir","\""] ],[ "start", ["text"," "], ["keyword.control.elixir","end"] ],[ "start", ["text"," "], ["punctuation.definition.comment.elixir","#"], ["comment.line.number-sign.elixir"," A private function"] ],[ "start", ["text"," "], ["keyword.control.elixir","defp"], ["text"," priv "], ["keyword.control.elixir","do"] ],[ "punctuation.definition.string.begin.elixir7", ["text"," is_regex "], ["punctuation.definition.string.begin.elixir","~r\"\"\""] ],[ "punctuation.definition.string.begin.elixir7", ["string.quoted.double.heredoc.elixir"," This is a regex"] ],[ "punctuation.definition.string.begin.elixir7", ["string.quoted.double.heredoc.elixir"," spanning several"] ],[ "punctuation.definition.string.begin.elixir7", ["string.quoted.double.heredoc.elixir"," lines."] ],[ "start", ["punctuation.definition.string.end.elixir"," \"\"\""] ],[ "start", ["text"," x "], ["keyword.operator.assignment.elixir","="], ["text"," elem"], ["punctuation.section.function.elixir","("], ["punctuation.section.scope.elixir","{"], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","a"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","b"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","c"], ["text"," "], ["punctuation.section.scope.elixir","}"], ["punctuation.separator.object.elixir",","], ["text"," "], ["constant.numeric.elixir","0"], ["punctuation.section.function.elixir",")"], ["text"," "], ["punctuation.definition.comment.elixir","#"], ["comment.line.number-sign.elixir","=> :a"] ],[ "start", ["text"," "], ["keyword.control.elixir","end"] ],[ "start", ["keyword.control.elixir","end"] ],[ "start" ],[ "start", ["text","test_fun "], ["keyword.operator.assignment.elixir","="], ["text"," "], ["keyword.control.elixir","fn"], ["punctuation.section.function.elixir","("], ["text","x"], ["punctuation.section.function.elixir",")"], ["text"," "], ["keyword.operator.arithmetic.elixir","-"], ["keyword.operator.comparison.elixir",">"] ],[ "start", ["text"," "], ["keyword.control.elixir","cond"], ["text"," "], ["keyword.control.elixir","do"] ],[ "start", ["text"," x "], ["keyword.operator.comparison.elixir",">"], ["text"," "], ["constant.numeric.elixir","10"], ["text"," "], ["keyword.operator.arithmetic.elixir","-"], ["keyword.operator.comparison.elixir",">"] ],[ "start", ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","greater_than_ten"] ],[ "start", ["text"," "], ["constant.language.elixir","true"], ["text"," "], ["keyword.operator.arithmetic.elixir","-"], ["keyword.operator.comparison.elixir",">"] ],[ "start", ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","maybe_ten"] ],[ "start", ["text"," "], ["keyword.control.elixir","end"] ],[ "start", ["keyword.control.elixir","end"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_elm.json ================================================ [[ "start", ["comment.start","{-"], ["comment"," Ace "], ["comment.start","{-"], ["comment"," 4 "], ["comment.end","-}"], ["comment"," Elm "], ["comment.end","-}"] ],[ "start", ["constant.language","main"], ["text"," "], ["keyword","="], ["text"," "], ["identifier","lift"], ["text"," "], ["identifier","clock"], ["text"," "], ["paren.lparen","("], ["identifier","every"], ["text"," "], ["identifier","second"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["constant.language","clock"], ["text"," "], ["identifier","t"], ["text"," "], ["keyword","="], ["text"," "], ["identifier","collage"], ["text"," "], ["constant.numeric","400"], ["text"," "], ["constant.numeric","400"], ["text"," "], ["paren.lparen","["], ["text"," "], ["identifier","filled"], ["text"," "], ["identifier","lightGrey"], ["text"," "], ["paren.lparen","("], ["identifier","ngon"], ["text"," "], ["constant.numeric","12"], ["text"," "], ["constant.numeric","110"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["operator.punctuation",","], ["text"," "], ["identifier","outlined"], ["text"," "], ["paren.lparen","("], ["identifier","solid"], ["text"," "], ["identifier","grey"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","("], ["identifier","ngon"], ["text"," "], ["constant.numeric","12"], ["text"," "], ["constant.numeric","110"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["operator.punctuation",","], ["text"," "], ["identifier","hand"], ["text"," "], ["identifier","orange"], ["text"," "], ["constant.numeric","100"], ["text"," "], ["identifier","t"] ],[ "start", ["text"," "], ["operator.punctuation",","], ["text"," "], ["identifier","hand"], ["text"," "], ["identifier","charcoal"], ["text"," "], ["constant.numeric","100"], ["text"," "], ["paren.lparen","("], ["identifier","t"], ["keyword.operator","/"], ["constant.numeric","60"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["operator.punctuation",","], ["text"," "], ["identifier","hand"], ["text"," "], ["identifier","charcoal"], ["text"," "], ["constant.numeric","60"], ["text"," "], ["paren.lparen","("], ["identifier","t"], ["keyword.operator","/"], ["constant.numeric","720"], ["paren.rparen",")"], ["text"," "], ["paren.rparen","]"] ],[ "start" ],[ "start", ["constant.language","hand"], ["text"," "], ["identifier","clr"], ["text"," "], ["identifier","len"], ["text"," "], ["identifier","time"], ["text"," "], ["keyword","="] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","angle"], ["text"," "], ["keyword","="], ["text"," "], ["identifier","degrees"], ["text"," "], ["paren.lparen","("], ["constant.numeric","90"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","6"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","inSeconds"], ["text"," "], ["identifier","time"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","in"], ["text"," "], ["identifier","traced"], ["text"," "], ["paren.lparen","("], ["identifier","solid"], ["text"," "], ["identifier","clr"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","<|"], ["text"," "], ["identifier","segment"], ["text"," "], ["paren.lparen","("], ["constant.numeric","0"], ["operator.punctuation",","], ["constant.numeric","0"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","("], ["identifier","len"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","cos"], ["text"," "], ["identifier","angle"], ["operator.punctuation",","], ["text"," "], ["identifier","len"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","sin"], ["text"," "], ["identifier","angle"], ["paren.rparen",")"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_erlang.json ================================================ [[ "start", ["text"," "], ["punctuation.definition.comment.erlang","%% A process whose only job is to keep a counter."] ],[ "start", ["text"," "], ["punctuation.definition.comment.erlang","%% First version"] ],[ "start", ["meta.directive.module.erlang"," "], ["punctuation.section.directive.begin.erlang","-"], ["keyword.control.directive.module.erlang","module"], ["punctuation.definition.parameters.begin.erlang","("], ["entity.name.type.class.module.definition.erlang","counter"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.section.directive.end.erlang","."] ],[ "start", ["meta.directive.export.erlang"," "], ["punctuation.section.directive.begin.erlang","-"], ["keyword.control.directive.export.erlang","export"], ["punctuation.definition.parameters.begin.erlang","("], ["punctuation.definition.list.begin.erlang","["], ["entity.name.function.erlang","start"], ["punctuation.separator.function-arity.erlang","/"], ["constant.numeric.integer.decimal.erlang","0"], ["punctuation.separator.list.erlang",","], ["meta.structure.list.function.erlang"," "], ["entity.name.function.erlang","codeswitch"], ["punctuation.separator.function-arity.erlang","/"], ["constant.numeric.integer.decimal.erlang","1"], ["punctuation.definition.list.end.erlang","]"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.section.directive.end.erlang","."] ],[ "start", ["text"," "] ],[ "start", ["meta.function.erlang"," "], ["entity.name.function.definition.erlang","start"], ["punctuation.section.expression.begin.erlang","("], ["punctuation.section.expression.end.erlang",")"], ["text"," "], ["keyword.operator.symbolic.erlang","->"], ["text"," "], ["entity.name.function.erlang","loop"], ["punctuation.definition.parameters.begin.erlang","("], ["constant.numeric.integer.decimal.erlang","0"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.terminator.function.erlang","."] ],[ "start", ["text"," "] ],[ ["text6","meta.function.erlang"], ["meta.function.erlang"," "], ["entity.name.function.definition.erlang","loop"], ["punctuation.section.expression.begin.erlang","("], ["variable.other.erlang","Sum"], ["punctuation.section.expression.end.erlang",")"], ["text"," "], ["keyword.operator.symbolic.erlang","->"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["text"," "], ["keyword.control.receive.erlang","receive"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["punctuation.definition.tuple.begin.erlang","{"], ["constant.other.symbol.unquoted.erlang","increment"], ["punctuation.separator.tuple.erlang",","], ["meta.structure.tuple.erlang"," "], ["variable.other.erlang","Count"], ["punctuation.definition.tuple.end.erlang","}"], ["meta.expression.receive.erlang"," "], ["punctuation.separator.clause-head-body.erlang","->"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["entity.name.function.erlang","loop"], ["punctuation.definition.parameters.begin.erlang","("], ["variable.other.erlang","Sum"], ["keyword.operator.symbolic.erlang","+"], ["variable.other.erlang","Count"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.separator.clauses.erlang",";"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["punctuation.definition.tuple.begin.erlang","{"], ["constant.other.symbol.unquoted.erlang","counter"], ["punctuation.separator.tuple.erlang",","], ["meta.structure.tuple.erlang"," "], ["variable.other.erlang","Pid"], ["punctuation.definition.tuple.end.erlang","}"], ["meta.expression.receive.erlang"," "], ["punctuation.separator.clause-head-body.erlang","->"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["variable.other.erlang","Pid"], ["meta.expression.receive.erlang"," "], ["keyword.operator.symbolic.erlang","!"], ["meta.expression.receive.erlang"," "], ["punctuation.definition.tuple.begin.erlang","{"], ["constant.other.symbol.unquoted.erlang","counter"], ["punctuation.separator.tuple.erlang",","], ["meta.structure.tuple.erlang"," "], ["variable.other.erlang","Sum"], ["punctuation.definition.tuple.end.erlang","}"], ["punctuation.separator.expressions.erlang",","] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["entity.name.function.erlang","loop"], ["punctuation.definition.parameters.begin.erlang","("], ["variable.other.erlang","Sum"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.separator.clauses.erlang",";"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["constant.other.symbol.unquoted.erlang","code_switch"], ["meta.expression.receive.erlang"," "], ["punctuation.separator.clause-head-body.erlang","->"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["keyword.operator.macro.erlang","?"], ["entity.name.function.macro.erlang","MODULE"], ["meta.expression.receive.erlang",":"], ["entity.name.function.erlang","codeswitch"], ["punctuation.definition.parameters.begin.erlang","("], ["variable.other.erlang","Sum"], ["punctuation.definition.parameters.end.erlang",")"] ],[ ["keyword.control.receive.erlang","text6","text6","meta.function.erlang"], ["meta.expression.receive.erlang"," "], ["punctuation.definition.comment.erlang","% Force the use of 'codeswitch/1' from the latest MODULE version"] ],[ "start", ["meta.expression.receive.erlang"," "], ["keyword.control.end.erlang","end"], ["punctuation.terminator.function.erlang","."] ],[ "start", ["text"," "] ],[ "start", ["meta.function.erlang"," "], ["entity.name.function.definition.erlang","codeswitch"], ["punctuation.section.expression.begin.erlang","("], ["variable.other.erlang","Sum"], ["punctuation.section.expression.end.erlang",")"], ["text"," "], ["keyword.operator.symbolic.erlang","->"], ["text"," "], ["entity.name.function.erlang","loop"], ["punctuation.definition.parameters.begin.erlang","("], ["variable.other.erlang","Sum"], ["punctuation.definition.parameters.end.erlang",")"], ["punctuation.terminator.function.erlang","."] ]] ================================================ FILE: lib/ace/mode/_test/tokens_forth.json ================================================ [[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","HELLO"], ["meta.block.forth"," "], ["comment.line.parentheses.forth"," ( -- )"], ["meta.block.forth"," CR "], ["string.quoted.double.forth",".\" Hello, world!\""], ["meta.block.forth"," "], ["keyword.other.compile-only.forth",";"], ["text"," "] ],[ "start" ],[ "start", ["text","HELLO "] ],[ "start", ["text","Hello, world!"] ],[ "start" ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","[CHAR]"], ["meta.block.forth"," "], ["keyword.other.non-immediate.forth"," CHAR"], ["meta.block.forth"," "], ["keyword.other.compile-only.forth"," POSTPONE"], ["meta.block.forth"," LITERAL "], ["keyword.other.compile-only.forth",";"], ["keyword.other.immediate.forth"," IMMEDIATE"] ],[ "start" ],[ "start", ["constant.numeric.forth","0"], ["storage.type.forth"," value"], ["text"," ii "], ["constant.numeric.forth"," 0"], ["storage.type.forth"," value"], ["text"," jj"] ],[ "start", ["constant.numeric.forth","0"], ["storage.type.forth"," value"], ["text"," KeyAddr "], ["constant.numeric.forth"," 0"], ["storage.type.forth"," value"], ["text"," KeyLen"] ],[ "start", ["storage.type.forth","create"], ["text"," SArray "], ["constant.numeric.forth"," 256"], ["text"," allot "], ["comment.line.backslash.forth"," \\ state array of 256 bytes"] ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","KeyArray"], ["meta.block.forth"," KeyLen mod KeyAddr "], ["keyword.other.compile-only.forth",";"] ],[ "start" ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","get_byte"], ["meta.block.forth"," + c@ "], ["keyword.other.compile-only.forth",";"] ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","set_byte"], ["meta.block.forth"," + c! "], ["keyword.other.compile-only.forth",";"] ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","as_byte"], ["meta.block.forth"," "], ["constant.numeric.forth"," 255"], ["meta.block.forth"," and "], ["keyword.other.compile-only.forth",";"] ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","reset_ij"], ["meta.block.forth"," "], ["constant.numeric.forth"," 0"], ["keyword.other.immediate.forth"," TO"], ["meta.block.forth"," ii "], ["constant.numeric.forth"," 0"], ["keyword.other.immediate.forth"," TO"], ["meta.block.forth"," jj "], ["keyword.other.compile-only.forth",";"] ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","i_update"], ["meta.block.forth"," "], ["constant.numeric.forth"," 1"], ["meta.block.forth"," + as_byte"], ["keyword.other.immediate.forth"," TO"], ["meta.block.forth"," ii "], ["keyword.other.compile-only.forth",";"] ],[ "start", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","j_update"], ["meta.block.forth"," ii SArray get_byte + as_byte"], ["keyword.other.immediate.forth"," TO"], ["meta.block.forth"," jj "], ["keyword.other.compile-only.forth",";"] ],[ "keyword.other.compile-only.forth", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","swap_s_ij"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," jj SArray get_byte"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii SArray get_byte jj SArray set_byte"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii SArray set_byte"] ],[ "start", ["keyword.other.compile-only.forth",";"] ],[ "start" ],[ "keyword.other.compile-only.forth", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","rc4_init"], ["comment.line.parentheses.forth"," ( KeyAddr KeyLen -- )"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," "], ["constant.numeric.forth"," 256"], ["meta.block.forth"," min"], ["keyword.other.immediate.forth"," TO"], ["meta.block.forth"," KeyLen "], ["keyword.other.immediate.forth"," TO"], ["meta.block.forth"," KeyAddr"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," "], ["constant.numeric.forth"," 256 0"], ["keyword.control.compile-only.forth"," DO"], ["meta.block.forth"," "], ["variable.language.forth","i"], ["meta.block.forth"," "], ["variable.language.forth","i"], ["meta.block.forth"," SArray set_byte "], ["keyword.control.compile-only.forth"," LOOP"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," reset_ij"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," "], ["keyword.control.compile-only.forth"," BEGIN"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii KeyArray get_byte jj + j_update"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," swap_s_ij"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii"], ["constant.numeric.forth"," 255"], ["meta.block.forth"," <"], ["keyword.control.compile-only.forth"," WHILE"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii i_update"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," "], ["keyword.control.compile-only.forth"," REPEAT"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," reset_ij"] ],[ "start", ["keyword.other.compile-only.forth",";"] ],[ "keyword.other.compile-only.forth", ["keyword.other.compile-only.forth",":"], ["meta.block.forth"," "], ["entity.name.function.forth","rc4_byte"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii i_update jj j_update"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," swap_s_ij"] ],[ "keyword.other.compile-only.forth", ["meta.block.forth"," ii SArray get_byte jj SArray get_byte + as_byte SArray get_byte xor"] ],[ "start", ["keyword.other.compile-only.forth",";"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_fortran.json ================================================ [[ "start", ["keyword","#include"], ["text"," "], ["string","\"globalDefines.h\""] ],[ "start" ],[ "start", ["comment","!========================================================="] ],[ "start", ["keyword","program"], ["text"," "], ["identifier","main"] ],[ "start", ["comment","!========================================================= "] ],[ "start", ["text"," "], ["keyword","use"], ["text"," "], ["identifier","params_module"], ["text",", "], ["keyword","only"], ["text"," : "], ["identifier","nx"], ["text",", "], ["identifier","ny"], ["text",", "], ["identifier","nz"] ],[ "start" ],[ "start", ["text"," "], ["keyword","implicit"], ["text"," "], ["keyword","none"] ],[ "start" ],[ "start", ["text"," "], ["storage.type","integer"], ["text",", "], ["storage.modifier","parameter"], ["text"," :: "], ["identifier","g"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","9.81"] ],[ "start", ["text"," "], ["storage.type","real"], ["text",", "], ["storage.modifier","allocatable"], ["text",", "], ["storage.modifier","dimension"], ["paren.lparen","("], ["text",":,:,:"], ["paren.rparen",")"], ["text"," :: "], ["identifier","array"] ],[ "start", ["text"," "], ["storage.type","integer"], ["text"," :: "], ["identifier","a"], ["text",", "], ["identifier","b"], ["text",", "], ["identifier","c"] ],[ "start", ["text"," "], ["storage.type","real"], ["keyword.operator","*"], ["constant.numeric","8"], ["text"," :: "], ["identifier","x"], ["text",", "], ["identifier","y"], ["text",", "], ["identifier","z"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["identifier","b"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","5"] ],[ "start", ["text"," "], ["identifier","c"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","7"] ],[ "start" ],[ "start", ["keyword","#ifdef"], ["text"," "], ["identifier","ARRAY_COMP"] ],[ "start", ["text"," "], ["support.function","allocate"], ["paren.lparen","("], ["identifier","array"], ["paren.lparen","("], ["constant.numeric","10"], ["text",","], ["constant.numeric","10"], ["text",","], ["constant.numeric","10"], ["paren.rparen",")"], ["text",", "], ["keyword","status"], ["keyword.operator","="], ["identifier","a"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["text"," "], ["keyword","write"], ["paren.lparen","("], ["identifier","c"], ["text",","], ["string","'(i5.5)'"], ["paren.rparen",")"], ["text"," "], ["identifier","b"] ],[ "start", ["keyword","#endif"] ],[ "start" ],[ "start", ["text"," "], ["keyword","if"], ["paren.lparen","("], ["identifier","x"], ["text","."], ["keyword.operator","lt"], ["constant.numeric",".5.0"], ["paren.rparen",")"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["identifier","array"], ["paren.lparen","("], ["text",":,:,:"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","g"] ],[ "start", ["text"," "], ["keyword","else"] ],[ "start", ["text"," "], ["identifier","array"], ["paren.lparen","("], ["text",":,:,:"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["identifier","y"] ],[ "start", ["text"," "], ["keyword","endif"] ],[ "start" ],[ "start", ["text"," "], ["keyword","return"] ],[ "start", ["comment","!======================================================== "] ],[ "start", ["keyword","end"], ["text"," "], ["keyword","program"], ["text"," "], ["identifier","main"] ],[ "start", ["comment","!========================================================"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_ftl.json ================================================ [[ "start", ["keyword.function","<#ftl"], ["text"," "], ["entity.other.attribute-name","encoding"], ["keyword.operator","="], ["string","\"utf-8\""], ["text"," "], ["keyword","/>"] ],[ "start", ["keyword.function","<#setting"], ["text"," "], ["entity.other.attribute-name","locale"], ["keyword.operator","="], ["string","\"en_US\""], ["text"," "], ["keyword","/>"] ],[ "start", ["keyword.function","<#import"], ["text"," "], ["string","\"library\""], ["text"," "], ["keyword.operator","as"], ["text"," "], ["variable","lib"], ["text"," "], ["keyword","/>"] ],[ "ftl-dcomment", ["comment","<#--"] ],[ "ftl-dcomment", ["comment"," FreeMarker comment"] ],[ "ftl-dcomment", ["comment"," ${abc} <#assign a=12 />"] ],[ "start", ["comment","-->"] ],[ "start" ],[ "start", ["xml-pe.doctype.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","lang"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"en-us\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","head"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","meta"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","charset"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"utf-8\""], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"], ["string.interpolated","${"], ["variable","title"], ["keyword.operator","!"], ["string","\"FreeMarker\""], ["string.interpolated","}"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Hello "], ["string.interpolated","${"], ["variable","name"], ["keyword.operator","!"], ["string","\"\""], ["string.interpolated","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Today is: "], ["string.interpolated","${"], ["language.variable",".now"], ["support.function","?date"], ["string.interpolated","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["keyword.function","<#assign"], ["text"," "], ["variable","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","13"], ["keyword",">"] ],[ "start", ["text.xml"," "], ["keyword.function","<#if"], ["text"," "], ["variable","x"], ["text"," "], ["constant.character.entity",">"], ["text"," "], ["constant.numeric","12"], ["text"," "], ["keyword.operator","&&"], ["text"," "], ["variable","x"], ["text"," "], ["keyword.operator","lt"], ["text"," "], ["constant.numeric","14"], ["keyword",">"], ["text.xml","x equals 13: "], ["string.interpolated","${"], ["variable","x"], ["string.interpolated","}"], ["keyword.function",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["keyword.function","<#list"], ["text"," "], ["variable","items"], ["text"," "], ["keyword.operator","as"], ["text"," "], ["variable","item"], ["keyword",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["string.interpolated","${"], ["variable","item_index"], ["string.interpolated","}"], ["text.xml",": "], ["string.interpolated","${"], ["variable","item.name"], ["keyword.operator","!"], ["support.function","?split"], ["paren.lparen","("], ["string","\""], ["constant.character.escape","\\n"], ["string","\""], ["paren.rparen",")"], ["paren.lparen","["], ["constant.numeric","0"], ["paren.rparen","]"], ["string.interpolated","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["keyword.function",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," User directive: "], ["keyword.other","<@lib.function"], ["text"," "], ["variable","attr1"], ["keyword.operator","="], ["constant.language","true"], ["text"," "], ["variable","attr2"], ["keyword.operator","="], ["string","'value'"], ["text"," "], ["variable","attr3"], ["keyword.operator","="], ["constant.numeric","-42.12"], ["keyword",">"], ["text.xml","Test"], ["keyword.other",""] ],[ "start", ["text.xml"," "], ["keyword.other","<@anotherOne"], ["text"," "], ["keyword","/>"] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["keyword.function","<#if"], ["text"," "], ["variable","variable"], ["support.function.deprecated","?exists"], ["keyword",">"] ],[ "start", ["text.xml"," Deprecated"] ],[ "start", ["text.xml"," "], ["keyword.function","<#elseif"], ["text"," "], ["variable","variable"], ["support.function","??"], ["keyword",">"] ],[ "start", ["text.xml"," Better"] ],[ "start", ["text.xml"," "], ["keyword.function","<#else"], ["keyword",">"] ],[ "start", ["text.xml"," Default"] ],[ "start", ["text.xml"," "], ["keyword.function",""] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.image.tag-name.xml","img"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","src"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"images/"], ["string.interpolated","${"], ["variable","user.id"], ["string.interpolated","}"], ["string.attribute-value.xml",".png\""], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["text.xml"," "] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_gcode.json ================================================ [[ "start", ["identifier","O"], ["constant.numeric","003"], ["text"," "], ["comment","(DIAMOND SQUARE)"] ],[ "start", ["comment","N2"], ["text"," "], ["string","G54"], ["text"," "], ["string","G90"], ["text"," "], ["string","G49"], ["text"," "], ["string","G80"] ],[ "start", ["comment","N3"], ["text"," "], ["string","M6"], ["text"," "], ["identifier","T"], ["constant.numeric","1"], ["text"," "], ["comment","(1.ENDMILL)"] ],[ "start", ["comment","N4"], ["text"," "], ["string","M3"], ["text"," "], ["identifier","S"], ["constant.numeric","1800"] ],[ "start", ["comment","N5"], ["text"," "], ["string","G0"], ["text"," "], ["identifier","X"], ["constant.numeric","-.6"], ["text"," "], ["identifier","Y"], ["constant.numeric","2.050"] ],[ "start", ["comment","N6"], ["text"," "], ["string","G43"], ["text"," "], ["identifier","H"], ["constant.numeric","1"], ["text"," "], ["identifier","Z"], ["constant.numeric",".1"] ],[ "start", ["comment","N7"], ["text"," "], ["string","G1"], ["text"," "], ["identifier","Z"], ["constant.numeric","-.3"], ["text"," "], ["identifier","F"], ["constant.numeric","50."] ],[ "start", ["comment","N8"], ["text"," "], ["string","G41"], ["text"," "], ["identifier","D"], ["constant.numeric","1"], ["text"," "], ["identifier","Y"], ["constant.numeric","1.45"] ],[ "start", ["comment","N9"], ["text"," "], ["string","G1"], ["text"," "], ["identifier","X"], ["constant.numeric","0"], ["text"," "], ["identifier","F"], ["constant.numeric","20."] ],[ "start", ["comment","N10"], ["text"," "], ["string","G2"], ["text"," "], ["identifier","J"], ["constant.numeric","-1.45"] ],[ "start", ["comment","(CUTTER COMP CANCEL)"] ],[ "start", ["comment","N11"], ["text"," "], ["string","G1"], ["text"," "], ["identifier","Z"], ["constant.numeric","-.2"], ["text"," "], ["identifier","F"], ["constant.numeric","50."] ],[ "start", ["comment","N12"], ["text"," "], ["identifier","Y"], ["constant.numeric","-.990"] ],[ "start", ["comment","N13"], ["text"," "], ["string","G40"] ],[ "start", ["comment","N14"], ["text"," "], ["string","G0"], ["text"," "], ["identifier","X"], ["constant.numeric","-.6"], ["text"," "], ["identifier","Y"], ["constant.numeric","1.590"] ],[ "start", ["comment","N15"], ["text"," "], ["string","G0"], ["text"," "], ["identifier","Z"], ["constant.numeric",".1"] ],[ "start", ["comment","N16"], ["text"," "], ["string","M5"], ["text"," "], ["string","G49"], ["text"," "], ["string","G28"], ["text"," "], ["string","G91"], ["text"," "], ["identifier","Z"], ["constant.numeric","0"] ],[ "start", ["comment","N17"], ["text"," "], ["identifier","CALL"], ["text"," "], ["identifier","O"], ["constant.numeric","9456"] ],[ "start", ["comment","N18"], ["text"," #"], ["constant.numeric","500"], ["text","="], ["constant.numeric","0.004"] ],[ "start", ["comment","N19"], ["text"," #"], ["constant.numeric","503"], ["text","="], ["paren.lparen","["], ["text","#"], ["constant.numeric","500"], ["text","+#"], ["constant.numeric","501"], ["paren.rparen","]"] ],[ "start", ["comment","N20"], ["text"," "], ["identifier","VC"], ["constant.numeric","45"], ["text","="], ["constant.numeric","0.0006"] ],[ "start", ["identifier","VS"], ["constant.numeric","4"], ["text","="], ["constant.numeric","0.0007"] ],[ "start", ["comment","N21"], ["text"," "], ["string","G90"], ["text"," "], ["string","G10"], ["text"," "], ["identifier","L"], ["constant.numeric","20"], ["text"," "], ["identifier","P"], ["constant.numeric","3"], ["text"," "], ["identifier","X"], ["constant.numeric","5."], ["identifier","Y"], ["constant.numeric","4."], ["text"," "], ["identifier","Z"], ["constant.numeric","6.567"] ],[ "start", ["comment","N22"], ["text"," "], ["string","G0"], ["text"," "], ["identifier","X"], ["constant.numeric","5000"] ],[ "start", ["comment","N23"], ["text"," "], ["identifier","IF"], ["text"," "], ["paren.lparen","["], ["text","#"], ["constant.numeric","1"], ["text"," "], ["identifier","LT"], ["text"," "], ["constant.numeric","0.370"], ["paren.rparen","]"], ["text"," "], ["identifier","GOTO"], ["text"," "], ["constant.numeric","49"] ],[ "start", ["comment","N24"], ["text"," "], ["identifier","X"], ["constant.numeric","-0.678"], ["text"," "], ["identifier","Y"], ["constant.numeric","+.990"] ],[ "start", ["comment","N25"], ["text"," "], ["string","G84.3"], ["text"," "], ["identifier","X"], ["constant.numeric","-0.1"] ],[ "start", ["comment","N26"], ["text"," #"], ["constant.numeric","4"], ["text","=#"], ["constant.numeric","5"], ["text","*"], ["identifier","COS"], ["paren.lparen","["], ["constant.numeric","45"], ["paren.rparen","]"] ],[ "start", ["comment","N27"], ["text"," #"], ["constant.numeric","4"], ["text","=#"], ["constant.numeric","5"], ["text","*"], ["identifier","SIN"], ["paren.lparen","["], ["constant.numeric","45"], ["paren.rparen","]"] ],[ "start", ["comment","N28"], ["text"," "], ["identifier","VZOFZ"], ["text","="], ["constant.numeric","652.9658"] ],[ "start", ["text","%"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_gherkin.json ================================================ [[ "start", ["variable.parameter","@these"], ["text"," "], ["variable.parameter","@_are_"], ["text"," "], ["variable.parameter","@tags"] ],[ "start", ["keyword","Feature:"], ["text"," Serve coffee"] ],[ "start", ["text"," Coffee should not be served until paid for"] ],[ "start", ["text"," Coffee should not be served until the button has been pressed"] ],[ "start", ["text"," If there is no coffee left then money should be refunded"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","Scenario Outline:"], ["text"," Eating"] ],[ "start", ["text"," "], ["keyword","Given"], ["text"," there are "], ["comment",""], ["text"," cucumbers"] ],[ "start", ["text"," "], ["keyword","When"], ["text"," I eat "], ["comment",""], ["text"," cucumbers"] ],[ "start", ["text"," "], ["keyword","Then"], ["text"," I should have "], ["comment",""], ["text"," cucumbers"] ],[ "start" ],[ "start", ["text"," "], ["keyword","Examples:"] ],[ "start", ["text"," "], ["comment","|"], ["string"," start "], ["comment","|"], ["string"," eat "], ["comment","|"], ["string"," left "], ["comment","|"] ],[ "start", ["text"," "], ["comment","|"], ["string"," 12 "], ["comment","|"], ["string"," 5 "], ["comment","|"], ["string"," 7 "], ["comment","|"] ],[ "start", ["text"," "], ["comment","|"], ["string"," @20 "], ["comment","|"], ["string"," 5 "], ["comment","|"], ["string"," 15 "], ["comment","|"], ["string"," "] ],[ "start" ],[ "start", ["text"," "], ["keyword","Scenario:"], ["text"," Buy last coffee"] ],[ "start", ["text"," "], ["keyword","Given"], ["text"," there are "], ["constant.numeric","1"], ["text"," coffees left in the machine"] ],[ "start", ["text"," "], ["keyword","And"], ["text"," I have deposited "], ["constant.numeric","1"], ["text","$ "] ],[ "start", ["text"," "], ["keyword","When"], ["text"," I press the coffee button"] ],[ "start", ["text"," "], ["keyword","Then"], ["text"," I should be served a "], ["string","\"coffee\""] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","# this a comment"] ],[ "start", ["text"," "] ],[ "qqstring3", ["text"," "], ["string","\"\"\""] ],[ "qqstring3", ["string"," this is a "] ],[ "qqstring3", ["string"," pystring"] ],[ "start", ["string"," \"\"\""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_gitignore.json ================================================ [[ "start", ["comment","# A sample .gitignore file."] ],[ "start" ],[ "start", ["text",".buildlog"] ],[ "start", ["text",".DS_Store"] ],[ "start", ["text",".svn"] ],[ "start" ],[ "start", ["comment","# Negated patterns:"] ],[ "start", ["keyword","!foo.bar"] ],[ "start" ],[ "start", ["comment","# Also ignore user settings..."] ],[ "start", ["text","/.settings"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_glsl.json ================================================ [[ "start", ["keyword","uniform"], ["text"," "], ["keyword","float"], ["text"," "], ["identifier","amplitude"], ["punctuation.operator",";"] ],[ "start", ["keyword","attribute"], ["text"," "], ["keyword","float"], ["text"," "], ["identifier","displacement"], ["punctuation.operator",";"] ],[ "start", ["keyword","varying"], ["text"," "], ["keyword","vec3"], ["text"," "], ["identifier","vNormal"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","void"], ["text"," "], ["identifier","main"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start" ],[ "start", ["text"," "], ["identifier","vNormal"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","normal"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","// multiply our displacement by the"] ],[ "start", ["text"," "], ["comment","// amplitude. The amp will get animated"] ],[ "start", ["text"," "], ["comment","// so we'll have animated displacement"] ],[ "start", ["text"," "], ["keyword","vec3"], ["text"," "], ["identifier","newPosition"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","position"], ["text"," "], ["keyword.operator","+"], ["text"," "] ],[ "start", ["text"," "], ["identifier","normal"], ["text"," "], ["keyword.operator","*"], ["text"," "] ],[ "start", ["text"," "], ["keyword","vec3"], ["paren.lparen","("], ["identifier","displacement"], ["text"," "], ["keyword.operator","*"] ],[ "start", ["text"," "], ["identifier","amplitude"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["constant.language","gl_Position"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","projectionMatrix"], ["text"," "], ["keyword.operator","*"] ],[ "start", ["text"," "], ["identifier","modelViewMatrix"], ["text"," "], ["keyword.operator","*"] ],[ "start", ["text"," "], ["keyword","vec4"], ["paren.lparen","("], ["identifier","newPosition"], ["punctuation.operator",","], ["constant.numeric","1.0"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_gobstones.json ================================================ [[ "start", ["keyword","program"], ["text"," "], ["lparen","{"] ],[ "comment", ["text"," "], ["comment","/*"] ],[ "comment", ["comment"," * A gobstons multiline comment"] ],[ "comment", ["comment"," * Taken from:"] ],[ "comment", ["comment"," * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/\""] ],[ "start", ["comment"," */"] ],[ "start", ["text"," "], ["identifier","sumar"], ["lparen","("], ["constant.numeric","2"], ["keyword.operator",","], ["text"," "], ["constant.numeric","3"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["keyword","function"], ["text"," "], ["identifier","sumar"], ["lparen","("], ["identifier","a"], ["keyword.operator",","], ["text"," "], ["identifier","b"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","r"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["identifier","a"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","b"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["comment","// unreachable code"] ],[ "start", ["text"," "], ["comment","-- unreachable code"] ],[ "start", ["text"," "], ["comment","# unreachable code"] ],[ "start", ["text"," "], ["keyword","procedure"], ["text"," "], ["identifier","hacerAlgo"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["support.function","Mover"], ["lparen","("], ["support.type","Este"], ["rparen",")"] ],[ "start", ["text"," "], ["support.function","Poner"], ["lparen","("], ["support.type","Rojo"], ["rparen",")"] ],[ "start", ["text"," "], ["support.function","Sacar"], ["lparen","("], ["support.type","Azul"], ["rparen",")"] ],[ "start", ["text"," "], ["rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_golang.json ================================================ [[ "start", ["comment","// Concurrent computation of pi."] ],[ "start", ["comment","// See http://goo.gl/ZuTZM."] ],[ "start", ["comment","//"] ],[ "start", ["comment","// This demonstrates Go's ability to handle"] ],[ "start", ["comment","// large numbers of concurrent processes."] ],[ "start", ["comment","// It is an unreasonable way to calculate pi."] ],[ "start", ["keyword","package"], ["text"," "], ["identifier","main"] ],[ "start" ],[ "start", ["keyword","import"], ["text"," "], ["paren.lparen","("] ],[ "start", ["text"," "], ["string","\"fmt\""] ],[ "start", ["text"," "], ["string","\"math\""] ],[ "start", ["paren.rparen",")"] ],[ "start" ],[ "start", ["keyword","func"], ["text"," "], ["entity.name.function","main"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","fmt"], ["punctuation.operator","."], ["support.function","Println"], ["paren.lparen","("], ["support.function","pi"], ["paren.lparen","("], ["constant.numeric","5000"], ["paren.rparen","))"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","// pi launches n goroutines to compute an"] ],[ "start", ["comment","// approximation of pi."] ],[ "start", ["keyword","func"], ["text"," "], ["entity.name.function","pi"], ["paren.lparen","("], ["identifier","n"], ["text"," "], ["support.type","int"], ["paren.rparen",")"], ["text"," "], ["support.type","float64"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","ch"], ["text"," "], ["punctuation.operator",":"], ["keyword.operator","="], ["text"," "], ["support.function","make"], ["paren.lparen","("], ["keyword","chan"], ["text"," "], ["support.type","float64"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["identifier","k"], ["text"," "], ["punctuation.operator",":"], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["identifier","k"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","n"], ["punctuation.operator",";"], ["text"," "], ["identifier","k"], ["keyword.operator","++"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","go"], ["text"," "], ["support.function","term"], ["paren.lparen","("], ["identifier","ch"], ["punctuation.operator",","], ["text"," "], ["support.type","float64"], ["paren.lparen","("], ["identifier","k"], ["paren.rparen","))"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["identifier","f"], ["text"," "], ["punctuation.operator",":"], ["keyword.operator","="], ["text"," "], ["constant.numeric","0.0"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["identifier","k"], ["text"," "], ["punctuation.operator",":"], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["identifier","k"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","n"], ["punctuation.operator",";"], ["text"," "], ["identifier","k"], ["keyword.operator","++"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","f"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["keyword.operator","<-"], ["identifier","ch"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","f"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","func"], ["text"," "], ["entity.name.function","term"], ["paren.lparen","("], ["identifier","ch"], ["text"," "], ["keyword","chan"], ["text"," "], ["support.type","float64"], ["punctuation.operator",","], ["text"," "], ["identifier","k"], ["text"," "], ["support.type","float64"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","ch"], ["text"," "], ["keyword.operator","<-"], ["text"," "], ["constant.numeric","4"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","math"], ["punctuation.operator","."], ["support.function","Pow"], ["paren.lparen","("], ["constant.numeric","-1"], ["punctuation.operator",","], ["text"," "], ["identifier","k"], ["paren.rparen",")"], ["text"," / "], ["paren.lparen","("], ["constant.numeric","2"], ["keyword.operator","*"], ["identifier","k"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_groovy.json ================================================ [[ "start", ["comment","//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Employee"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","def"], ["text"," "], ["identifier","name"], ["text",", "], ["identifier","salary"] ],[ "start", ["text"," "], ["keyword","boolean"], ["text"," "], ["identifier","manager"] ],[ "start", ["text"," "], ["support.function","String"], ["text"," "], ["identifier","toString"], ["lparen","("], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["keyword","return"], ["text"," "], ["identifier","name"], ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","def"], ["text"," "], ["identifier","emps"], ["text"," "], ["keyword.operator","="], ["text"," "], ["lparen","["], ["keyword","new"], ["text"," "], ["identifier","Employee"], ["lparen","("], ["identifier","name"], ["text",":"], ["string","'Guillaume'"], ["text",", "], ["identifier","manager"], ["text",":"], ["constant.language.boolean","true"], ["text",", "], ["identifier","salary"], ["text",":"], ["constant.numeric","200"], ["rparen",")"], ["text",","] ],[ "start", ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Employee"], ["lparen","("], ["identifier","name"], ["text",":"], ["string","'Graeme'"], ["text",", "], ["identifier","manager"], ["text",":"], ["constant.language.boolean","true"], ["text",", "], ["identifier","salary"], ["text",":"], ["constant.numeric","200"], ["rparen",")"], ["text",","] ],[ "start", ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Employee"], ["lparen","("], ["identifier","name"], ["text",":"], ["string","'Dierk'"], ["text",", "], ["identifier","manager"], ["text",":"], ["constant.language.boolean","false"], ["text",", "], ["identifier","salary"], ["text",":"], ["constant.numeric","151"], ["rparen",")"], ["text",","] ],[ "start", ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Employee"], ["lparen","("], ["identifier","name"], ["text",":"], ["string","'Bernd'"], ["text",", "], ["identifier","manager"], ["text",":"], ["constant.language.boolean","false"], ["text",", "], ["identifier","salary"], ["text",":"], ["constant.numeric","50"], ["rparen",")]"] ],[ "start" ],[ "start", ["keyword","def"], ["text"," "], ["identifier","managers"], ["lparen","("], ["identifier","emps"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","emps"], ["text","."], ["identifier","findAll"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier","e"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","e"], ["text","."], ["identifier","isManager"], ["lparen","("], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","assert"], ["text"," "], ["identifier","emps"], ["lparen","["], ["constant.numeric","0"], ["text",".."], ["constant.numeric","1"], ["rparen","]"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","managers"], ["lparen","("], ["identifier","emps"], ["rparen",")"], ["text"," "], ["comment","// [Guillaume, Graeme]"] ],[ "start" ],[ "start", ["keyword","def"], ["text"," "], ["identifier","highPaid"], ["lparen","("], ["identifier","emps"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","threshold"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","150"] ],[ "start", ["text"," "], ["identifier","emps"], ["text","."], ["identifier","findAll"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier","e"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","e"], ["text","."], ["identifier","salary"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["identifier","threshold"], ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","assert"], ["text"," "], ["identifier","emps"], ["lparen","["], ["constant.numeric","0"], ["text",".."], ["constant.numeric","2"], ["rparen","]"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","highPaid"], ["lparen","("], ["identifier","emps"], ["rparen",")"], ["text"," "], ["comment","// [Guillaume, Graeme, Dierk]"] ],[ "start" ],[ "start", ["keyword","def"], ["text"," "], ["identifier","paidMore"], ["lparen","("], ["identifier","amount"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["lparen","{"], ["text"," "], ["identifier","e"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","e"], ["text","."], ["identifier","salary"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["identifier","amount"], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start", ["keyword","def"], ["text"," "], ["identifier","highPaid"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","paidMore"], ["lparen","("], ["constant.numeric","150"], ["rparen",")"] ],[ "start" ],[ "start", ["keyword","assert"], ["text"," "], ["identifier","highPaid"], ["lparen","("], ["identifier","emps"], ["lparen","["], ["constant.numeric","0"], ["rparen","])"], ["text"," "], ["comment","// true"] ],[ "start", ["keyword","assert"], ["text"," "], ["identifier","emps"], ["lparen","["], ["constant.numeric","0"], ["text",".."], ["constant.numeric","2"], ["rparen","]"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","emps"], ["text","."], ["identifier","findAll"], ["lparen","("], ["identifier","highPaid"], ["rparen",")"] ],[ "start" ],[ "start", ["keyword","def"], ["text"," "], ["identifier","filename"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","'test.txt'"] ],[ "start", ["keyword","new"], ["text"," "], ["identifier","File"], ["lparen","("], ["identifier","filename"], ["rparen",")"], ["text","."], ["identifier","withReader"], ["lparen","{"], ["text"," "], ["identifier","reader"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","doSomethingWith"], ["lparen","("], ["identifier","reader"], ["rparen",")"], ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["keyword","def"], ["text"," "], ["identifier","readersText"] ],[ "start", ["keyword","def"], ["text"," "], ["identifier","doSomethingWith"], ["lparen","("], ["identifier","reader"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier","readersText"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","reader"], ["text","."], ["identifier","text"], ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["keyword","assert"], ["text"," "], ["keyword","new"], ["text"," "], ["identifier","File"], ["lparen","("], ["identifier","filename"], ["rparen",")"], ["text","."], ["identifier","text"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["identifier","readersText"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_haml.json ================================================ [[ "start", ["keyword.other.doctype","!!!5"] ],[ "start" ],[ "embedded_ruby", ["text","# "] ],[ "embedded_ruby", ["text","# "] ],[ "embedded_ruby", ["text","# "] ],[ "embedded_ruby", ["text","# <"], ["identifier","html"], ["text"," "], ["keyword","class"], ["text","="], ["string","\"no-js\""], ["text"," "], ["identifier","lang"], ["text","="], ["string","\"en\""], ["text","> "] ],[ "start" ],[ "start" ],[ "start", ["comment.line","/adasdasdad"] ],[ "embedded_ruby", ["meta.tag.haml","%div"], ["text","{"], ["constant.other.symbol.ruby",":id"], ["text"," => "], ["string","\"#{@item.type}_#{@item.number}\""], ["text",", :"], ["keyword","class"], ["text"," => "], ["string","'#{@item.type} #{@item.urgency}'"], ["text",", :"], ["identifier","phoney"], ["text"," => "], ["string","`asdasdasd`"], ["text","}"] ],[ "start", ["comment.line","/ file: app/views/movies/index.html.haml"] ],[ "start", ["text","\\d"] ],[ "embedded_ruby", ["meta.tag.haml","%ads:"], ["text","{"], ["constant.other.symbol.ruby",":bleh"], ["text"," => "], ["constant.numeric","33"], ["text","}"] ],[ "embedded_ruby", ["meta.tag.haml","%p"], ["text","=="], ["identifier","ddd"], ["text","=="] ],[ "start", ["text"," Date"], ["comment.line","/Time:"] ],[ "embedded_ruby", ["text"," - "], ["identifier","now"], ["text"," = "], ["support.class","DateTime"], ["text","."], ["identifier","now"], ["text"," "] ],[ "embedded_ruby", ["text"," "], ["meta.tag.haml","%strong"], ["text","= "], ["identifier","now"] ],[ "embedded_ruby", ["text"," = "], ["keyword","if"], ["text"," "], ["identifier","now"], ["text"," "], ["support.class","DateTime"], ["text","."], ["identifier","parse"], ["text","("], ["string","\"December 31, 2006\""], ["text",")"] ],[ "embedded_ruby", ["text"," = "], ["string","\"Happy new \""], ["text"," + "], ["string","\"year!\""] ],[ "start", ["meta.tag.haml","%sfd"], ["keyword.attribute-name.class.haml",".dfdfg"] ],[ "element_class", ["keyword.attribute-name.id.haml","#content"] ],[ "start", ["text"," "], ["keyword.attribute-name.class.haml",".title"] ],[ "embedded_ruby", ["text"," "], ["meta.tag.haml","%h1"], ["text","= "], ["variable.instance","@title"] ],[ "embedded_ruby", ["text"," = "], ["support.function","link_to"], ["text"," "], ["string","'Home'"], ["text",", "], ["identifier","home_url"] ],[ "start" ],[ "element_class", ["text"," "], ["keyword.attribute-name.id.haml","#contents"] ],[ "element_class", ["meta.tag.haml","%div"], ["keyword.attribute-name.id.haml","#content"] ],[ "start", ["text"," "], ["meta.tag.haml","%div"], ["keyword.attribute-name.class.haml",".articles"] ],[ "start", ["text"," "], ["meta.tag.haml","%div"], ["keyword.attribute-name.class.haml",".article.title"], ["text"," Blah"] ],[ "start", ["text"," "], ["meta.tag.haml","%div"], ["keyword.attribute-name.class.haml",".article.date"], ["text"," "], ["constant.numeric","2006-11-05"] ],[ "start", ["text"," "], ["meta.tag.haml","%div"], ["keyword.attribute-name.class.haml",".article.entry"] ],[ "start", ["text"," Neil Patrick Harris "] ],[ "start" ],[ "start", ["meta.tag.haml","%div"], ["text","[@user, "], ["constant.other.symbol.ruby",":greeting"], ["text","]"] ],[ "start", ["text"," "], ["meta.tag.haml","%bar"], ["text","["], ["constant.numeric","290"], ["text","]"], ["comment.line","/"] ],[ "embedded_ruby", ["text"," =="], ["support.class","Hello"], ["text","!=="] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_handlebars.json ================================================ [[ "start", ["comment.start","{{!--"], ["comment"," Ace + :-}} "], ["comment.end","--}}"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"comments\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["storage.type.start","{{#"], ["variable.parameter","each"], ["text"," "], ["variable.parameter","comments"], ["storage.type.end","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"/posts/"], ["storage.type.start","{{"], ["text","../"], ["variable.parameter","permalink"], ["storage.type.end","}}"], ["string.attribute-value.xml","#"], ["storage.type.start","{{"], ["variable.parameter","id"], ["storage.type.end","}}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["storage.type.start","{{"], ["variable.parameter","title"], ["storage.type.end","}}"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.function","{{{"], ["variable.parameter","body"], ["support.function","}}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["storage.type.start","{{/"], ["variable.parameter","each"], ["storage.type.end","}}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_haskell.json ================================================ [[ "start", ["punctuation.definition.comment.haskell","-- Type annotation (optional)"] ],[ "start", ["entity.name.function.haskell","fib"], ["meta.function.type-declaration.haskell"," "], ["keyword.other.double-colon.haskell","::"], ["meta.function.type-declaration.haskell"," "], ["support.type.prelude.haskell","Int"], ["meta.function.type-declaration.haskell"," "], ["keyword.other.arrow.haskell","->"], ["meta.function.type-declaration.haskell"," "], ["support.type.prelude.haskell","Integer"] ],[ "start", ["text"," "] ],[ "start", ["punctuation.definition.comment.haskell","-- With self-referencing data"] ],[ "start", ["text","fib n "], ["keyword.operator.haskell","="], ["text"," fibs "], ["keyword.operator.haskell","!!"], ["text"," n"] ],[ "start", ["text"," "], ["keyword.other.haskell","where"], ["text"," fibs "], ["keyword.operator.haskell","="], ["text"," "], ["constant.numeric.haskell","0"], ["text"," "], ["keyword.operator.haskell",":"], ["text"," "], ["support.function.prelude.haskell","scanl"], ["text"," "], ["entity.name.function.infix.haskell","(+)"], ["text"," "], ["constant.numeric.haskell","1"], ["text"," fibs"] ],[ "start", ["text"," "], ["punctuation.definition.comment.haskell","-- 0,1,1,2,3,5,..."] ],[ "start", ["text"," "] ],[ "start", ["punctuation.definition.comment.haskell","-- Same, coded directly"] ],[ "start", ["text","fib n "], ["keyword.operator.haskell","="], ["text"," fibs "], ["keyword.operator.haskell","!!"], ["text"," n"] ],[ "start", ["text"," "], ["keyword.other.haskell","where"], ["text"," fibs "], ["keyword.operator.haskell","="], ["text"," "], ["constant.numeric.haskell","0"], ["text"," "], ["keyword.operator.haskell",":"], ["text"," "], ["constant.numeric.haskell","1"], ["text"," "], ["keyword.operator.haskell",":"], ["text"," next fibs"] ],[ "start", ["text"," next (a "], ["keyword.operator.haskell",":"], ["text"," t@(b"], ["keyword.operator.haskell",":"], ["text","_)) "], ["keyword.operator.haskell","="], ["text"," (a"], ["keyword.operator.haskell","+"], ["text","b) "], ["keyword.operator.haskell",":"], ["text"," next t"] ],[ "start", ["text"," "] ],[ "start", ["punctuation.definition.comment.haskell","-- Similar idea, using zipWith"] ],[ "start", ["text","fib n "], ["keyword.operator.haskell","="], ["text"," fibs "], ["keyword.operator.haskell","!!"], ["text"," n"] ],[ "start", ["text"," "], ["keyword.other.haskell","where"], ["text"," fibs "], ["keyword.operator.haskell","="], ["text"," "], ["constant.numeric.haskell","0"], ["text"," "], ["keyword.operator.haskell",":"], ["text"," "], ["constant.numeric.haskell","1"], ["text"," "], ["keyword.operator.haskell",":"], ["text"," "], ["support.function.prelude.haskell","zipWith"], ["text"," "], ["entity.name.function.infix.haskell","(+)"], ["text"," fibs ("], ["support.function.prelude.haskell","tail"], ["text"," fibs)"] ],[ "start", ["text"," "] ],[ "start", ["punctuation.definition.comment.haskell","-- Using a generator function"] ],[ "start", ["text","fib n "], ["keyword.operator.haskell","="], ["text"," fibs ("], ["constant.numeric.haskell","0"], ["punctuation.separator.comma.haskell",","], ["constant.numeric.haskell","1"], ["text",") "], ["keyword.operator.haskell","!!"], ["text"," n"] ],[ "start", ["text"," "], ["keyword.other.haskell","where"], ["text"," fibs (a"], ["punctuation.separator.comma.haskell",","], ["text","b) "], ["keyword.operator.haskell","="], ["text"," a "], ["keyword.operator.haskell",":"], ["text"," fibs (b"], ["punctuation.separator.comma.haskell",","], ["text","a"], ["keyword.operator.haskell","+"], ["text","b)"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_haxe.json ================================================ [[ "start", ["keyword","class"], ["text"," "], ["identifier","Haxe"], ["text"," "] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["keyword","static"], ["text"," "], ["keyword","function"], ["text"," "], ["identifier","main"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","// Say Hello!"] ],[ "start", ["text"," "], ["keyword","var"], ["text"," "], ["identifier","greeting"], ["punctuation.operator",":"], ["keyword","String"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"Hello World\""], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","trace"], ["paren.lparen","("], ["identifier","greeting"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","var"], ["text"," "], ["identifier","targets"], ["punctuation.operator",":"], ["keyword","Array"], ["keyword.operator","<"], ["keyword","String"], ["keyword.operator",">"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["string","\"Flash\""], ["punctuation.operator",","], ["string","\"Javascript\""], ["punctuation.operator",","], ["string","\"PHP\""], ["punctuation.operator",","], ["string","\"Neko\""], ["punctuation.operator",","], ["string","\"C++\""], ["punctuation.operator",","], ["string","\"iOS\""], ["punctuation.operator",","], ["string","\"Android\""], ["punctuation.operator",","], ["string","\"webOS\""], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","trace"], ["paren.lparen","("], ["string","\"Haxe is a great language that can target:\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["identifier","target"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","targets"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","trace"], ["text"," "], ["paren.lparen","("], ["string","\" - \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","target"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","trace"], ["paren.lparen","("], ["string","\"And many more!\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_html.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","scripts"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","a"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","'a'"], ["meta.tag.punctuation.tag-close.xml",">"], ["storage.type","var"], ["text"," "], ["string","\""], ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml","'123'"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ ["string.attribute-value.xml0","tag_stuff"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"abc"] ],[ "start", ["string.attribute-value.xml"," def\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ ["string.attribute-value.xml","tag_stuff"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","'abc"] ],[ "start", ["string.attribute-value.xml","def\\'"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_html_elixir.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Listing Books"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","table"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Title"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Summary"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["support.elixir_tag","<%="], ["text"," "], ["keyword.control.elixir","for"], ["text"," book "], ["keyword.operator.comparison.elixir","<"], ["keyword.operator.arithmetic.elixir","-"], ["text"," "], ["punctuation.definition.variable.elixir","@"], ["variable.other.readwrite.module.elixir","books"], ["text"," "], ["keyword.control.elixir","do"], ["text"," "], ["support.elixir_tag","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["comment.start.eex","<%#"], ["comment"," comment "], ["comment.end.eex","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.elixir_tag","<%="], ["text"," book"], ["punctuation.separator.method.elixir","."], ["text","title "], ["support.elixir_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.elixir_tag","<%="], ["text"," book"], ["punctuation.separator.method.elixir","."], ["text","content "], ["support.elixir_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.elixir_tag","<%="], ["text"," link "], ["punctuation.definition.string.begin.elixir","\""], ["string.quoted.double.elixir","Show"], ["punctuation.definition.string.end.elixir","\""], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir","to:"], ["text"," book_path"], ["punctuation.section.function.elixir","("], ["punctuation.definition.variable.elixir","@"], ["variable.other.readwrite.module.elixir","conn"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","show"], ["punctuation.separator.object.elixir",","], ["text"," book"], ["punctuation.section.function.elixir",")"], ["text"," "], ["support.elixir_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.elixir_tag","<%="], ["text"," link "], ["punctuation.definition.string.begin.elixir","\""], ["string.quoted.double.elixir","Edit"], ["punctuation.definition.string.end.elixir","\""], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir","to:"], ["text"," book_path"], ["punctuation.section.function.elixir","("], ["punctuation.definition.variable.elixir","@"], ["variable.other.readwrite.module.elixir","conn"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","edit"], ["punctuation.separator.object.elixir",","], ["text"," book"], ["punctuation.section.function.elixir",")"], ["text"," "], ["support.elixir_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.elixir_tag","<%="], ["text"," link "], ["punctuation.definition.string.begin.elixir","\""], ["string.quoted.double.elixir","Delete"], ["punctuation.definition.string.end.elixir","\""], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir","to:"], ["text"," book_path"], ["punctuation.section.function.elixir","("], ["punctuation.definition.variable.elixir","@"], ["variable.other.readwrite.module.elixir","conn"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","delete"], ["punctuation.separator.object.elixir",","], ["text"," book"], ["punctuation.section.function.elixir",")"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir","method:"], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","delete"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir","data:"], ["text"," "], ["punctuation.section.array.elixir","["], ["punctuation.definition.constant.elixir","confirm:"], ["text"," "], ["punctuation.definition.string.begin.elixir","\""], ["string.quoted.double.elixir","Are you sure?"], ["punctuation.definition.string.end.elixir","\""], ["punctuation.section.array.elixir","]"], ["text"," "], ["support.elixir_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["support.elixir_tag","<%"], ["text"," "], ["keyword.control.elixir","end"], ["text"," "], ["support.elixir_tag","%>"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","br"], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["text.xml"," "] ],[ "start", ["support.elixir_tag","<%="], ["text"," link "], ["punctuation.definition.string.begin.elixir","\""], ["string.quoted.double.elixir","New book"], ["punctuation.definition.string.end.elixir","\""], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir","to:"], ["text"," book_path"], ["punctuation.section.function.elixir","("], ["punctuation.definition.variable.elixir","@"], ["variable.other.readwrite.module.elixir","conn"], ["punctuation.separator.object.elixir",","], ["text"," "], ["punctuation.definition.constant.elixir",":"], ["constant.other.symbol.elixir","new"], ["punctuation.section.function.elixir",")"], ["text"," "], ["support.elixir_tag","%>"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_html_ruby.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Listing Books"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","table"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Title"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Summary"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","th"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["support.ruby_tag","<%"], ["text"," "], ["variable.instance","@books"], ["text","."], ["identifier","each"], ["text"," "], ["keyword","do"], ["text"," |"], ["identifier","book"], ["text","| "], ["support.ruby_tag","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["comment.start.erb","<%#"], ["comment"," comment "], ["comment.end.erb","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.ruby_tag","<%="], ["text"," "], ["identifier","book"], ["text","."], ["identifier","title"], ["text"," "], ["support.ruby_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.ruby_tag","<%="], ["text"," "], ["identifier","book"], ["text","."], ["identifier","content"], ["text"," "], ["support.ruby_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.ruby_tag","<%="], ["text"," "], ["support.function","link_to"], ["text"," "], ["string.start","'"], ["string","Show"], ["string.end","'"], ["text",", "], ["identifier","book"], ["text"," "], ["support.ruby_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.ruby_tag","<%="], ["text"," "], ["support.function","link_to"], ["text"," "], ["string.start","'"], ["string","Edit"], ["string.end","'"], ["text",", "], ["identifier","edit_book_path"], ["paren.lparen","("], ["identifier","book"], ["paren.rparen",")"], ["text"," "], ["support.ruby_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["meta.tag.punctuation.tag-close.xml",">"], ["support.ruby_tag","<%="], ["text"," "], ["support.function","link_to"], ["text"," "], ["string.start","'"], ["string","Remove"], ["string.end","'"], ["text",", "], ["identifier","book"], ["text",", "], ["constant.other.symbol.ruby",":confirm"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["string.start","'"], ["string","Are you sure?"], ["string.end","'"], ["text",", "], ["constant.other.symbol.ruby",":method"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["constant.other.symbol.ruby",":delete"], ["text"," "], ["support.ruby_tag","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["support.ruby_tag","<%"], ["text"," "], ["keyword","end"], ["text"," "], ["support.ruby_tag","%>"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","br"], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["text.xml"," "] ],[ "start", ["support.ruby_tag","<%="], ["text"," "], ["support.function","link_to"], ["text"," "], ["string.start","'"], ["string","New book"], ["string.end","'"], ["text",", "], ["identifier","new_book_path"], ["text"," "], ["support.ruby_tag","%>"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_ini.json ================================================ [[ "start", ["punctuation.definition.entity.ini","["], ["constant.section.group-title.ini",".ShellClassInfo"], ["punctuation.definition.entity.ini","]"] ],[ "start", ["keyword.other.definition.ini","IconResource"], ["punctuation.separator.key-value.ini","="], ["text","..\\logo.png"] ],[ "start", ["punctuation.definition.entity.ini","["], ["constant.section.group-title.ini","ViewState"], ["punctuation.definition.entity.ini","]"] ],[ "start", ["keyword.other.definition.ini","FolderType"], ["punctuation.separator.key-value.ini","="], ["text","Generic"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_io.json ================================================ [[ "start", ["punctuation.definition.comment.io","//"], ["comment.line.double-slash.io"," computes factorial of a number"] ],[ "start", ["text","factorial "], ["keyword.operator.io",":="], ["text"," "], ["support.function.io","method"], ["text","(n,"] ],[ "start", ["text"," "], ["keyword.control.io","if"], ["text","(n "], ["keyword.operator.io","=="], ["text"," "], ["constant.numeric.io","0"], ["text",", "], ["keyword.control.io","return"], ["text"," "], ["constant.numeric.io","1"], ["text",")"] ],[ "start", ["text"," res "], ["keyword.operator.io",":="], ["text"," "], ["constant.numeric.io","1"] ],[ "start", ["text"," "], ["support.class.io","Range"], ["text"," "], ["constant.numeric.io","1"], ["text"," "], ["support.function.io","to"], ["text","(n) "], ["keyword.control.io","foreach"], ["text","(i, res "], ["keyword.operator.io","="], ["text"," res "], ["keyword.operator.io","*"], ["text"," i)"] ],[ "start", ["text",")"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_jack.json ================================================ [[ "start", ["keyword","vars"], ["text"," "], ["variable","it"], ["text",", "], ["variable","p"] ],[ "start" ],[ "start", ["variable","p"], ["text"," = "], ["paren.lparen","{"], ["variable","label"], ["text",", "], ["variable","value"], ["text","|"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","\""], ["constant.language.escape","\\n"], ["string","\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","label"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["language.builtin","inspect"], ["paren.lparen","("], ["variable","value"], ["paren.rparen","))"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["comment","-- Create an array from 0 to 15"] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"range\""], ["text",", "], ["language.builtin","i-collect"], ["paren.lparen","("], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","5"], ["paren.rparen",")))"] ],[ "start" ],[ "start", ["comment","-- Create an array from 0 to 15 and break up in chunks of 4"] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"chunked range\""], ["text",", "], ["language.builtin","i-collect"], ["paren.lparen","("], ["language.builtin","i-chunk"], ["paren.lparen","("], ["constant.numeric","4"], ["text",", "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","16"], ["paren.rparen","))))"] ],[ "start" ],[ "start", ["comment","-- Check if all or none items in stream pass test."] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"all < 60 in range(60)\""], ["text",", "], ["variable","i-all?"], ["paren.lparen","({"], ["variable","i"], ["text","|"], ["variable","i"], ["keyword.operator","<"], ["constant.numeric","60"], ["paren.rparen","}"], ["text",", "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","60"], ["paren.rparen",")))"] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"any < 60 in range(60)\""], ["text",", "], ["variable","i-any?"], ["paren.lparen","({"], ["variable","i"], ["text","|"], ["variable","i"], ["keyword.operator",">"], ["constant.numeric","60"], ["paren.rparen","}"], ["text",", "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","60"], ["paren.rparen",")))"] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"all < 60 in range(70)\""], ["text",", "], ["variable","i-all?"], ["paren.lparen","({"], ["variable","i"], ["text","|"], ["variable","i"], ["keyword.operator","<"], ["constant.numeric","60"], ["paren.rparen","}"], ["text",", "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","70"], ["paren.rparen",")))"] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"any < 60 in range(70)\""], ["text",", "], ["variable","i-any?"], ["paren.lparen","({"], ["variable","i"], ["text","|"], ["variable","i"], ["keyword.operator",">"], ["constant.numeric","60"], ["paren.rparen","}"], ["text",", "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","70"], ["paren.rparen",")))"] ],[ "start" ],[ "start", ["comment","-- Zip three different collections together"] ],[ "start", ["variable","p"], ["paren.lparen","("], ["string","\"zipped\""], ["text",", "], ["language.builtin","i-collect"], ["paren.lparen","("], ["language.builtin","i-zip"], ["paren.lparen","("] ],[ "start", ["text"," "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","10"], ["paren.rparen",")"], ["text",","] ],[ "start", ["text"," "], ["paren.lparen","["], ["constant.numeric","1"], ["text",","], ["constant.numeric","2"], ["text",","], ["constant.numeric","3"], ["text",","], ["constant.numeric","4"], ["text",","], ["constant.numeric","5"], ["paren.rparen","]"], ["text",","] ],[ "start", ["text"," "], ["language.builtin","i-map"], ["paren.lparen","({"], ["variable","i"], ["text","|"], ["variable","i"], ["keyword.operator","*"], ["variable","i"], ["paren.rparen","}"], ["text",", "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","10"], ["paren.rparen","))"] ],[ "start", ["paren.rparen",")))"] ],[ "start" ],[ "start", ["keyword","vars"], ["text"," "], ["variable","names"], ["text",", "], ["variable","person"], ["text",", "], ["variable","i"], ["text",", "], ["variable","doubles"], ["text",", "], ["variable","lengths"], ["text",", "], ["variable","cubeRange"] ],[ "start", ["variable","names"], ["text"," = "], ["paren.lparen","["], ["string","\"Thorin\""], ["text",", "], ["string","\"Dwalin\""], ["text",", "], ["string","\"Balin\""], ["text",", "], ["string","\"Bifur\""], ["text",", "], ["string","\"Bofur\""], ["text",", "], ["string","\"Bombur\""], ["text",", "], ["string","\"Oin\""], ["text",","] ],[ "start", ["text"," "], ["string","\"Gloin\""], ["text",", "], ["string","\"Ori\""], ["text",", "], ["string","\"Nori\""], ["text",", "], ["string","\"Dori\""], ["text",", "], ["string","\"Fili\""], ["text",", "], ["string","\"Kili\""], ["text",", "], ["string","\"Bilbo\""], ["text",", "], ["string","\"Gandalf\""], ["paren.rparen","]"] ],[ "start" ],[ "start", ["keyword","for"], ["text"," "], ["variable","name"], ["text"," "], ["keyword","in"], ["text"," "], ["variable","names"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["string","\"Bilbo\""], ["text"," "], ["keyword.operator","&&"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["string","\"Gandalf\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["variable","person"], ["text"," = "], ["paren.lparen","{"], ["variable","name"], ["text",": "], ["string","\"Tim\""], ["text",", "], ["variable","age"], ["text",": "], ["constant.numeric","30"], ["paren.rparen","}"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","key"], ["text",", "], ["variable","value"], ["text"," "], ["keyword","in"], ["text"," "], ["variable","person"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","key"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\" = \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","value"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["variable","i"], ["text"," = "], ["constant.numeric","0"] ],[ "start", ["keyword","while"], ["text"," "], ["variable","i"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["constant.numeric","10"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","i"], ["text"," = "], ["variable","i"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","i"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["language.builtin","print"], ["paren.lparen","("], ["string","\"range\""], ["paren.rparen",")"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","i"], ["text"," "], ["keyword","in"], ["text"," "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","10"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","i"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","i"], ["text"," "], ["keyword","in"], ["text"," "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","10"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["constant.numeric","10"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["variable","i"], ["paren.rparen",")"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","-- Dynamic object that gives the first 10 doubles"] ],[ "start", ["variable","doubles"], ["text"," = "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.form","@len"], ["text",": "], ["paren.lparen","{"], ["text","| "], ["constant.numeric","10"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["storage.form","@get"], ["text",": "], ["paren.lparen","{"], ["variable","key"], ["text","|"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","key"], ["text"," "], ["keyword","is"], ["text"," "], ["storage.type","Integer"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["variable","key"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["variable","key"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["language.builtin","print"], ["paren.lparen","("], ["string","\"#doubles\""], ["text",", "], ["keyword.operator","#"], ["variable","doubles"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["language.builtin","print"], ["paren.lparen","("], ["string","\"Doubles\""], ["paren.rparen",")"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","k"], ["text",", "], ["variable","v"], ["text"," "], ["keyword","in"], ["text"," "], ["variable","doubles"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","(["], ["variable","k"], ["text",", "], ["variable","v"], ["paren.rparen","])"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","-- Dynamic object that has names list as keys and string lenth as values"] ],[ "start", ["variable","lengths"], ["text"," = "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.form","@keys"], ["text",": "], ["paren.lparen","{"], ["text","| "], ["variable","names"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["storage.form","@get"], ["text",": "], ["paren.lparen","{"], ["variable","key"], ["text","|"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","key"], ["text"," "], ["keyword","is"], ["text"," "], ["storage.type","String"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["keyword.operator","#"], ["variable","key"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["language.builtin","print"], ["text"," "], ["paren.lparen","("], ["string","\"Lengths\""], ["paren.rparen",")"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","k"], ["text",", "], ["variable","v"], ["text"," "], ["keyword","in"], ["text"," "], ["variable","lengths"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","(["], ["variable","k"], ["text",", "], ["variable","v"], ["paren.rparen","])"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start", ["variable","cubeRange"], ["text"," = "], ["paren.lparen","{"], ["variable","n"], ["text","|"] ],[ "start", ["text"," "], ["keyword","vars"], ["text"," "], ["variable","i"], ["text",", "], ["variable","v"] ],[ "start", ["text"," "], ["variable","i"], ["text"," = "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.form","@call"], ["text",": "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["variable","v"], ["text"," = "], ["variable","i"] ],[ "start", ["text"," "], ["variable","i"], ["text"," = "], ["variable","i"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","v"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["variable","n"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["variable","v"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["variable","v"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["variable","v"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["language.builtin","print"], ["paren.lparen","("], ["string","\"Cubes\""], ["paren.rparen",")"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","k"], ["text",", "], ["variable","v"], ["text"," "], ["keyword","in"], ["text"," "], ["variable","cubeRange"], ["paren.lparen","("], ["constant.numeric","5"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","(["], ["variable","k"], ["text",", "], ["variable","v"], ["paren.rparen","])"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["language.builtin","print"], ["paren.lparen","("], ["string","\"String\""], ["paren.rparen",")"] ],[ "start", ["keyword","for"], ["text"," "], ["variable","k"], ["text",", "], ["variable","v"], ["text"," "], ["keyword","in"], ["text"," "], ["string","\"Hello World\""], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","(["], ["variable","k"], ["text",", "], ["variable","v"], ["paren.rparen","])"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start", ["language.builtin","print"], ["paren.lparen","(["], ["variable","i"], ["text"," "], ["keyword","for"], ["text"," "], ["variable","i"], ["text"," "], ["keyword","in"], ["text"," "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","10"], ["paren.rparen",")])"] ],[ "start", ["language.builtin","print"], ["paren.lparen","(["], ["variable","i"], ["text"," "], ["keyword","for"], ["text"," "], ["variable","i"], ["text"," "], ["keyword","in"], ["text"," "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","20"], ["paren.rparen",")"], ["text"," "], ["keyword","if"], ["text"," "], ["variable","i"], ["text"," "], ["keyword.operator","%"], ["text"," "], ["constant.numeric","3"], ["paren.rparen","])"] ],[ "start" ],[ "start" ],[ "start" ],[ "start", ["comment","-- Example showing how to do parallel work using split..and"] ],[ "start", ["variable","base"], ["text"," = "], ["paren.lparen","{"], ["variable","bootstrap"], ["text",", "], ["variable","target-dir"], ["text","|"] ],[ "start", ["text"," "], ["keyword","split"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","copy"], ["paren.lparen","("], ["string","\"res\""], ["text",", "], ["variable","target-dir"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","and"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","newer"], ["paren.lparen","("], ["string","\"src/*.less\""], ["text",", "], ["variable","target-dir"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\"/style.css\""], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","lessc"], ["paren.lparen","("], ["string","\"src/\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","bootstrap"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\".less\""], ["text",", "], ["variable","target-dir"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\"/style.css\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","and"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","build"], ["paren.lparen","("], ["string","\"src/\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","bootstrap"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\".js\""], ["text",", "], ["variable","target-dir"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\"/app.js\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start", ["keyword","vars"], ["text"," "], ["variable","Dragon"], ["text",", "], ["variable","pet"] ],[ "start" ],[ "start", ["variable","Dragon"], ["text"," = "], ["paren.lparen","{"], ["variable","name"], ["text","|"] ],[ "start", ["text"," "], ["keyword","vars"], ["text"," "], ["variable","asleep"], ["text",", "], ["variable","stuff-in-belly"], ["text",", "], ["variable","stuff-in-intestine"], ["text",","] ],[ "start", ["text"," "], ["variable","feed"], ["text",", "], ["variable","walk"], ["text",", "], ["variable","put-to-bed"], ["text",", "], ["variable","toss"], ["text",", "], ["variable","rock"], ["text",","] ],[ "start", ["text"," "], ["variable","hungry?"], ["text",", "], ["variable","poopy?"], ["text",", "], ["variable","passage-of-time"] ],[ "start" ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","false"] ],[ "start", ["text"," "], ["variable","stuff-in-belly"], ["text"," = "], ["constant.numeric","10"], ["text"," "], ["comment","-- He's full."] ],[ "start", ["text"," "], ["variable","stuff-in-intestine"], ["text"," = "], ["constant.numeric","0"], ["text"," "], ["comment","-- He doesn't need to go."] ],[ "start" ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' is born.'"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["text"," "], ["variable","feed"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'You feed '"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","'.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable","stuff-in-belly"], ["text"," = "], ["constant.numeric","10"] ],[ "start", ["text"," "], ["variable","passage-of-time"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","walk"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'You walk '"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\".\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable","stuff-in-intestine"], ["text"," = "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["variable","passage-of-time"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","put-to-bed"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'You put '"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' to bed.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","true"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["variable","i"], ["text"," "], ["keyword","in"], ["text"," "], ["language.builtin","range"], ["paren.lparen","("], ["constant.numeric","3"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","passage-of-time"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' snores, filling the room with smoke.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","false"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' wakes up slowly.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","toss"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'You toss '"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' up into the air.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'He giggles, which singes your eyebrows.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable","passage-of-time"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","rock"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'You rock '"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' gently.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","true"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'He briefly dozes off...'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["variable","passage-of-time"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","false"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'...but wakes when you stop.'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","hungry?"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["variable","stuff-in-belly"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["constant.numeric","2"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","poopy?"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["variable","stuff-in-intestine"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","8"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["variable","passage-of-time"], ["text"," = "], ["paren.lparen","{"], ["text","|"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","stuff-in-belly"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","-- Move food from belly to intestine"] ],[ "start", ["text"," "], ["variable","stuff-in-belly"], ["text"," = "], ["variable","stuff-in-belly"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["variable","stuff-in-intestine"], ["text"," = "], ["variable","stuff-in-intestine"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","else"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["comment","-- Our dragon is starving!"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","false"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'He wakes up suddenly!'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' is starving! In desperation, he ate YOU!'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","abort"], ["text"," "], ["string","\"died\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","stuff-in-intestine"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","10"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","stuff-in-intestine"], ["text"," = "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'Whoops! '"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' had an accident...'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","hungry?"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","false"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'He wakes up suddenly!'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\"'s stomach grumbles...\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","poopy?"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","asleep"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","asleep"], ["text"," = "], ["constant.language.boolean","false"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["string","'He wakes up suddenly!'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["language.builtin","print"], ["paren.lparen","("], ["variable","name"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","' does the potty dance...'"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["comment","-- Export the public interface to this closure object."] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","feed"], ["text",": "], ["variable","feed"] ],[ "start", ["text"," "], ["variable","walk"], ["text",": "], ["variable","walk"] ],[ "start", ["text"," "], ["variable","put-to-bed"], ["text",": "], ["variable","put-to-bed"] ],[ "start", ["text"," "], ["variable","toss"], ["text",": "], ["variable","toss"] ],[ "start", ["text"," "], ["variable","rock"], ["text",": "], ["variable","rock"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["variable","pet"], ["text"," = "], ["variable","Dragon"], ["paren.lparen","("], ["string","'Norbert'"], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","feed"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","toss"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","walk"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","put-to-bed"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","rock"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","put-to-bed"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","put-to-bed"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","put-to-bed"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["variable","pet"], ["text","."], ["variable","put-to-bed"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_jade.json ================================================ [[ "start", ["keyword.other.doctype.jade","!!!doctype"] ],[ "start", ["keyword.other.doctype.jade","!!!5"] ],[ "start", ["keyword.other.doctype.jade","!!!"] ],[ "start" ],[ "start", ["keyword.control.import.include.jade","include"], ["text"," something"] ],[ "start" ],[ "start", ["keyword.control.import.include.jade"," include"], ["text"," another_thing"] ],[ "start" ],[ ["comment_block",2,"start"], ["comment"," // let's talk about it"] ],[ "start" ],[ ["comment_block",0,"start"], ["comment","// "] ],[ ["comment_block",0,"start"], ["comment"," here it is. a block comment!"] ],[ ["comment_block",0,"start"], ["comment"," and another row!"] ],[ "start", ["meta.tag.any.jade","but"], ["text"," not here."] ],[ "start" ],[ ["comment_block",5,"start"], ["comment"," // "] ],[ ["comment_block",5,"start"], ["comment"," a far spaced"] ],[ "start", ["text"," should be lack of block"] ],[ "start" ],[ ["comment_block",3,"start"], ["comment"," // also not a comment"] ],[ ["comment_block",3,"start"], ["comment"," div.attemptAtBlock"] ],[ "start", ["text"," "] ],[ "start", ["meta.tag.any.jade"," span"], ["entity.other.attribute-name.id.jade","#myName"] ],[ "start" ],[ "start", ["text"," "], ["string.interpolated.jade","#{implicit}"] ],[ "start", ["text"," "], ["string.interpolated.jade","!{more_explicit}"] ],[ "start" ],[ "start", ["text"," "], ["suport.type.attribute.id.jade","#idDiv"] ],[ "start" ],[ "start", ["text"," "], ["suport.type.attribute.class.jade",".idDiv"] ],[ "start" ],[ "start", ["meta.tag.any.jade"," test"], ["punctuation","("], ["entity.other.attribute-name.jade","id"], ["punctuation","="], ["string","\"tag\""], ["punctuation",")"] ],[ "start", ["meta.tag.any.jade"," header"], ["punctuation","("], ["entity.other.attribute-name.jade","id"], ["punctuation","="], ["string","\"tag\""], ["text",", "], ["entity.other.attribute-name.jade","blah"], ["punctuation","="], ["string","\"foo\""], ["text",", "], ["entity.other.attribute-name.jade","meh"], ["punctuation","="], ["string","\"aads\""], ["punctuation",")"] ],[ "start", ["storage.type.function.jade","mixin"], ["entity.name.function.jade"," article"], ["punctuation.definition.parameters.begin.jade","("], ["variable.parameter.function.jade","obj, parents"], ["punctuation.definition.parameters.end.jade",")"] ],[ "start" ],[ "start", ["storage.type.function.jade"," mixin"], ["entity.name.function.jade"," bleh"], ["punctuation.definition.parameters.begin.jade","("], ["punctuation.definition.parameters.end.jade",")"] ],[ "start" ],[ "start", ["storage.type.function.jade"," mixin"], ["entity.name.function.jade"," clever-name"] ],[ "start" ],[ "start", ["source.js.embedded.jade"," -"], ["storage.type","var"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"0\""], ["text",";"] ],[ "start", ["source.js.embedded.jade"," -"], ["text"," "], ["identifier","y"], ["text"," "], ["identifier","each"], ["text"," z"] ],[ "start" ],[ "start", ["source.js.embedded.jade"," -"], ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","items"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["string","\"one\""], ["punctuation.operator",","], ["text"," "], ["string","\"two\""], ["punctuation.operator",","], ["text"," "], ["string","\"three\""], ["text","]"] ],[ "start", ["meta.tag.any.jade"," each"], ["text"," item in items"] ],[ "start", ["meta.tag.any.jade"," li"], ["text","= item"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_java.json ================================================ [[ "start", ["keyword","public"], ["text"," "], ["keyword","class"], ["text"," "], ["identifier","InfiniteLoop"], ["text"," "], ["lparen","{"] ],[ "start" ],[ "comment", ["text"," "], ["comment","/*"] ],[ "comment", ["comment"," * This will cause the program to hang..."] ],[ "comment", ["comment"," *"] ],[ "comment", ["comment"," * Taken from:"] ],[ "comment", ["comment"," * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/"] ],[ "start", ["comment"," */"] ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["keyword","static"], ["text"," "], ["keyword","void"], ["text"," "], ["identifier","main"], ["lparen","("], ["support.function","String"], ["lparen","["], ["rparen","]"], ["text"," "], ["identifier","args"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","double"], ["text"," "], ["identifier","d"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","Double"], ["text","."], ["identifier","parseDouble"], ["lparen","("], ["string","\"2.2250738585072012e-308\""], ["rparen",")"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","// unreachable code"] ],[ "start", ["text"," "], ["support.function","System"], ["text","."], ["identifier","out"], ["text","."], ["identifier","println"], ["lparen","("], ["string","\"Value: \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","d"], ["rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_javascript.json ================================================ [[ "start", ["comment","//test: tokenize 'standard' functions"] ],[ "no_regex", ["identifier","string"], ["punctuation.operator","."], ["support.function","charCodeAt"], ["paren.lparen","("], ["constant.numeric","23"], ["paren.rparen",")"], ["punctuation.operator",";"], ["text"," "], ["variable.language","document"], ["punctuation.operator","."], ["support.function.dom","getElementById"], ["paren.lparen","("], ["string","'test'"], ["paren.rparen",")"], ["punctuation.operator",";"], ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","'Here it is'"], ["paren.rparen",")"], ["punctuation.operator",";"], ["string","\";"] ],[ "no_regex", ["identifier","test"], ["punctuation.operator",":"], ["text"," "], ["comment.doc","/**tokenize doc*/"], ["text"," "], ["identifier","comment"] ],[ "no_regex", ["comment.doc","/**tokenize doc comment with "], ["comment.doc.tag","@tag"], ["comment.doc"," {}*/"] ],[ "no_regex", ["comment","//test: tokenize parens"] ],[ "start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","$line$"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"[{( )}]\""], ["punctuation.operator",";"] ],[ "start", ["comment","//test tokenize arithmetic expression which looks like a regexp"] ],[ "no_regex", ["identifier","a"], ["keyword.operator","/"], ["identifier","b"], ["keyword.operator","/"], ["identifier","c"] ],[ "no_regex", ["identifier","a"], ["keyword.operator","/="], ["identifier","b"], ["keyword.operator","/"], ["identifier","c"] ],[ "no_regex", ["comment","//test tokenize reg exps"] ],[ "no_regex", ["identifier","a"], ["keyword.operator","="], ["string.regexp","/b/g"] ],[ "no_regex", ["identifier","a"], ["keyword.operator","+"], ["string.regexp","/b/g"] ],[ "no_regex", ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string.regexp","/2 "], ["constant.language.escape","+"], ["string.regexp"," 1/gimyx"], ["identifier","k"] ],[ "no_regex", ["identifier","a"], ["keyword.operator","="], ["string.regexp","/a/"], ["text"," "], ["keyword.operator","/"], ["text"," "], ["string.regexp","/a/"] ],[ "no_regex", ["keyword","case"], ["text"," "], ["string.regexp","/a/"], ["punctuation.operator","."], ["support.function","test"], ["paren.lparen","("], ["identifier","c"], ["paren.rparen",")"] ],[ "no_regex", ["comment","//test tokenize multi-line comment containing a single line comment"] ],[ "no_regex", ["identifier","noRegex"] ],[ "no_regex", ["comment","/* foo // bar */"] ],[ "start", ["identifier","canBeRegex"], ["punctuation.operator",";"] ],[ "start", ["comment","/* foo // bar */"] ],[ "start", ["comment","// test tokenize identifier with umlauts"] ],[ "no_regex", ["identifier","fu"], ["punctuation.operator","?"], ["identifier","e"] ],[ "no_regex", ["comment","// test // is not a regexp"] ],[ "start", ["paren.lparen","{"], ["text"," "], ["comment","// 123"] ],[ "start", ["comment","//test skipping escaped chars"] ],[ "no_regex", ["string","'Meh"], ["constant.language.escape","\\\\"], ["string","nNeh'"] ],[ "no_regex", ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","'"], ["constant.language.escape","\\\\"], ["string","u1232Feh'"] ],[ "qqstring", ["string","\"test multiline\\"] ],[ "no_regex", ["string"," strings\""] ],[ "no_regex", ["identifier","a"], ["keyword.operator","="], ["text","'"] ],[ "qqstring", ["identifier","b"], ["keyword.operator","="], ["string","\"\\"] ],[ "no_regex", ["string","still a string"] ],[ "no_regex", ["text"," "] ],[ "no_regex", ["text"," "] ],[ "start", ["storage.type","function"], ["text"," "], ["entity.name.function","foo"], ["paren.lparen","("], ["variable.parameter","items"], ["punctuation.operator",", "], ["variable.parameter","nada"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["storage.type","var"], ["text"," "], ["identifier","i"], ["keyword.operator","="], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["identifier","i"], ["keyword.operator","<"], ["identifier","items"], ["punctuation.operator","."], ["support.constant","length"], ["punctuation.operator",";"], ["text"," "], ["identifier","i"], ["keyword.operator","++"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["identifier","items"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\"juhu"], ["constant.language.escape","\\n"], ["string","\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"], ["text","\t"], ["comment","// Real Tab."] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "no_regex", ["identifier","regexp"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.regexp","/p"], ["constant.language.delimiter","|"], ["string.regexp","p/"], ["text"," "], ["comment","// ends here"] ],[ "no_regex" ],[ "no_regex", ["identifier","r"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.regexp","/d"], ["constant.language.escape","{1,2}?"], ["string.regexp","f{e}"], ["invalid","++"], ["string.regexp","r"], ["constant.language.escape","*?"], ["regexp.keyword.operator","\\d"], ["constant.language.escape","+?[]"], ["string.regexp","r"], ["constant.language.escape","[^"], ["string.regexp.charachterclass","r"], ["constant.language.escape","-"], ["string.regexp.charachterclass","o"], ["regexp.charclass.keyword.operator","\\f\\f"], ["string.regexp.charachterclass","["], ["regexp.charclass.keyword.operator","\\f"], ["constant.language.escape","]?"], ["string.regexp","r"], ["invalid","{7}+"], ["string.regexp","r"], ["regexp.keyword.operator","\\{"], ["string.regexp","7}"], ["constant.language.escape","+"], ["string.regexp","rr--rr"], ["constant.language.escape","$^(?:"], ["string.regexp","d"], ["constant.language.delimiter","|"], ["string.regexp","s"], ["constant.language.escape",")(?="], ["string.regexp","a"], ["constant.language.delimiter","|"], ["constant.language.escape",")(?!"], ["string.regexp","y"], ["constant.language.escape",")[]"], ["constant.language.delimiter","|"], ["invalid","$?"], ["constant.language.delimiter","|"], ["invalid","^*"], ["string.regexp","/"], ["text"," "], ["identifier","o"] ],[ "no_regex", ["identifier","a"], ["keyword.operator","="], ["string.regexp","/a/"], ["text"," "], ["identifier","jk"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.regexp","/ /"], ["text"," "], ["keyword.operator","/"], ["text"," "], ["string.regexp","/ /"] ],[ "no_regex", ["text"," "], ["comment.doc","/************************************/"] ],[ "no_regex", ["comment.doc","/** total mess, tricky to highlight**/"] ],[ "no_regex" ],[ "start", ["storage.type","function"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "doc-start", ["text","\t"], ["comment.doc","/**"] ],[ "doc-start", ["comment.doc","\t * docComment"] ],[ "no_regex", ["comment.doc","\t **/"] ],[ "no_regex", ["text","\t"], ["identifier","r"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.regexp","/u"], ["regexp.keyword.operator","\\t"], ["constant.language.escape","*"], ["string.regexp","/"] ],[ "no_regex", ["text","\t"], ["identifier","g"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1.00"], ["identifier","E"], ["keyword.operator","^"], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["identifier","y"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1.2"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1."], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric",".2"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","052"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","0O7"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","0x25"] ],[ "no_regex", ["text","\t"], ["identifier","t"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["string","'d'"], ["punctuation.operator",","], ["text"," "], ["string","''"], ["paren.rparen","]"] ],[ "no_regex", ["paren.rparen","}"] ],[ "start", ["storage.type","function"], ["text"," "], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["comment","/* eee */"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "qqstring", ["string","\"s\\"] ],[ "no_regex", ["string","s"], ["constant.language.escape","\\u7824"], ["string","sss"], ["constant.language.escape","\\u"], ["string","1\""] ],[ "no_regex" ],[ "qstring", ["string","'\\"] ],[ "no_regex", ["string","string'"] ],[ "no_regex" ],[ "no_regex", ["text","'"] ],[ "no_regex", ["identifier","string"], ["text","'"] ],[ "no_regex" ],[ "no_regex", ["string","\"trailing space"], ["constant.language.escape","\\ "], ["string"," "] ],[ "no_regex", ["string","\" \""], ["text"," "], ["keyword.operator","/"], ["identifier","not"], ["text"," "], ["identifier","a"], ["text"," "], ["identifier","regexp"], ["keyword.operator","/"], ["identifier","g"] ],[ "no_regex" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc"," *doc"] ],[ "no_regex", ["comment.doc"," */"] ],[ "no_regex" ],[ "start", ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["string","'a'"], ["punctuation.operator",":"], ["text"," "], ["identifier","b"], ["punctuation.operator",","] ],[ "no_regex", ["text","\t"], ["string","'g'"], ["text",":"], ["text"," "], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","t"], ["paren.rparen",")"] ],[ "no_regex", ["text","\t"], ["entity.name.function","gta"], ["punctuation.operator",":"], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",","], ["variable.parameter","b"], ["paren.rparen",")"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "no_regex", ["identifier","z"], ["keyword.operator",">>="], ["identifier","t"], ["keyword.operator","<<"], ["identifier","f"], ["keyword.operator",">>"], ["identifier","r"], ["keyword.operator",">>>"], ["identifier","s"], ["keyword.operator",">="], ["constant.numeric","0b1"] ],[ "no_regex" ],[ "function_arguments", ["identifier","foo"], ["punctuation.operator","."], ["storage.type","protoype"], ["punctuation.operator","."], ["entity.name.function","d"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",", "], ["variable.parameter","b"], ["punctuation.operator",","] ],[ "no_regex", ["punctuation.operator"," "], ["variable.parameter","c"], ["punctuation.operator",", "], ["variable.parameter","d"], ["paren.rparen",")"] ],[ "no_regex", ["storage.type","foo"], ["punctuation.operator","."], ["entity.name.function","d"], ["text"," "], ["keyword.operator","="], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",", "], ["variable.parameter","b"], ["paren.rparen",")"] ],[ "no_regex", ["storage.type","foo"], ["punctuation.operator","."], ["entity.name.function","d"], ["text"," "], ["keyword.operator","="], ["storage.type","function"], ["paren.lparen","("], ["variable.parameter","a"], ["punctuation.operator",", "], ["comment.doc","/*****/"], ["text"," "], ["identifier","d"], ["string","\"string\""], ["text"," "] ],[ "no_regex" ],[ "no_regex", ["keyword.operator","<"], ["identifier","div"] ],[ ["start","jsxAttributes","jsxAttributes","jsx",1], ["identifier","z"], ["keyword.operator","="], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["paren.quasi.start","{"], ["keyword.operator","..."], ["variable.language","this"], ["punctuation.operator","."], ["identifier","props"], ["paren.quasi.end","}"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","x"], ["keyword.operator.attribute-equals.xml","="], ["paren.quasi.start","{"], ["constant.numeric","1"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","2"], ["paren.quasi.end","}"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","y"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"z{a}b"], ["constant.language.escape.reference.xml","&"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","t"], ["keyword.operator.attribute-equals.xml","="], ["paren.quasi.start","{"] ],[ ["start","jsxAttributes","jsxAttributes","jsx",1], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.xml",">"], ["paren.quasi.start","{"], ["constant.numeric","2"], ["paren.quasi.end","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ ["jsx",1], ["text"," "], ["paren.quasi.end","}"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ ["jsx",1], ["string","1 "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","a"], ["meta.tag.punctuation.tag-close.xml",">"], ["string"," "], ["paren.quasi.start","{"], ["text"," "], ["keyword.operator","++"], ["identifier","x"], ["text"," "], ["paren.quasi.end","}"], ["string"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["storage.type","var"], ["text"," "], ["identifier","o"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"] ],[ ["start","no_regex","start","string.quasi.start","string.quasi.start","no_regex"], ["text"," "], ["identifier","t"], ["punctuation.operator",":"], ["string.quasi.start","`"], ["paren.quasi.start","${"], ["paren.lparen","["], ["paren.rparen","]"], ["punctuation.operator","."], ["identifier","map"], ["paren.lparen","("], ["identifier","x"], ["text"," "], ["storage.type","=>"], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","no_regex","start","no_regex","start","string.quasi.start","string.quasi.start","no_regex"], ["text"," "], ["keyword","return"], ["text"," "], ["identifier","x"] ],[ "no_regex", ["text"," "], ["paren.rparen","})"], ["paren.quasi.end","}"], ["string.quasi.end","`"] ],[ "start", ["paren.rparen","}"], ["punctuation.operator",";"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_json.json ================================================ [[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"query\""], ["text",": "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"count\""], ["text",": "], ["constant.numeric","10"], ["text",","] ],[ "start", ["text"," "], ["variable","\"created\""], ["text",": "], ["string","\"2011-06-21T08:10:46Z\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"lang\""], ["text",": "], ["string","\"en-US\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"results\""], ["text",": "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"photo\""], ["text",": "], ["paren.lparen","["] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"6\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5855620975\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"f1f5e8515d\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"5110\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"7087 bandit cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"4\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856170534\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"ff1efb2a6f\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"3217\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"6975 rusty cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"6\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856172972\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"51249875@N03\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"6c6887347c\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"5192\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"watermarked-cats\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"6\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856168328\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"0c1cfdf64c\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"5078\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"7020 mandy cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"], ["text",","] ],[ "start", ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","\"farm\""], ["text",": "], ["string","\"3\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"id\""], ["text",": "], ["string","\"5856171774\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfamily\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"isfriend\""], ["text",": "], ["string","\"0\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"ispublic\""], ["text",": "], ["string","\"1\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"owner\""], ["text",": "], ["string","\"32021554@N04\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"secret\""], ["text",": "], ["string","\"7f5a3180ab\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"server\""], ["text",": "], ["string","\"2696\""], ["text",","] ],[ "start", ["text"," "], ["variable","\"title\""], ["text",": "], ["string","\"7448 bobby cat\""] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","]"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_jsoniq.json ================================================ [[ "[\"start\"]", ["support.function","TODO"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_jsp.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "js-start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "js-start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"abc\""], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["storage.type","function"], ["text"," "], ["identifier","y"], ["text"," "], ["paren.lparen","{"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "css-start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "css-ruleset", ["text"," "], ["variable",".class"], ["text"," "], ["paren.lparen","{"] ],[ "css-ruleset", ["text"," "], ["support.type","background"], ["text",": "], ["constant.numeric","#124356"], ["text",";"] ],[ "css-start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," Today's date: "], ["meta.tag","<%"], ["keyword.operator","="], ["text"," "], ["lparen","("], ["keyword","new"], ["text"," "], ["identifier","java"], ["text","."], ["identifier","util"], ["text","."], ["identifier","Date"], ["lparen","("], ["rparen","))"], ["text","."], ["identifier","toLocaleString"], ["lparen","("], ["rparen",")"], ["meta.tag","%>"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag","<%"], ["keyword.operator","!"], ["text"," "], ["keyword","int"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["text","; "], ["meta.tag","%>"] ],[ "jsp-start", ["text.xml"," "], ["meta.tag",""] ],[ "jsp-start", ["text"," "], ["keyword","int"], ["text"," "], ["identifier","j"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["text",";"] ],[ "start", ["text"," "], ["meta.tag",""] ],[ "start" ],[ "start", ["text.xml"," "], ["comment","<%-- This is JSP comment --%>"] ],[ "start", ["text.xml"," "], ["meta.tag","<%@"], ["text"," "], ["identifier","directive"], ["text"," "], ["identifier","attribute"], ["keyword.operator","="], ["string","\"value\""], ["text"," "], ["meta.tag","%>"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Select Languages:"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","form"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","ACTION"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"jspCheckBox.jsp\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","input"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"checkbox\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","name"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"id\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Java\""], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," Java"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","BR"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","input"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"checkbox\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","name"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"id\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\".NET\""], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," .NET"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","BR"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","input"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"checkbox\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","name"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"id\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"PHP\""], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," PHP"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","BR"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","input"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"checkbox\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","name"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"id\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"C/C++\""], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," C/C++"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","BR"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","input"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"checkbox\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","name"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"id\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"PERL\""], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," PERL "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","BR"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.form.tag-name.xml","input"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"submit\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","value"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Submit\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "jsp-start", ["text.xml"," "], ["meta.tag","<%"] ],[ "jsp-start", ["text"," "], ["support.function","String"], ["text"," "], ["identifier","select"], ["lparen","["], ["rparen","]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.language","request"], ["text","."], ["identifier","getParameterValues"], ["lparen","("], ["string","\"id\""], ["rparen",")"], ["text","; "] ],[ "jsp-start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","select"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["constant.language","null"], ["text"," "], ["keyword.operator","&&"], ["text"," "], ["identifier","select"], ["text","."], ["identifier","length"], ["text"," "], ["keyword.operator","!="], ["text"," "], ["constant.numeric","0"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "jsp-start", ["text"," "], ["variable.language","out"], ["text","."], ["identifier","println"], ["lparen","("], ["string","\"You have selected: \""], ["rparen",")"], ["text",";"] ],[ "jsp-start", ["text"," "], ["keyword","for"], ["text"," "], ["lparen","("], ["keyword","int"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["text","; "], ["identifier","i"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["identifier","select"], ["text","."], ["identifier","length"], ["text","; "], ["identifier","i"], ["keyword.operator","++"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "jsp-start", ["text"," "], ["variable.language","out"], ["text","."], ["identifier","println"], ["lparen","("], ["identifier","select"], ["lparen","["], ["identifier","i"], ["rparen","])"], ["text","; "] ],[ "jsp-start", ["text"," "], ["rparen","}"] ],[ "jsp-start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["meta.tag","%>"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_jsx.json ================================================ [[ "comment", ["comment","/*EXPECTED"] ],[ "comment", ["comment","hello world!"] ],[ "start", ["comment","*/"] ],[ "start", ["keyword","class"], ["text"," "], ["language.support.class","Test"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","static"], ["text"," "], ["storage.type","function"], ["text"," "], ["entity.name.function","run"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["punctuation.operator",":"], ["text"," "], ["keyword","void"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","// console.log(\"hello world!\");"] ],[ "start", ["text"," "], ["keyword","log"], ["text"," "], ["string","\"hello world!\""], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_julia.json ================================================ [[ "start", ["keyword.control.julia","for"], ["text"," op "], ["keyword.operator.update.julia","="], ["text"," ("], ["keyword.operator.ternary.julia",":"], ["keyword.operator.arithmetic.julia","+"], ["text",", "], ["keyword.operator.ternary.julia",":"], ["keyword.operator.arithmetic.julia","*"], ["text",", "], ["keyword.operator.ternary.julia",":"], ["keyword.operator.bitwise.julia","&"], ["text",", "], ["keyword.operator.ternary.julia",":"], ["keyword.operator.bitwise.julia","|"], ["text",", "], ["keyword.operator.ternary.julia",":"], ["keyword.operator.interpolation.julia","$"], ["text",")"] ],[ "start", ["text"," "], ["variable.macro.julia","@eval"], ["text"," ("], ["keyword.operator.interpolation.julia","$"], ["text","op)(a,b,c) "], ["keyword.operator.update.julia","="], ["text"," ("], ["keyword.operator.interpolation.julia","$"], ["text","op)(("], ["keyword.operator.interpolation.julia","$"], ["text","op)(a,b),c)"] ],[ "start", ["keyword.control.julia","end"] ],[ "start" ],[ "start", ["text","v "], ["keyword.operator.update.julia","="], ["text"," "], ["variable","α"], ["keyword.operator.transposed-variable.julia","'"], ["text",";"] ],[ "start", ["keyword.other.julia","function"], ["meta.function.julia"," "], ["entity.name.function.julia","g"], ["text","("], ["text","x,y)"] ],[ "start", ["text"," "], ["keyword.control.julia","return"], ["text"," x "], ["keyword.operator.arithmetic.julia","*"], ["text"," y"] ],[ "start", ["text"," x "], ["keyword.operator.arithmetic.julia","+"], ["text"," y"] ],[ "start", ["keyword.control.julia","end"] ],[ "start" ],[ "start", ["support.function.julia","cd"], ["text","("], ["punctuation.definition.string.begin.julia","\""], ["string.quoted.double.julia","data"], ["punctuation.definition.string.end.julia","\""], ["text",") "], ["keyword.control.julia","do"] ],[ "start", ["text"," "], ["support.function.julia","open"], ["text","("], ["punctuation.definition.string.begin.julia","\""], ["string.quoted.double.julia","outfile"], ["punctuation.definition.string.end.julia","\""], ["text",", "], ["punctuation.definition.string.begin.julia","\""], ["string.quoted.double.julia","w"], ["punctuation.definition.string.end.julia","\""], ["text",") "], ["keyword.control.julia","do"], ["text"," f"] ],[ "start", ["text"," "], ["support.function.julia","write"], ["text","("], ["text","f, data)"] ],[ "start", ["text"," "], ["keyword.control.julia","end"] ],[ "start", ["keyword.control.julia","end"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_latex.json ================================================ [[ "start", ["keyword","\\usepackage"], ["lparen","{"], ["storage.type","amsmath"], ["rparen","}"] ],[ "start", ["storage.type","\\title"], ["lparen","{"], ["storage.type","\\LaTeX"], ["rparen","}"] ],[ "start", ["storage.type","\\date"], ["lparen","{"], ["rparen","}"] ],[ "start", ["storage.type","\\begin"], ["lparen","{"], ["variable.parameter","document"], ["rparen","}"] ],[ "start", ["text"," "], ["storage.type","\\maketitle"] ],[ "start", ["text"," "], ["storage.type","\\LaTeX"], ["lparen","{"], ["rparen","}"], ["text"," is a document preparation system for the "], ["storage.type","\\TeX"], ["lparen","{"], ["rparen","}"] ],[ "start", ["text"," typesetting program. It offers programmable desktop publishing"] ],[ "start", ["text"," features and extensive facilities for automating most aspects of"] ],[ "start", ["text"," typesetting and desktop publishing, including numbering and"] ],[ "start", ["text"," cross-referencing, tables and figures, page layout, bibliographies,"] ],[ "start", ["text"," and much more. "], ["storage.type","\\LaTeX"], ["lparen","{"], ["rparen","}"], ["text"," was originally written in 1984 by Leslie"] ],[ "start", ["text"," Lamport and has become the dominant method for using "], ["storage.type","\\TeX"], ["text","; few"] ],[ "start", ["text"," people write in plain "], ["storage.type","\\TeX"], ["lparen","{"], ["rparen","}"], ["text"," anymore. The current version is"] ],[ "start", ["text"," "], ["storage.type","\\LaTeXe"], ["text","."] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["comment","% This is a comment; it will not be shown in the final output."] ],[ "start", ["text"," "], ["comment","% The following shows a little of the typesetting power of LaTeX:"] ],[ "start", ["text"," "], ["storage.type","\\begin"], ["lparen","{"], ["variable.parameter","align"], ["rparen","}"] ],[ "start", ["text"," E &= mc^2 "], ["constant.character.escape","\\\\"] ],[ "start", ["text"," m &= "], ["storage.type","\\frac"], ["lparen","{"], ["text","m_0"], ["rparen","}"], ["lparen","{"], ["storage.type","\\sqrt"], ["lparen","{"], ["text","1-"], ["storage.type","\\frac"], ["lparen","{"], ["text","v^2"], ["rparen","}"], ["lparen","{"], ["text","c^2"], ["rparen","}}}"] ],[ "start", ["text"," "], ["storage.type","\\end"], ["lparen","{"], ["variable.parameter","align"], ["rparen","}"] ],[ "start", ["storage.type","\\end"], ["lparen","{"], ["variable.parameter","document"], ["rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_less.json ================================================ [[ "start", ["comment","/* styles.less */"] ],[ "start" ],[ "start", ["variable","@base"], ["text",": "], ["constant.numeric","#f938ab"], ["text",";"] ],[ "start" ],[ "start", ["variable.language",".box-shadow"], ["paren.lparen","("], ["variable","@style"], ["text",", "], ["variable","@c"], ["paren.rparen",")"], ["text"," "], ["keyword","when"], ["text"," "], ["paren.lparen","("], ["support.function","iscolor"], ["paren.lparen","("], ["variable","@c"], ["paren.rparen","))"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.type.property","box-shadow"], ["text",":"], ["text"," "], ["variable","@style"], ["text"," "], ["variable","@c"], ["text",";"] ],[ "start", ["text"," "], ["support.type.unknownProperty","-webkit-box-shadow"], ["text",":"], ["text"," "], ["variable","@style"], ["text"," "], ["variable","@c"], ["text",";"] ],[ "start", ["text"," "], ["support.type.unknownProperty","-moz-box-shadow"], ["text",":"], ["text"," "], ["variable","@style"], ["text"," "], ["variable","@c"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["variable.language",".box-shadow"], ["paren.lparen","("], ["variable","@style"], ["text",", "], ["variable","@alpha"], ["text",": "], ["constant.numeric","50"], ["keyword","%"], ["paren.rparen",")"], ["text"," "], ["keyword","when"], ["text"," "], ["paren.lparen","("], ["support.function","isnumber"], ["paren.lparen","("], ["variable","@alpha"], ["paren.rparen","))"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.language",".box-shadow"], ["paren.lparen","("], ["variable","@style"], ["text",", "], ["support.function","rgba"], ["paren.lparen","("], ["constant.numeric","0"], ["text",", "], ["constant.numeric","0"], ["text",", "], ["constant.numeric","0"], ["text",", "], ["variable","@alpha"], ["paren.rparen","))"], ["text",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["comment","// Box styles"] ],[ "start", ["variable.language",".box"], ["text"," "], ["paren.lparen","{"], ["text"," "] ],[ "start", ["text"," "], ["support.type.property","color"], ["text",":"], ["text"," "], ["support.function","saturate"], ["paren.lparen","("], ["variable","@base"], ["text",", "], ["constant.numeric","5"], ["keyword","%"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["support.type.property","border-color"], ["text",":"], ["text"," "], ["support.function","lighten"], ["paren.lparen","("], ["variable","@base"], ["text",", "], ["constant.numeric","30"], ["keyword","%"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["identifier","div"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["variable.language",".box-shadow"], ["paren.lparen","("], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","5"], ["keyword","px"], ["text",", "], ["constant.numeric","30"], ["keyword","%"], ["paren.rparen",")"], ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["identifier","a"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.type.property","color"], ["text",":"], ["text"," "], ["variable","@base"], ["text",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","&"], ["variable.language",":hover"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.type.property","color"], ["text",":"], ["text"," "], ["support.function","lighten"], ["paren.lparen","("], ["variable","@base"], ["text",", "], ["constant.numeric","50"], ["keyword","%"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_liquid.json ================================================ [[ "start", ["text.xml","The following examples can be found in full at http://liquidmarkup.org/"] ],[ "start" ],[ "start", ["text.xml","Liquid is an extraction from the e-commerce system Shopify."] ],[ "start", ["text.xml","Shopify powers many thousands of e-commerce stores which all call for unique designs."] ],[ "start", ["text.xml","For this we developed Liquid which allows our customers complete design freedom while"] ],[ "start", ["text.xml","maintaining the integrity of our servers."] ],[ "start" ],[ "start", ["text.xml","Liquid has been in production use since June 2006 and is now used by many other"] ],[ "start", ["text.xml","hosted web applications."] ],[ "start" ],[ "start", ["text.xml","It was developed for usage in Ruby on Rails web applications and integrates seamlessly"] ],[ "start", ["text.xml","as a plugin but it also works excellently as a stand alone library."] ],[ "start" ],[ "start", ["text.xml","Here's what it looks like:"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"products\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","for"], ["text"," "], ["identifier","product"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","products"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["variable","{{"], ["text"," "], ["identifier","product"], ["text","."], ["identifier","title"], ["text"," "], ["variable","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," Only "], ["variable","{{"], ["text"," "], ["identifier","product"], ["text","."], ["identifier","price"], ["text"," | "], ["identifier","format_as_money"], ["text"," "], ["variable","}}"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["variable","{{"], ["text"," "], ["identifier","product"], ["text","."], ["identifier","description"], ["text"," | "], ["identifier","prettyprint"], ["text"," | "], ["support.function","truncate"], ["text",": "], ["constant.numeric","200"], ["text"," "], ["variable","}}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","endfor"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start" ],[ "start", ["text.xml","Some more features include:"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Filters"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," The word \"tobi\" in uppercase: "], ["variable","{{"], ["text"," "], ["string","'tobi'"], ["text"," | "], ["support.function","upcase"], ["text"," "], ["variable","}}"], ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","The word \"tobi\" has "], ["variable","{{"], ["text"," "], ["string","'tobi'"], ["text"," | "], ["support.function","size"], ["text"," "], ["variable","}}"], ["text.xml"," letters! "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Change \"Hello world\" to \"Hi world\": "], ["variable","{{"], ["text"," "], ["string","'Hello world'"], ["text"," | "], ["support.function","replace"], ["text",": "], ["string","'Hello'"], ["text",", "], ["string","'Hi'"], ["text"," "], ["variable","}}"], ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","The date today is "], ["variable","{{"], ["text"," "], ["string","'now'"], ["text"," | "], ["support.function","date"], ["text",": "], ["string","\"%Y %b %d\""], ["text"," "], ["variable","}}"], ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","If"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","if"], ["text"," "], ["identifier","user"], ["text","."], ["identifier","name"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","'tobi'"], ["text"," "], ["identifier","or"], ["text"," "], ["identifier","user"], ["text","."], ["identifier","name"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["string","'marc'"], ["text"," "], ["variable","%}"], ["text.xml"," "] ],[ "start", ["text.xml"," hi marc or tobi"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","endif"], ["text"," "], ["variable","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Case"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","case"], ["text"," "], ["identifier","template"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","when"], ["text"," "], ["string","'index'"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," Welcome"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","when"], ["text"," "], ["string","'product'"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["variable","{{"], ["text"," "], ["identifier","product"], ["text","."], ["identifier","vendor"], ["text"," | "], ["identifier","link_to_vendor"], ["text"," "], ["variable","}}"], ["text.xml"," / "], ["variable","{{"], ["text"," "], ["identifier","product"], ["text","."], ["identifier","title"], ["text"," "], ["variable","}}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","else"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["variable","{{"], ["text"," "], ["identifier","page_title"], ["text"," "], ["variable","}}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","endcase"], ["text"," "], ["variable","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","For Loops"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","for"], ["text"," "], ["identifier","item"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","array"], ["text"," "], ["variable","%}"], ["text.xml"," "] ],[ "start", ["text.xml"," "], ["variable","{{"], ["text"," "], ["identifier","item"], ["text"," "], ["variable","}}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","endfor"], ["text"," "], ["variable","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Tables"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","tablerow"], ["text"," "], ["identifier","item"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","items"], ["text"," "], ["identifier","cols"], ["text",": "], ["constant.numeric","3"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","if"], ["text"," "], ["variable.language","tablerowloop"], ["text","."], ["identifier","col_first"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," First column: "], ["variable","{{"], ["text"," "], ["identifier","item"], ["text","."], ["identifier","variable"], ["text"," "], ["variable","}}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","else"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," Different column: "], ["variable","{{"], ["text"," "], ["identifier","item"], ["text","."], ["identifier","variable"], ["text"," "], ["variable","}}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","endif"], ["text"," "], ["variable","%}"] ],[ "start", ["text.xml"," "], ["variable","{%"], ["text"," "], ["keyword","endtablerow"], ["text"," "], ["variable","%}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_lisp.json ================================================ [[ "start", ["text","("], ["storage.type.function-type.lisp","defun"], ["text"," "], ["entity.name.function.lisp","prompt-for-cd"], ["text"," ()"] ],[ "start", ["text"," "], ["string","\"Prompts"] ],[ "start", ["text"," "], ["identifier","for"], ["text"," "], ["identifier","CD"], ["text","\""] ],[ "start", ["text"," ("], ["identifier","prompt"], ["text","-"], ["identifier","read"], ["text"," "], ["string","\"Title\""], ["text"," "], ["constant.numeric","1.53"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text","/"], ["constant.numeric","4"], ["text"," "], ["constant.numeric","1.7"], ["text"," "], ["constant.numeric","1.7e0"], ["text"," "], ["constant.numeric","2.9E-4"], ["text"," "], ["constant.numeric","+42"], ["text"," "], ["constant.numeric","-7"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","b001"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","b001/100"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","o777"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","O777"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","xabc55"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","c"], ["text","("], ["constant.numeric","0"], ["text"," "], ["constant.numeric","-5.6"], ["text","))"] ],[ "start", ["text"," ("], ["identifier","prompt"], ["text","-"], ["identifier","read"], ["text"," "], ["string","\"Artist\""], ["text"," &"], ["identifier","rest"], ["text",")"] ],[ "start", ["text"," ("], ["keyword.operator","or"], ["text"," ("], ["identifier","parse"], ["text","-"], ["identifier","integer"], ["text"," ("], ["identifier","prompt"], ["text","-"], ["identifier","read"], ["text"," "], ["string","\"Rating\""], ["text",") :"], ["identifier","junk"], ["text","-"], ["identifier","allowed"], ["text"," "], ["support.function","t"], ["text",") "], ["constant.numeric","0"], ["text",")"] ],[ "start", ["text"," ("], ["keyword.control","if"], ["text"," "], ["identifier","x"], ["text"," ("], ["support.function","format"], ["text"," "], ["support.function","t"], ["text"," "], ["string","\"yes\""], ["text",") ("], ["support.function","format"], ["text"," "], ["support.function","t"], ["text"," "], ["string","\"no\""], ["text"," "], ["constant.language","nil"], ["text",") "], ["comment",";and here comment"] ],[ "start", ["text"," ) "], ["constant.numeric","0xFFLL"], ["text"," "], ["constant.numeric","-23ull"] ],[ "start", ["text"," "], ["comment",";; second line comment"] ],[ "start", ["text"," '(+ "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text",")"] ],[ "start", ["text"," ("], ["identifier","defvar"], ["text"," "], ["punctuation.definition.variable.lisp","*"], ["variable.other.global.lisp","lines"], ["punctuation.definition.variable.lisp","*"], ["text",") "], ["comment","; list of all lines"] ],[ "start", ["text"," ("], ["identifier","position"], ["text","-"], ["keyword.control","if"], ["text","-"], ["identifier","not"], ["text"," "], ["punctuation.definition.constant.character.lisp","#"], ["constant.character.lisp","'sys::whitespacep"], ["text"," "], ["identifier","line"], ["text"," :"], ["identifier","start"], ["text"," "], ["identifier","beg"], ["text","))"] ],[ "start", ["text"," ("], ["support.function","quote"], ["text"," ("], ["identifier","privet"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["constant.numeric","3"], ["text","))"] ],[ "start", ["text"," '("], ["identifier","hello"], ["text"," "], ["identifier","world"], ["text",")"] ],[ "start", ["text"," (* "], ["constant.numeric","5"], ["text"," "], ["constant.numeric","7"], ["text",")"] ],[ "start", ["text"," ("], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["constant.numeric","34"], ["text"," "], ["constant.numeric","5"], ["text",")"] ],[ "start", ["text"," (:"], ["identifier","use"], ["text"," "], ["string","\"aaaa\""], ["text",")"] ],[ "start", ["text"," ("], ["keyword.control","let"], ["text"," (("], ["identifier","x"], ["text"," "], ["constant.numeric","10"], ["text",") ("], ["identifier","y"], ["text"," "], ["constant.numeric","20"], ["text","))"] ],[ "start", ["text"," ("], ["identifier","print"], ["text"," (+ "], ["identifier","x"], ["text"," "], ["identifier","y"], ["text","))"] ],[ "start", ["text"," ) "], ["support.function","LAmbDa"] ],[ "start" ],[ "start", ["text"," "], ["string","\"asdad"], ["constant.character.escape.lisp","\\0"], ["string","eqweqe\""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_livescript.json ================================================ [[ "start", ["comment","# comment"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_logiql.json ================================================ [[ "start", ["comment.single","// ancestors"] ],[ "start", ["entity.name","parentof"], ["text","("], ["string","\"douglas\""], ["keyword.other",","], ["text"," "], ["string","\"john\""], ["text",")"], ["keyword.end","."] ],[ "start", ["entity.name","parentof"], ["text","("], ["string","\"john\""], ["keyword.other",","], ["text"," "], ["string","\"bob\""], ["text",")"], ["keyword.end","."] ],[ "start", ["entity.name","parentof"], ["text","("], ["string","\"bob\""], ["keyword.other",","], ["text"," "], ["string","\"ebbon\""], ["text",")"], ["keyword.end","."] ],[ "start" ],[ "start", ["entity.name","parentof"], ["text","("], ["string","\"douglas\""], ["keyword.other",","], ["text"," "], ["string","\"jane\""], ["text",")"], ["keyword.end","."] ],[ "start", ["entity.name","parentof"], ["text","("], ["string","\"jane\""], ["keyword.other",","], ["text"," "], ["string","\"jan\""], ["text",")"], ["keyword.end","."] ],[ "start" ],[ "start", ["entity.name","ancestorof"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","B"], ["text",") "], ["keyword.start","<-"], ["text"," "], ["entity.name","parentof"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","B"], ["text",")"], ["keyword.end","."] ],[ "start", ["entity.name","ancestorof"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","C"], ["text",") "], ["keyword.start","<-"], ["text"," "], ["entity.name","ancestorof"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","B"], ["text",")"], ["keyword.other",","], ["text"," "], ["entity.name","parentof"], ["text","("], ["variable.parameter","B"], ["keyword.other",","], ["variable.parameter","C"], ["text",")"], ["keyword.end","."] ],[ "start" ],[ "start", ["entity.name","grandparentof"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","B"], ["text",") "], ["keyword.start","<-"], ["text"," "], ["entity.name","parentof"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","C"], ["text",")"], ["keyword.other",","], ["text"," "], ["entity.name","parentof"], ["text","("], ["variable.parameter","C"], ["keyword.other",","], ["text"," "], ["variable.parameter","B"], ["text",")"], ["keyword.end","."] ],[ "start" ],[ "start", ["entity.name","cousins"], ["text","("], ["variable.parameter","A"], ["keyword.other",","], ["variable.parameter","B"], ["text",") "], ["keyword.start","<-"], ["text"," "], ["entity.name","grandparentof"], ["text","("], ["variable.parameter","C"], ["keyword.other",","], ["variable.parameter","A"], ["text",")"], ["keyword.other",","], ["text"," "], ["entity.name","grandparentof"], ["text","("], ["variable.parameter","C"], ["keyword.other",","], ["variable.parameter","B"], ["text",")"], ["keyword.end","."] ],[ "start" ],[ "start", ["entity.name","parentof"], ["text","["], ["entity.name.type.logicblox","`arg"], ["text","]("], ["variable.parameter","A"], ["keyword.other",","], ["text"," "], ["variable.parameter","B"], ["text",") "], ["keyword.start","->"], ["text"," "], ["entity.name","int"], ["text","["], ["constant.numeric","32"], ["text","]("], ["variable.parameter","A"], ["text",")"], ["keyword.other",","], ["text"," "], ["keyword.other","!"], ["entity.name","string"], ["text","("], ["variable.parameter","B"], ["text",")"], ["keyword.end","."] ]] ================================================ FILE: lib/ace/mode/_test/tokens_lsl.json ================================================ [[ "comment", ["comment.block.begin.lsl","/*"] ],[ "comment", ["comment.block.lsl"," Testing syntax highlighting"] ],[ "comment", ["comment.block.lsl"," of Ace Editor"] ],[ "comment", ["comment.block.lsl"," for the Linden Scripting Language"] ],[ "start", ["comment.block.end.lsl","*/"] ],[ "start" ],[ "start", ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","someIntNormal"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.numeric.lsl","3672"], ["punctuation.operator.lsl",";"] ],[ "start", ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","someIntHex"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.numeric.lsl","0x00000000"], ["punctuation.operator.lsl",";"] ],[ "start", ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","someIntMath"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.float.lsl","PI_BY_TWO"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["storage.type.lsl","integer"], ["text.lsl"," "], ["invalid.illegal.lsl","event"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.numeric.lsl","5673"], ["punctuation.operator.lsl",";"], ["text.lsl"," "], ["comment.line.double-slash.lsl","// invalid.illegal"] ],[ "start" ],[ "start", ["storage.type.lsl","key"], ["text.lsl"," "], ["identifier","someKeyTexture"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.string.lsl","TEXTURE_DEFAULT"], ["punctuation.operator.lsl",";"] ],[ "start", ["storage.type.lsl","string"], ["text.lsl"," "], ["identifier","someStringSpecial"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.string.lsl","EOF"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["identifier","some_user_defined_function_without_return_type"], ["paren.lparen.lsl","("], ["storage.type.lsl","string"], ["text.lsl"," "], ["identifier","inputAsString"], ["paren.rparen.lsl",")"] ],[ "start", ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["support.function.lsl","llSay"], ["paren.lparen.lsl","("], ["constant.language.integer.lsl","PUBLIC_CHANNEL"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["identifier","inputAsString"], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start", ["paren.rparen.lsl","}"] ],[ "start" ],[ "start", ["storage.type.lsl","string"], ["text.lsl"," "], ["identifier","user_defined_function_returning_a_string"], ["paren.lparen.lsl","("], ["storage.type.lsl","key"], ["text.lsl"," "], ["identifier","inputAsKey"], ["paren.rparen.lsl",")"] ],[ "start", ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["keyword.control.lsl","return"], ["text.lsl"," "], ["paren.lparen.lsl","("], ["storage.type.lsl","string"], ["paren.rparen.lsl",")"], ["identifier","inputAsKey"], ["punctuation.operator.lsl",";"] ],[ "start", ["paren.rparen.lsl","}"] ],[ "start" ],[ "start", ["entity.name.state.lsl","default"] ],[ "start", ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["support.function.event.lsl","state_entry"], ["paren.lparen.lsl","("], ["paren.rparen.lsl",")"] ],[ "start", ["text.lsl"," "], ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["storage.type.lsl","key"], ["text.lsl"," "], ["identifier","someKey"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.string.lsl","NULL_KEY"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["identifier","someKey"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["support.function.lsl","llGetOwner"], ["paren.lparen.lsl","("], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["text.lsl"," "], ["storage.type.lsl","string"], ["text.lsl"," "], ["identifier","someString"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["identifier","user_defined_function_returning_a_string"], ["paren.lparen.lsl","("], ["identifier","someKey"], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["text.lsl"," "], ["identifier","some_user_defined_function_without_return_type"], ["paren.lparen.lsl","("], ["identifier","someString"], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["paren.rparen.lsl","}"] ],[ "start" ],[ "start", ["text.lsl"," "], ["support.function.event.lsl","touch_start"], ["paren.lparen.lsl","("], ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","num_detected"], ["paren.rparen.lsl",")"] ],[ "start", ["text.lsl"," "], ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["storage.type.lsl","list"], ["text.lsl"," "], ["identifier","agentsInRegion"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["support.function.lsl","llGetAgentList"], ["paren.lparen.lsl","("], ["constant.language.integer.lsl","AGENT_LIST_REGION"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["paren.lparen.lsl","["], ["paren.rparen.lsl","])"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","numOfAgents"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["support.function.lsl","llGetListLength"], ["paren.lparen.lsl","("], ["identifier","agentsInRegion"], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["text.lsl"," "], ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","index"], ["punctuation.operator.lsl",";"], ["text.lsl"," "], ["comment.line.double-slash.lsl","// defaults to 0"] ],[ "start", ["text.lsl"," "], ["keyword.control.lsl","for"], ["text.lsl"," "], ["paren.lparen.lsl","("], ["punctuation.operator.lsl",";"], ["text.lsl"," "], ["identifier","index"], ["text.lsl"," "], ["keyword.operator.lsl","<="], ["text.lsl"," "], ["identifier","numOfAgents"], ["text.lsl"," "], ["keyword.operator.lsl","-"], ["text.lsl"," "], ["constant.numeric.lsl","1"], ["punctuation.operator.lsl",";"], ["text.lsl"," "], ["identifier","index"], ["keyword.operator.lsl","++"], ["paren.rparen.lsl",")"], ["text.lsl"," "], ["comment.line.double-slash.lsl","// for each agent in region"] ],[ "start", ["text.lsl"," "], ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["support.function.lsl","llRegionSayTo"], ["paren.lparen.lsl","("], ["support.function.lsl","llList2Key"], ["paren.lparen.lsl","("], ["identifier","agentsInRegion"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["identifier","index"], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["constant.language.integer.lsl","PUBLIC_CHANNEL"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["string.quoted.double.lsl.start","\""], ["string.quoted.double.lsl","Hello, Avatar!"], ["string.quoted.double.lsl.end","\""], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["paren.rparen.lsl","}"] ],[ "start", ["text.lsl"," "], ["paren.rparen.lsl","}"] ],[ "start" ],[ "start", ["text.lsl"," "], ["support.function.event.lsl","touch_end"], ["paren.lparen.lsl","("], ["storage.type.lsl","integer"], ["text.lsl"," "], ["identifier","num_detected"], ["paren.rparen.lsl",")"] ],[ "start", ["text.lsl"," "], ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["identifier","someIntNormal"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.numeric.lsl","3672"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["identifier","someIntHex"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.numeric.lsl","0x00000000"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["identifier","someIntMath"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.float.lsl","PI_BY_TWO"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["text.lsl"," "], ["invalid.illegal.lsl","event"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.numeric.lsl","5673"], ["punctuation.operator.lsl",";"], ["text.lsl"," "], ["comment.line.double-slash.lsl","// invalid.illegal"] ],[ "start" ],[ "start", ["text.lsl"," "], ["identifier","someKeyTexture"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.string.lsl","TEXTURE_DEFAULT"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["identifier","someStringSpecial"], ["text.lsl"," "], ["keyword.operator.lsl","="], ["text.lsl"," "], ["constant.language.string.lsl","EOF"], ["punctuation.operator.lsl",";"] ],[ "start" ],[ "start", ["text.lsl"," "], ["reserved.godmode.lsl","llSetInventoryPermMask"], ["paren.lparen.lsl","("], ["string.quoted.double.lsl.start","\""], ["string.quoted.double.lsl","some item"], ["string.quoted.double.lsl.end","\""], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["constant.language.integer.lsl","MASK_NEXT"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["constant.language.integer.lsl","PERM_ALL"], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"], ["text.lsl"," "], ["comment.line.double-slash.lsl","// reserved.godmode"] ],[ "start" ],[ "start", ["text.lsl"," "], ["support.function.lsl","llWhisper"], ["paren.lparen.lsl","("], ["constant.language.integer.lsl","PUBLIC_CHANNEL"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["string.quoted.double.lsl.start","\""], ["string.quoted.double.lsl","Leaving "], ["constant.character.escape.lsl","\\\""], ["string.quoted.double.lsl","default"], ["constant.character.escape.lsl","\\\""], ["string.quoted.double.lsl"," now..."], ["string.quoted.double.lsl.end","\""], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["entity.name.state.lsl","state other"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["paren.rparen.lsl","}"] ],[ "start", ["paren.rparen.lsl","}"] ],[ "start" ],[ "start", ["entity.name.state.lsl","state other"] ],[ "start", ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["support.function.event.lsl","state_entry"], ["paren.lparen.lsl","("], ["paren.rparen.lsl",")"] ],[ "start", ["text.lsl"," "], ["paren.lparen.lsl","{"] ],[ "start", ["text.lsl"," "], ["support.function.lsl","llWhisper"], ["paren.lparen.lsl","("], ["constant.language.integer.lsl","PUBLIC_CHANNEL"], ["punctuation.operator.lsl",","], ["text.lsl"," "], ["string.quoted.double.lsl.start","\""], ["string.quoted.double.lsl","Entered "], ["constant.character.escape.lsl","\\\""], ["string.quoted.double.lsl","state other"], ["constant.character.escape.lsl","\\\""], ["string.quoted.double.lsl",", returning to "], ["constant.character.escape.lsl","\\\""], ["string.quoted.double.lsl","default"], ["constant.character.escape.lsl","\\\""], ["string.quoted.double.lsl"," again..."], ["string.quoted.double.lsl.end","\""], ["paren.rparen.lsl",")"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["entity.name.state.lsl","state default"], ["punctuation.operator.lsl",";"] ],[ "start", ["text.lsl"," "], ["paren.rparen.lsl","}"] ],[ "start", ["paren.rparen.lsl","}"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_lua.json ================================================ [[ ["bracketedComment",2,"start"], ["comment","--[[--"] ],[ ["bracketedComment",2,"start"], ["comment","num_args takes in 5.1 byte code and extracts the number of arguments"] ],[ ["bracketedComment",2,"start"], ["comment","from its function header."] ],[ "start", ["comment","--]]--"] ],[ "start" ],[ "start", ["keyword","function"], ["text"," "], ["identifier","int"], ["paren.lparen","("], ["identifier","t"], ["paren.rparen",")"] ],[ "start", ["text","\t"], ["keyword","return"], ["text"," "], ["identifier","t"], ["keyword.operator",":"], ["support.function","byte"], ["paren.lparen","("], ["constant.numeric","1"], ["paren.rparen",")"], ["keyword.operator","+"], ["identifier","t"], ["keyword.operator",":"], ["support.function","byte"], ["paren.lparen","("], ["constant.numeric","2"], ["paren.rparen",")"], ["keyword.operator","*"], ["constant.numeric","0x100"], ["keyword.operator","+"], ["identifier","t"], ["keyword.operator",":"], ["support.function","byte"], ["paren.lparen","("], ["constant.numeric","3"], ["paren.rparen",")"], ["keyword.operator","*"], ["constant.numeric","0x10000"], ["keyword.operator","+"], ["identifier","t"], ["keyword.operator",":"], ["support.function","byte"], ["paren.lparen","("], ["constant.numeric","4"], ["paren.rparen",")"], ["keyword.operator","*"], ["constant.numeric","0x1000000"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","function"], ["text"," "], ["identifier","num_args"], ["paren.lparen","("], ["identifier","func"], ["paren.rparen",")"] ],[ "start", ["text","\t"], ["keyword","local"], ["text"," "], ["support.function","dump"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.library","string"], ["text","."], ["support.function","dump"], ["paren.lparen","("], ["identifier","func"], ["paren.rparen",")"] ],[ "start", ["text","\t"], ["keyword","local"], ["text"," "], ["identifier","offset"], ["text",", "], ["identifier","cursor"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","int"], ["paren.lparen","("], ["support.function","dump"], ["keyword.operator",":"], ["support.function","sub"], ["paren.lparen","("], ["constant.numeric","13"], ["paren.rparen","))"], ["text",", "], ["identifier","offset"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","26"] ],[ "start", ["text","\t"], ["comment","--Get the params and var flag (whether there's a ... in the param)"] ],[ "start", ["text","\t"], ["keyword","return"], ["text"," "], ["support.function","dump"], ["keyword.operator",":"], ["support.function","sub"], ["paren.lparen","("], ["identifier","cursor"], ["paren.rparen",")"], ["keyword.operator",":"], ["support.function","byte"], ["paren.lparen","("], ["paren.rparen",")"], ["text",", "], ["support.function","dump"], ["keyword.operator",":"], ["support.function","sub"], ["paren.lparen","("], ["identifier","cursor"], ["keyword.operator","+"], ["constant.numeric","1"], ["paren.rparen",")"], ["keyword.operator",":"], ["support.function","byte"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["comment","-- Usage:"] ],[ "start", ["identifier","num_args"], ["paren.lparen","("], ["keyword","function"], ["paren.lparen","("], ["identifier","a"], ["text",","], ["identifier","b"], ["text",","], ["identifier","c"], ["text",","], ["identifier","d"], ["text",", "], ["keyword.operator","..."], ["paren.rparen",")"], ["text"," "], ["keyword","end"], ["paren.rparen",")"], ["text"," "], ["comment","-- return 4, 7"] ],[ "start" ],[ "start", ["comment","-- Python styled string format operator"] ],[ "start", ["keyword","local"], ["text"," "], ["identifier","gm"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.library","debug"], ["text","."], ["support.function","getmetatable"], ["paren.lparen","("], ["string","\"\""], ["paren.rparen",")"] ],[ "start" ],[ "start", ["identifier","gm"], ["text","."], ["support.function","__mod"], ["keyword.operator","="], ["keyword","function"], ["paren.lparen","("], ["variable.language","self"], ["text",", "], ["identifier","other"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["support.function","type"], ["paren.lparen","("], ["identifier","other"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","~="], ["text"," "], ["string","\"table\""], ["text"," "], ["keyword","then"], ["text"," "], ["identifier","other"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["identifier","other"], ["paren.rparen","}"], ["text"," "], ["keyword","end"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["identifier","i"], ["text",","], ["identifier","v"], ["text"," "], ["keyword","in"], ["text"," "], ["support.function","ipairs"], ["paren.lparen","("], ["identifier","other"], ["paren.rparen",")"], ["text"," "], ["keyword","do"], ["text"," "], ["identifier","other"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","tostring"], ["paren.lparen","("], ["identifier","v"], ["paren.rparen",")"], ["text"," "], ["keyword","end"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["variable.language","self"], ["keyword.operator",":"], ["support.function","format"], ["paren.lparen","("], ["support.function","unpack"], ["paren.lparen","("], ["identifier","other"], ["paren.rparen","))"] ],[ "start", ["keyword","end"] ],[ "start" ],[ ["bracketedString",5,"start"], ["support.function","print"], ["paren.lparen","("], ["string.start","[===["] ],[ ["bracketedString",5,"start"], ["string"," blah blah %s, (%d %d)"] ],[ "start", ["string.end","]===]"], ["keyword.operator","%"], ["paren.lparen","{"], ["string","\"blah\""], ["text",", "], ["identifier","num_args"], ["paren.lparen","("], ["identifier","int"], ["paren.rparen",")})"] ],[ "start" ],[ ["bracketedComment",3,"start"], ["comment","--[=[--"] ],[ ["bracketedComment",3,"start"], ["comment","table.maxn is deprecated, use # instead."] ],[ "start", ["comment","--]=]--"] ],[ "start", ["support.function","print"], ["paren.lparen","("], ["constant.library","table"], ["text","."], ["keyword.deprecated","maxn"], ["paren.lparen","{"], ["constant.numeric","1"], ["text",","], ["constant.numeric","2"], ["text",","], ["paren.lparen","["], ["constant.numeric","4"], ["paren.rparen","]"], ["keyword.operator","="], ["constant.numeric","4"], ["text",","], ["paren.lparen","["], ["constant.numeric","8"], ["paren.rparen","]"], ["keyword.operator","="], ["constant.numeric","8"], ["paren.rparen",")"], ["text"," "], ["comment","-- outputs 8 instead of 2"] ],[ "start" ],[ "start", ["support.function","print"], ["paren.lparen","("], ["constant.numeric","5"], ["text"," "], ["comment","--[[ blah ]]"], ["paren.rparen",")"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_luapage.json ================================================ [[ "doctype", ["text.xml",""], ["xml-pe.doctype.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ ["lua-bracketedComment",2,"lua-start"], ["keyword","<%"], ["text"," "], ["comment","--[[--"] ],[ ["lua-bracketedComment",2,"lua-start"], ["comment"," index.lp from the Kepler Project's LuaDoc HTML doclet."] ],[ ["lua-bracketedComment",2,"lua-start"], ["comment"," http://keplerproject.github.com/luadoc/"] ],[ "start", ["comment","--]]"], ["text"," "], ["keyword","%>"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","head"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Reference"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","link"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","rel"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"stylesheet\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword","<%="], ["identifier","luadoc"], ["text","."], ["identifier","doclet"], ["text","."], ["identifier","html"], ["text","."], ["identifier","link"], ["paren.lparen","("], ["string","\"luadoc.css\""], ["paren.rparen",")"], ["keyword","%>"], ["string.attribute-value.xml","\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"text/css\""], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start", ["text.xml","\t"], ["comment.start.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"container\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"product\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"product_logo\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"product_name\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","big"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"product_description\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," "], ["comment.start.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"main\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"navigation\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["keyword","<%="], ["identifier","luadoc"], ["text","."], ["identifier","doclet"], ["text","."], ["identifier","html"], ["text","."], ["identifier","include"], ["paren.lparen","("], ["string","\"menu.lp\""], ["text",", "], ["paren.lparen","{"], ["text"," "], ["identifier","doc"], ["keyword.operator","="], ["identifier","doc"], ["text"," "], ["paren.rparen","})"], ["keyword","%>"] ],[ "start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," "], ["comment.start.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"content\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start" ],[ "start", ["keyword","<%if"], ["text"," "], ["keyword","not"], ["text"," "], ["identifier","options"], ["text","."], ["identifier","nomodules"], ["text"," "], ["keyword","and"], ["text"," "], ["keyword.operator","#"], ["identifier","doc"], ["text","."], ["identifier","modules"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword","then%>"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Modules"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","table"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"module_list\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["comment.start.xml",""] ],[ "start", ["keyword","<%for"], ["text"," "], ["identifier","_"], ["text",", "], ["identifier","modulename"], ["text"," "], ["keyword","in"], ["text"," "], ["support.function","ipairs"], ["paren.lparen","("], ["identifier","doc"], ["text","."], ["identifier","modules"], ["paren.rparen",")"], ["text"," "], ["keyword","do%>"] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml","\t\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"name\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword","<%="], ["identifier","luadoc"], ["text","."], ["identifier","doclet"], ["text","."], ["identifier","html"], ["text","."], ["identifier","module_link"], ["paren.lparen","("], ["identifier","modulename"], ["text",", "], ["identifier","doc"], ["paren.rparen",")"], ["keyword","%>"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["keyword","<%="], ["identifier","modulename"], ["keyword","%>"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","\t\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"summary\""], ["meta.tag.punctuation.tag-close.xml",">"], ["keyword","<%="], ["identifier","doc"], ["text","."], ["identifier","modules"], ["paren.lparen","["], ["identifier","modulename"], ["paren.rparen","]"], ["text","."], ["identifier","summary"], ["keyword","%>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["keyword","<%end%>"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["keyword","<%end%>"] ],[ "start" ],[ "start" ],[ "start" ],[ "start", ["keyword","<%if"], ["text"," "], ["keyword","not"], ["text"," "], ["identifier","options"], ["text","."], ["identifier","nofiles"], ["text"," "], ["keyword","and"], ["text"," "], ["keyword.operator","#"], ["identifier","doc"], ["text","."], ["identifier","files"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword","then%>"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h2"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Files"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","table"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"file_list\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["comment.start.xml",""] ],[ "start", ["keyword","<%for"], ["text"," "], ["identifier","_"], ["text",", "], ["identifier","filepath"], ["text"," "], ["keyword","in"], ["text"," "], ["support.function","ipairs"], ["paren.lparen","("], ["identifier","doc"], ["text","."], ["identifier","files"], ["paren.rparen",")"], ["text"," "], ["keyword","do%>"] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","tr"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml","\t\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"name\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["keyword","<%="], ["identifier","luadoc"], ["text","."], ["identifier","doclet"], ["text","."], ["identifier","html"], ["text","."], ["identifier","file_link"], ["paren.lparen","("], ["identifier","filepath"], ["paren.rparen",")"], ["keyword","%>"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["keyword","<%="], ["identifier","filepath"], ["keyword","%>"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","\t\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.table.tag-name.xml","td"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","class"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"summary\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["keyword","<%end%>"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["keyword","<%end%>"] ],[ "start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," "], ["comment.start.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," "], ["comment.start.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"about\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml","\t"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"http://validator.w3.org/check?uri=referer\""], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.image.tag-name.xml","img"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","src"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"http://www.w3.org/Icons/valid-xhtml10\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","alt"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"Valid XHTML 1.0!\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","height"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"31\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","width"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"88\""], ["text.tag-whitespace.xml"," "], ["meta.tag.punctuation.tag-close.xml","/>"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," "], ["comment.start.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," "], ["comment.start.xml",""], ["text.xml","\t"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_lucene.json ================================================ [[ "start", ["keyword","test:"], ["text"," recognises "], ["keyword.operator","AND"], ["text"," as keyword"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["keyword.operator","OR"], ["text"," as keyword"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["keyword.operator","NOT"], ["text"," as keyword"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["string","\"hello this is dog\""], ["text"," as string"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["constant.character.negation","-"], ["string","\"hello this is dog\""], ["text"," as negation with string"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["constant.character.proximity","~100"], ["text"," as text with proximity"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["string","\"hello this is dog\""], ["constant.character.proximity","~100"], ["text"," as string with proximity"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["keyword","raw:"], ["string","\"hello this is dog\""], ["text"," as keyword"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["keyword","raw:"], ["text","foo as\"keyword'"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["string","\"(\""], ["text"," as opening parenthesis"] ],[ "start", ["keyword","test:"], ["text"," recognises "], ["string","\")\""], ["text"," as closing parenthesis"] ],[ "start", ["keyword","test:"], ["text"," recognises foo"], ["constant.character.asterisk","*"], ["text"," as text with asterisk"] ],[ "start", ["keyword","test:"], ["text"," recognises foo"], ["constant.character.interro","?"], ["text"," as text with interro"] ],[ "start", ["keyword","test:"], ["text"," recognises single word as text"] ],[ "start", ["text"," foo"] ],[ "start", ["text"," "] ]] ================================================ FILE: lib/ace/mode/_test/tokens_markdown.json ================================================ [[ "start", ["text.xml","test: header 1 "] ],[ "start", ["markup.heading.1","#"], ["heading","f"] ],[ "start", ["text.xml","test: header 2"] ],[ "start", ["markup.heading.2","##"], ["heading"," foo"] ],[ "start", ["text.xml","test: header ends with ' #'"] ],[ "start", ["markup.heading.1","#"], ["heading"," # # "] ],[ "start", ["text.xml","test: header ends with '#'"] ],[ "start", ["markup.heading.1","#"], ["heading","foo# "] ],[ "start", ["text.xml","test: 6+ #s is not a valid header"] ],[ "start", ["text.xml","####### foo"] ],[ "start", ["text.xml","test: # followed be only space is not a valid header"] ],[ "start", ["text.xml","# "] ],[ "start", ["text.xml","test: only space between #s is not a valid header"] ],[ "start", ["text.xml","# #"] ],[ "allowBlock" ],[ "start", ["markup.heading.1","#"], ["heading"," test links "], ["text","["], ["string","Cloud9 IDE"], ["text","]("], ["markup.underline","http://www.c9.io/"], ["text",")"], ["heading"," #"] ],[ "listblock", ["markup.list","* "], ["text","["], ["string","demo"], ["text","]("], ["markup.underline","http://ajaxorg.github.com/ace/"], ["text",")"], ["list"," "], ["text","["], ["string","+"], ["text","]("], ["markup.underline","escape(\\) "], ["text",")"], ["list"," "], ["text","["], ["string","+"], ["text","]("], ["markup.underline","a"], ["string"," \"title\""], ["text",")"], ["list"," "], ["text","["], ["string","+"], ["text","]("], ["markup.underline","a"], ["string"," \"space\" "], ["text",")"] ],[ "listblock", ["markup.list","* "], ["list","usually "], ["string.emphasis","*work*"], ["list"," fine ("], ["string.emphasis","_em_"], ["list",")"] ],[ "listblock", ["list","in lists"] ],[ "start" ],[ "start", ["text.xml","in plain text "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","http://ace.ajaxorg.com"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "allowBlock" ],[ "allowBlock" ]] ================================================ FILE: lib/ace/mode/_test/tokens_mask.json ================================================ [[ "start", ["comment","/* Mask Syntax Demo */"] ],[ "start" ],[ "start", ["keyword.support.constant.language","div"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["string.start","'"], ["string"," Test "], ["paren.lparen.markup.italic","~["], ["identifier","name"], ["paren.rparen.markup.italic","]"], ["string.end","'"], ["paren.rparen",";"] ],[ "start" ],[ "start", ["keyword","define"], ["text"," :"], ["support.variable.class","userProfile"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["keyword.support.constant.language","header"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword.support.constant.language","h4"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["support.function.markup.bold","@title"], ["paren.lparen",";"] ],[ "start", ["text","\t\t"], ["keyword.support.constant.language","button"], ["support.variable.class",".close"], ["paren.lparen",";"] ],[ "start", ["text","\t"], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["support.function.markup.bold",":userProfile"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["support.function.markup.bold","@title"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["string.start","'"], ["string"," Hello "], ["paren.lparen.markup.italic","~["], ["keyword.control.markup.italic",":"], ["text"," "], ["identifier","username"], ["punctuation.operator","."], ["support.function","toUpperCase"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.rparen.markup.italic","]"], ["string.end","'"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ ["paren.lparen52","constant.language40"], ["constant.language","style"], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","css-block-ruleset","paren.lparen52","constant.language40"], ["text"," "], ["constant","html"], ["text",", "], ["constant","body"], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","css-block-ruleset","paren.lparen52","constant.language40"], ["text"," "], ["support.type","background"], ["text",": "], ["support.function","url("], ["string","'name.png'"], ["support.function",")"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["support.constant","no-repeat"], ["text",";"] ],[ ["#tmp","css-block-start","paren.lparen52","constant.language40"], ["text"," "], ["paren.rparen","}"] ],[ ["#tmp","css-block-end","paren.lparen52","constant.language40"], ["paren.rparen","}"] ],[ ["#tmp","start","paren.lparen52","constant.language40"] ],[ ["#tmp","start","paren.lparen52","constant.language40"], ["keyword.support.constant.language","button"], ["text"," "], ["paren.lparen","{"] ],[ ["paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["text","\t"], ["constant.language","event"], ["text"," "], ["support.variable.class","click"], ["text"," "], ["paren.lparen","("], ["identifier","e"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","js-block-start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["text","\t "], ["variable.language","this"], ["punctuation.operator","."], ["identifier","textContent"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.quasi.start","`"], ["string.quasi","name "], ["paren.quasi.start","${"], ["identifier","e"], ["punctuation.operator","."], ["identifier","clientX"], ["paren.quasi.end","}"], ["string.quasi"," !"], ["string.quasi.end","`"], ["punctuation.operator",";"] ],[ ["#tmp","js-block-end","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["text","\t"], ["paren.rparen","}"] ],[ ["#tmp","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["paren.rparen","}"] ],[ ["#tmp","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["constant.language","md"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["paren.lparen","\"\"\""] ],[ ["#tmp","md-multiline-allowBlock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["markup.list","- "], ["list","div"] ],[ ["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["markup.list","- "], ["list","span"] ],[ ["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["list"," "] ],[ ["#tmp","md-multiline-listblock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["list","Hello"] ],[ ["#tmp","md-multiline-start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","md-multiline-start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["text","["], ["string","one"], ["text","]("], ["markup.underline","http://google.com"], ["text",")"] ],[ ["#tmp","md-multiline-allowBlock","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["paren.rparen","\"\"\";"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["keyword.support.constant.language","header"], ["text"," "], ["support.variable.class",".foo"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["string.start","'"], ["string","Heading"], ["string.end","'"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["keyword.support.constant.language","button"], ["text"," "], ["support.variable.class",".baz"], ["text"," "], ["support.variable.class.markup.bold","x-signal"], ["keyword.operator","="], ["string.start","'"], ["string","click: test"], ["string.end","'"], ["text"," "], ["support.variable.class","disabled"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["string.start","\""] ],[ ["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["string","\tHello,"] ],[ ["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["string","\tworld "] ],[ ["string.start2","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["string","\t"], ["string.escape","\\\""], ["string","Buddy"], ["string.escape","\\\""] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["string.end","\""] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","js-statement-start","start","js-statement-no_regex","constant.language53","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["constant.language","var"], ["text"," "], ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"] ],[ ["#tmp","js-statement-no_regex","start","js-statement-no_regex","constant.language53","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["text"," "], ["identifier","name"], ["punctuation.operator",":"], ["text"," "], ["string.quasi.start","`"], ["string.quasi","name "], ["paren.quasi.start","${"], ["variable.language","window"], ["punctuation.operator","."], ["support.constant","innerWidth"], ["paren.rparen","}"], ["string.quasi.end","`"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["paren.rparen","};"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"] ],[ ["#tmp","start","paren.lparen13","constant.language","constant.language","start","paren.lparen39","constant.language27","constant.language27","start","paren.lparen52","constant.language40"], ["keyword.support.constant.language","span"], ["text"," "], ["support.variable.class",".foo"], ["text"," "], ["paren.lparen",">"], ["text"," "], ["string.start","\""], ["paren.lparen.markup.italic","~["], ["keyword.control.markup.italic","bind:"], ["text"," "], ["identifier","a"], ["punctuation.operator","."], ["identifier","name"], ["paren.rparen.markup.italic","]"], ["string.end","\""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_matlab.json ================================================ [[ ["blockComment","noQstring"], ["comment.start","%{"] ],[ ["blockComment","blockComment","blockComment","noQstring"], ["comment.start"," %{"] ],[ ["blockComment","blockComment","blockComment","noQstring"], ["comment"," Ace Matlab demo"] ],[ ["blockComment","noQstring"], ["comment.end"," %}"] ],[ "noQstring", ["comment.end","%}"] ],[ "start" ],[ "start", ["keyword","classdef"], ["text"," "], ["identifier","hello"] ],[ "start", ["text"," "], ["support.function","methods"] ],[ "start", ["text"," "], ["keyword","function"], ["text"," "], ["identifier","greet"], ["paren.lparen","("], ["identifier","this"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["support.function","disp"], ["paren.lparen","("], ["string","'Hello!'"], ["paren.rparen",")"], ["text"," "], ["comment","% say hi"] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start", ["keyword","end"] ],[ "noQstring" ],[ "start", ["comment","% transpose "] ],[ "qqstring", ["identifier","a"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["text"," "], ["string","'x"], ["constant.language.escape","''"], ["string","y'"], ["punctuation.operator",","], ["text"," "], ["string","\"x"], ["constant.language.escape","\\n"], ["string","\\"] ],[ "start", ["string"," y\""], ["punctuation.operator",","], ["text"," "], ["constant.numeric","1"], ["text","' "], ["paren.rparen","]"], ["text","' "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","2"], ["text","'"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_maze.json ================================================ [[ "start", ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","()"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","^^"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"] ],[ "start", ["keyword.control","##"], ["text"," "], ["entity.name.function","H1"], ["text"," "], ["entity.name.function","C2"], ["text"," "], ["entity.name.function","S1"], ["text"," "], ["keyword.control","<>"], ["text"," "], ["entity.name.function","S2"], ["text"," "], ["entity.name.function","H2"], ["text"," "], ["entity.name.function","DN"], ["text"," "], ["keyword.control","##"] ],[ "start", ["keyword.control","##"], ["text"," "], ["constant.language","%U"], ["text"," "], ["keyword.control","<>"], ["text"," "], ["constant.language","%D"], ["text"," "], ["entity.name.tag","*2"], ["text"," "], ["constant.language","%L"], ["text"," "], ["entity.name.function","IZ"], ["text"," "], ["entity.name.tag",".."], ["text"," "], ["keyword.control","##"] ],[ "start", ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["entity.name.tag",".."], ["text"," "], ["keyword.control","##"], ["text"," "], ["entity.name.function","DN"], ["text"," "], ["entity.name.tag","*3"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"] ],[ "start", ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["constant.language","%R"], ["text"," "], ["entity.name.function","C1"], ["text"," "], ["entity.name.function","IZ"], ["text"," "], ["keyword.control","()"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"] ],[ "start", ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["keyword.control","##"], ["text"," "], ["support.function",">/"], ["text"," "], ["entity.name.tag","*1"] ],[ "start", ["keyword.control","##"], ["text"," "], ["keyword.control","()"], ["text"," "], ["entity.name.tag","*3"], ["text"," "], ["entity.name.tag","*1"], ["text"," "], ["constant.language","%L"], ["text"," "], ["keyword.control","()"] ],[ "start" ],[ "start" ],[ "start", ["comment.line.double-slash","// Set divisor and dividend"] ],[ "start", ["entity.name.function","S1"], ["keyword.other","-> "], ["keyword.operator","="], ["keyword.other"," "], ["constant.numeric","9"] ],[ "start", ["entity.name.function","S2"], ["keyword.other","-> "], ["keyword.operator","="], ["keyword.other"," "], ["constant.numeric","24"] ],[ "start" ],[ "start", ["comment.line.double-slash","// Holding cells"] ],[ "start", ["entity.name.function","H1"], ["keyword.other","-> "], ["keyword.control","IF"], ["keyword.other"," "], ["entity.name.tag","*1"], ["keyword.other"," "], ["keyword.control","THEN"], ["keyword.other"," "], ["constant.language","%R"], ["keyword.other"," "], ["keyword.control","ELSE"], ["keyword.other"," "], ["constant.language","%N"] ],[ "start", ["entity.name.function","H2"], ["keyword.other","-> "], ["keyword.control","IF"], ["keyword.other"," "], ["entity.name.tag","*2"], ["keyword.other"," "], ["keyword.control","THEN"], ["keyword.other"," "], ["constant.language","%R"], ["keyword.other"," "], ["keyword.control","ELSE"], ["keyword.other"," "], ["constant.language","%N"] ],[ "start" ],[ "start", ["comment.line.double-slash","// Arithmetic"] ],[ "start", ["entity.name.function","DN"], ["keyword.other","-> "], ["keyword.operator","-="], ["keyword.other"," "], ["constant.numeric","1"] ],[ "start", ["entity.name.function","IZ"], ["keyword.other","-> "], ["keyword.control","IF"], ["keyword.other"," "], ["keyword.operator","<="], ["keyword.other"," "], ["constant.numeric","0"], ["keyword.other"," "], ["keyword.control","THEN"], ["keyword.other"," "], ["constant.language","%D"], ["keyword.other"," "], ["keyword.control","ELSE"], ["keyword.other"," "], ["constant.language","%U"] ],[ "start" ],[ "start", ["entity.name.function","C1"], ["keyword.other","-> "], ["keyword.control","IF"], ["keyword.other"," "], ["entity.name.tag","*3"], ["keyword.other"," "], ["keyword.control","THEN"], ["keyword.other"," "], ["constant.language","%D"], ["keyword.other"," "], ["keyword.control","ELSE"], ["keyword.other"," "], ["constant.language","%R"] ],[ "start", ["entity.name.function","C2"], ["keyword.other","-> "], ["keyword.control","IF"], ["keyword.other"," "], ["entity.name.tag","*3"], ["keyword.other"," "], ["keyword.control","THEN"], ["keyword.other"," "], ["constant.language","%U"], ["keyword.other"," "], ["keyword.control","ELSE"], ["keyword.other"," "], ["constant.language","%D"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_mel.json ================================================ [[ "start", ["comment.line.double-slash.mel","//"], ["punctuation.definition.comment.mel"," animated duplicates, instances script"] ],[ "start", ["keyword.other.mel","proc"], ["storage.type.mel"," "], ["entity.name.function.mel","animatedDuplication"], ["punctuation.section.function.mel"," ("], ["meta.function.mel","int $rangeStart, int $rangeEnd, int $numOfDuplicates, int $duplicateOrInstance"], ["punctuation.section.function.mel",")"] ],[ "start", ["text","{"] ],[ "start", ["text"," "], ["storage.type.mel","int"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","range_start"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","rangeStart"], ["text",";"] ],[ "start", ["text"," "], ["storage.type.mel","int"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","range_end"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","rangeEnd"], ["text",";"] ],[ "start", ["text"," "], ["storage.type.mel","int"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","num_of_duplicates"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","numOfDuplicates"], ["text",";"] ],[ "start", ["text"," "], ["storage.type.mel","int"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","step_size"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," ("], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","range_end"], ["text"," "], ["keyword.operator.symbolic.mel","-"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","range_start"], ["text",") "], ["keyword.operator.symbolic.mel","/"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","num_of_duplicates"], ["text",";"] ],[ "start", ["text"," "], ["storage.type.mel","int"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","i"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," "], ["constant.numeric.mel","0"], ["text",";"] ],[ "start", ["text"," "], ["storage.type.mel","int"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","temp"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["support.function.mel","currentTime"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","range_start"], ["text","; "], ["comment.line.double-slash.mel","//"], ["punctuation.definition.comment.mel"," set to range start"] ],[ "start" ],[ "start", ["text"," "], ["storage.type.mel","string"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","selectedObjects"], ["text","[]; "], ["comment.line.double-slash.mel","//"], ["punctuation.definition.comment.mel"," to store selected objects"] ],[ "start", ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","selectedObjects"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," `"], ["support.function.mel","ls"], ["text"," "], ["keyword.operator.symbolic.mel","-"], ["text","sl`; "], ["comment.line.double-slash.mel","//"], ["punctuation.definition.comment.mel"," store selected objects"] ],[ "start", ["text"," "], ["support.function.mel","select"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","selectedObjects"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.mel","while"], ["text"," ("], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","i"], ["text"," <"], ["keyword.operator.symbolic.mel","="], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","num_of_duplicates"], ["text",")"] ],[ "start", ["text"," {"] ],[ "start", ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","temp"], ["text"," "], ["keyword.operator.symbolic.mel","="], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","range_start"], ["text"," "], ["keyword.operator.symbolic.mel","+"], ["text"," ("], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","step_size"], ["text"," "], ["keyword.operator.symbolic.mel","*"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","i"], ["text",");"] ],[ "start", ["text"," "], ["support.function.mel","currentTime"], ["text"," ("], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","temp"], ["text",");"] ],[ "start", ["text"," "], ["comment.line.double-slash.mel","//"], ["punctuation.definition.comment.mel"," seleced the objects to duplicate or instance"] ],[ "start", ["text"," "], ["support.function.mel","select"], ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","selectedObjects"], ["text",";"] ],[ "start", ["text"," "], ["keyword.control.mel","if"], ["text","("], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","duplicateOrInstance"], ["text"," "], ["keyword.operator.symbolic.mel","=="], ["text"," "], ["constant.numeric.mel","0"], ["text",")"] ],[ "start", ["text"," {"] ],[ "start", ["text"," "], ["support.function.mel","duplicate"], ["text",";"] ],[ "start", ["text"," }"] ],[ "start", ["text"," "], ["keyword.control.mel","else"] ],[ "start", ["text"," {"] ],[ "start", ["text"," "], ["support.function.mel","instance"], ["text",";"] ],[ "start", ["text"," }"] ],[ "start", ["text"," "], ["variable.other.mel","$"], ["punctuation.definition.variable.mel","i"], ["keyword.operator.symbolic.mel","++"], ["text",";"] ],[ "start", ["text"," }"] ],[ "start", ["text","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_mixal.json ================================================ [[ "start", ["comment.line.character","* PROGRAM START"] ],[ "start", ["variable.other","ΔSTART"], ["text"," "], ["keyword.control","LDA"], ["text"," "], ["text","2000"], ["comment.line.character"," LOAD A FROM CELL 2000"] ],[ "start", ["text"," "], ["invalid.illegal","CMP7"], ["text"," "], ["text","=15="] ],[ "start", ["invalid.illegal","12345"], ["text"," "], ["keyword.control","HLT"] ],[ "start", ["text"," "], ["keyword.control","END"], ["text"," "], ["text","START"] ],[ "start", ["variable.other","ABC"], ["text"," "], ["keyword.control","ALF"], ["text"," "], ["invalid.illegal","abc"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_mushcode.json ================================================ [[ "start", ["text","@"], ["support.function","create"], ["text"," "], ["identifier","phone"] ],[ "start", ["text","&"], ["identifier","pickup"], ["text"," "], ["identifier","phone"], ["keyword.operator","="], ["identifier","$pick"], ["text"," "], ["identifier","up"], ["text",":@"], ["support.function","ifelse"], ["text"," "], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","is"], ["text",","], ["support.function","u"], ["paren.lparen","("], ["identifier","mode"], ["paren.rparen",")"], ["text",","], ["identifier","ICC"], ["paren.rparen",")]"], ["keyword.operator","="], ["paren.lparen","{"], ["text","@"], ["support.function","pemit"], ["text"," "], ["keyword.operator","%#="], ["identifier","You"], ["text"," "], ["support.function","pick"], ["text"," "], ["identifier","up"], ["text"," "], ["identifier","the"], ["text"," "], ["paren.lparen","["], ["support.function","fullname"], ["paren.lparen","("], ["identifier","me"], ["paren.rparen",")]"], ["text","."], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["identifier","me"], ["text",","], ["identifier","PHONER"], ["text",":"], ["keyword.operator","%#"], ["paren.rparen",")]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["identifier","me"], ["text",","], ["identifier","MODE"], ["text",":"], ["identifier","CIP"], ["paren.rparen",")]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","(["], ["support.function","u"], ["paren.lparen","("], ["identifier","INCOMING"], ["paren.rparen",")]"], ["text",","], ["identifier","CONNECTED"], ["text",":"], ["paren.lparen","["], ["support.function","num"], ["paren.lparen","("], ["identifier","me"], ["paren.rparen",")])]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["identifier","me"], ["text",","], ["identifier","CONNECTED"], ["text",":"], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","INCOMING"], ["paren.rparen",")])]"], ["variable","%r"], ["paren.lparen","["], ["support.function","showpicture"], ["paren.lparen","("], ["identifier","PICPICKUP"], ["paren.rparen",")]"], ["variable","%r"], ["identifier","Use"], ["text"," '"], ["paren.lparen","["], ["identifier","color"], ["paren.lparen","("], ["identifier","green"], ["text",","], ["identifier","black"], ["text",","], ["identifier","psay"], ["text"," "], ["keyword.operator","<"], ["identifier","message"], ["keyword.operator",">"], ["paren.rparen",")]"], ["text","' "], ["paren.lparen","("], ["support.function","or"], ["text"," '"], ["paren.lparen","["], ["identifier","color"], ["paren.lparen","("], ["identifier","green"], ["text",","], ["identifier","black"], ["text",","], ["identifier","p"], ["text"," "], ["keyword.operator","<"], ["identifier","message"], ["keyword.operator",">"], ["paren.rparen",")]"], ["text","'"], ["paren.rparen",")"], ["text"," "], ["identifier","to"], ["text"," "], ["identifier","talk"], ["text"," "], ["identifier","into"], ["text"," "], ["identifier","the"], ["text"," "], ["identifier","phone"], ["text",".;@"], ["support.function","oemit"], ["text"," "], ["keyword.operator","%#="], ["variable","%N"], ["text"," "], ["identifier","picks"], ["text"," "], ["identifier","up"], ["text"," "], ["identifier","the"], ["text"," "], ["paren.lparen","["], ["support.function","fullname"], ["paren.lparen","("], ["identifier","me"], ["paren.rparen",")]"], ["text","."], ["paren.rparen","}"], ["text",","], ["paren.lparen","{"], ["text","@"], ["support.function","pemit"], ["text"," "], ["keyword.operator","%#="], ["identifier","You"], ["text"," "], ["support.function","pick"], ["text"," "], ["identifier","up"], ["text"," "], ["identifier","the"], ["text"," "], ["identifier","phone"], ["text"," "], ["identifier","but"], ["text"," "], ["identifier","no"], ["text"," "], ["identifier","one"], ["text"," "], ["identifier","is"], ["text"," "], ["identifier","there"], ["text",". "], ["identifier","You"], ["text"," "], ["identifier","hear"], ["text"," "], ["identifier","a"], ["text"," "], ["identifier","dialtone"], ["text"," "], ["support.function","and"], ["text"," "], ["identifier","then"], ["text"," "], ["identifier","hang"], ["text"," "], ["identifier","up"], ["text",". "], ["paren.lparen","["], ["support.function","play"], ["paren.lparen","("], ["support.function","u"], ["paren.lparen","("], ["identifier","DIALTONE"], ["paren.rparen","))]"], ["text",";@"], ["support.function","oemit"], ["text"," "], ["keyword.operator","%#="], ["variable","%N"], ["text"," "], ["identifier","picks"], ["text"," "], ["identifier","up"], ["text"," "], ["identifier","the"], ["text"," "], ["identifier","phone"], ["text",", "], ["identifier","but"], ["text"," "], ["identifier","no"], ["text"," "], ["identifier","one"], ["text"," "], ["identifier","is"], ["text"," "], ["identifier","on"], ["text"," "], ["identifier","the"], ["text"," "], ["identifier","other"], ["text"," "], ["identifier","end"], ["text","."], ["paren.rparen","}"] ],[ "start", ["text","&"], ["identifier","ringfun"], ["text"," "], ["identifier","phone"], ["keyword.operator","="], ["paren.lparen","["], ["support.function","ifelse"], ["paren.lparen","("], ["support.function","eq"], ["paren.lparen","("], ["support.function","comp"], ["paren.lparen","(["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone"], ["paren.rparen",")]"], ["text",","], ["identifier","off"], ["paren.rparen",")"], ["text",","], ["constant.numeric","0"], ["paren.rparen",")"], ["text",","], ["paren.lparen","["], ["identifier","color"], ["paren.lparen","("], ["identifier","black"], ["text",","], ["identifier","cyan"], ["text",","], ["identifier","INCOMING"], ["text"," "], ["identifier","CALL"], ["text"," "], ["identifier","FROM"], ["text"," "], ["variable","%1"], ["paren.rparen",")]"], ["text",","], ["paren.lparen","["], ["support.function","play"], ["paren.lparen","(["], ["support.function","switch"], ["paren.lparen","(["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","1"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone1"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","2"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone2"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","3"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone3"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","4"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone4"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","5"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone5"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","6"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone6"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","7"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone7"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","8"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone8"], ["paren.rparen",")]"], ["text",","], ["constant.numeric","9"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","ringtone9"], ["paren.rparen",")]"], ["text",","], ["identifier","custom"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","customtone"], ["paren.rparen",")]"], ["text",","], ["identifier","vibrate"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%0"], ["keyword.operator","/"], ["identifier","vibrate"], ["paren.rparen",")])])]"] ],[ "start", ["text","&"], ["identifier","ringloop"], ["text"," "], ["identifier","phone"], ["keyword.operator","="], ["text","@"], ["support.function","switch"], ["text"," "], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","ringstate"], ["paren.rparen",")]"], ["keyword.operator","="], ["constant.numeric","1"], ["text",","], ["paren.lparen","{"], ["text","@"], ["support.function","emit"], ["text"," "], ["paren.lparen","["], ["support.function","setq"], ["paren.lparen","("], ["identifier","q"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","connecting"], ["paren.rparen",")])]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["variable","%qq"], ["text",","], ["identifier","rangs"], ["text",":"], ["constant.numeric","0"], ["paren.rparen",")]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["variable","%qq"], ["text",","], ["identifier","mode"], ["text",":"], ["identifier","WFC"], ["paren.rparen",")]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["variable","%qq"], ["text",","], ["identifier","INCOMING"], ["text",":"], ["paren.rparen",")]"], ["text",";@"], ["support.function","ifelse"], ["text"," "], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["variable","%qq"], ["keyword.operator","/"], ["identifier","HASVMB"], ["paren.rparen",")]"], ["keyword.operator","="], ["paren.lparen","{"], ["text","@"], ["support.function","tr"], ["text"," "], ["identifier","me"], ["keyword.operator","/"], ["identifier","ROUTEVMB"], ["keyword.operator","="], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","connecting"], ["paren.rparen",")]"], ["text",";"], ["paren.rparen","}"], ["text",","], ["paren.lparen","{"], ["text","@"], ["support.function","pemit"], ["text"," "], ["keyword.operator","%#="], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","MSGCNC"], ["paren.rparen",")]"], ["text",";"], ["paren.rparen","}}"], ["text",","], ["constant.numeric","2"], ["text",","], ["paren.lparen","{"], ["text","@"], ["support.function","pemit"], ["text"," "], ["keyword.operator","%#="], ["identifier","The"], ["text"," "], ["identifier","call"], ["text"," "], ["identifier","is"], ["text"," "], ["identifier","connected"], ["text","."], ["paren.lparen","["], ["support.function","setq"], ["paren.lparen","("], ["identifier","q"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","CONNECTING"], ["paren.rparen",")])]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["identifier","me"], ["text",","], ["identifier","CONNECTED"], ["text",":"], ["variable","%qq"], ["paren.rparen",")]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["variable","%qq"], ["text",","], ["identifier","CONNECTED"], ["text",":"], ["paren.lparen","["], ["support.function","num"], ["paren.lparen","("], ["identifier","me"], ["paren.rparen",")])]"], ["paren.lparen","["], ["support.function","set"], ["paren.lparen","("], ["variable","%qq"], ["text",","], ["identifier","MODE"], ["text",":"], ["identifier","CIP"], ["paren.rparen",")]"], ["text",";@"], ["support.function","tr"], ["text"," "], ["identifier","me"], ["keyword.operator","/"], ["identifier","ciploop"], ["text",";@"], ["support.function","tr"], ["text"," "], ["variable","%qq"], ["keyword.operator","/"], ["identifier","ciploop"], ["text",";"], ["paren.rparen","}"], ["text",","], ["constant.numeric","3"], ["text",","], ["paren.lparen","{"], ["text","@"], ["support.function","emit"], ["text"," "], ["identifier","On"], ["text"," "], ["paren.lparen","["], ["support.function","fullname"], ["paren.lparen","("], ["identifier","me"], ["paren.rparen",")]"], ["text","'"], ["support.function","s"], ["text"," "], ["identifier","earpiece"], ["text"," "], ["identifier","you"], ["text"," "], ["identifier","hear"], ["text"," "], ["identifier","a"], ["text"," "], ["identifier","ringing"], ["text"," "], ["identifier","sound"], ["text","."], ["paren.lparen","["], ["support.function","play"], ["paren.lparen","("], ["support.function","u"], ["paren.lparen","("], ["identifier","LINETONE"], ["paren.rparen","))]"], ["text",";@"], ["support.function","tr"], ["text"," "], ["identifier","me"], ["keyword.operator","/"], ["identifier","ringhere"], ["text",";@"], ["identifier","increment"], ["text"," "], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","connecting"], ["paren.rparen",")]"], ["keyword.operator","/"], ["identifier","RANGS"], ["text",";@"], ["identifier","wait"], ["text"," "], ["constant.numeric","5"], ["keyword.operator","="], ["paren.lparen","{"], ["text","@"], ["support.function","tr"], ["text"," "], ["identifier","me"], ["keyword.operator","/"], ["identifier","ringloop"], ["paren.rparen","}"], ["text",";"], ["paren.rparen","}"], ["text",","], ["constant.numeric","4"], ["text",","], ["paren.lparen","{"], ["paren.rparen","}"] ],[ "start", ["text","&"], ["identifier","ringstate"], ["text"," "], ["identifier","phone"], ["keyword.operator","="], ["paren.lparen","["], ["support.function","setq"], ["paren.lparen","("], ["identifier","q"], ["text",","], ["support.function","u"], ["paren.lparen","("], ["identifier","connecting"], ["paren.rparen","))]"], ["paren.lparen","["], ["support.function","setq"], ["paren.lparen","("], ["constant.numeric","1"], ["text",","], ["paren.lparen","["], ["support.function","gt"], ["paren.lparen","("], ["support.function","u"], ["paren.lparen","("], ["variable","%qq"], ["keyword.operator","/"], ["identifier","rangs"], ["paren.rparen",")"], ["text",","], ["support.function","sub"], ["paren.lparen","("], ["support.function","u"], ["paren.lparen","("], ["variable","%qq"], ["keyword.operator","/"], ["identifier","rings"], ["paren.rparen",")"], ["text",","], ["constant.numeric","1"], ["paren.rparen","))])]"], ["paren.lparen","["], ["support.function","setq"], ["paren.lparen","("], ["constant.numeric","2"], ["text",","], ["paren.lparen","["], ["support.function","and"], ["paren.lparen","("], ["support.function","u"], ["paren.lparen","("], ["identifier","is"], ["text",","], ["support.function","u"], ["paren.lparen","("], ["variable","%qq"], ["keyword.operator","/"], ["identifier","MODE"], ["paren.rparen",")"], ["text",","], ["identifier","CIP"], ["paren.rparen",")"], ["text",","], ["support.function","u"], ["paren.lparen","("], ["identifier","is"], ["text",","], ["support.function","u"], ["paren.lparen","("], ["variable","%qq"], ["keyword.operator","/"], ["identifier","INCOMING"], ["paren.rparen",")"], ["text",","], ["paren.lparen","["], ["support.function","num"], ["paren.lparen","("], ["identifier","me"], ["paren.rparen",")]))]"], ["paren.lparen","["], ["support.function","setq"], ["paren.lparen","("], ["constant.numeric","3"], ["text",","], ["paren.lparen","["], ["support.function","u"], ["paren.lparen","("], ["identifier","is"], ["text",","], ["support.function","u"], ["paren.lparen","("], ["variable","%qq"], ["keyword.operator","/"], ["identifier","MODE"], ["paren.rparen",")"], ["text",","], ["identifier","ICC"], ["paren.rparen",")])]"], ["paren.lparen","["], ["support.function","ifelse"], ["paren.lparen","("], ["variable","%q1"], ["text",","], ["constant.numeric","1"], ["text",","], ["support.function","ifelse"], ["paren.lparen","("], ["variable","%q2"], ["text",","], ["constant.numeric","2"], ["text",","], ["support.function","ifelse"], ["paren.lparen","("], ["variable","%q3"], ["text",","], ["constant.numeric","3"], ["text",","], ["constant.numeric","4"], ["paren.rparen",")))]"] ],[ "start", ["text",";"], ["identifier","comment"] ],[ "start", ["text","@@"], ["paren.lparen","("], ["identifier","comment"], ["paren.rparen",")"] ],[ "start", ["keyword","say"], ["text"," "], ["paren.lparen","["], ["support.function","time"], ["paren.lparen","("], ["paren.rparen",")]"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_mysql.json ================================================ [[ "start", ["identifier","TODO"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_nix.json ================================================ [[ "start", ["text","{"] ],[ "start", ["text"," "], ["comment","# Name of our deployment"] ],[ "start", ["text"," "], ["identifier","network"], ["text","."], ["identifier","description"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","\"HelloWorld\""], ["text",";"] ],[ "start", ["text"," "], ["comment","# Enable rolling back to previous versions of our infrastructure"] ],[ "start", ["text"," "], ["identifier","network"], ["text","."], ["identifier","enableRollback"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["constant.language.nix","true"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","# It consists of a single server named 'helloserver'"] ],[ "start", ["text"," "], ["identifier","helloserver"], ["text"," "], ["keyword.operator.assignment.nix","="] ],[ "start", ["text"," "], ["comment","# Every server gets passed a few arguments, including a reference"] ],[ "start", ["text"," "], ["comment","# to nixpkgs (pkgs)"] ],[ "start", ["text"," { "], ["identifier","config"], ["text",", "], ["identifier","pkgs"], ["text",", ... }:"] ],[ "start", ["text"," "], ["keyword.declaration.nix","let"] ],[ "start", ["text"," "], ["comment","# We import our custom packages from ./default passing pkgs as argument"] ],[ "start", ["text"," "], ["identifier","packages"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["keyword.control.nix","import"], ["text"," ./"], ["identifier","default"], ["text","."], ["identifier","nix"], ["text"," { "], ["identifier","pkgs"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["identifier","pkgs"], ["text","; };"] ],[ "start", ["text"," "], ["comment","# This is the nodejs version specified in default.nix"] ],[ "start", ["text"," "], ["identifier","nodejs"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["identifier","packages"], ["text","."], ["identifier","nodejs"], ["text",";"] ],[ "start", ["text"," "], ["comment","# And this is the application we'd like to deploy"] ],[ "start", ["text"," "], ["identifier","app"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["identifier","packages"], ["text","."], ["identifier","app"], ["text",";"] ],[ "start", ["text"," "], ["keyword.declaration.nix","in"] ],[ "start", ["text"," {"] ],[ "start", ["text"," "], ["comment","# We'll be running our application on port 8080, because a regular"] ],[ "start", ["text"," "], ["comment","# user cannot bind to port 80"] ],[ "start", ["text"," "], ["comment","# Then, using some iptables magic we'll forward traffic designated to port 80 to 8080"] ],[ "start", ["text"," "], ["identifier","networking"], ["text","."], ["identifier","firewall"], ["text","."], ["identifier","enable"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["constant.language.nix","true"], ["text",";"] ],[ "start", ["text"," "], ["comment","# We will open up port 22 (SSH) as well otherwise we're locking ourselves out"] ],[ "start", ["text"," "], ["identifier","networking"], ["text","."], ["identifier","firewall"], ["text","."], ["identifier","allowedTCPPorts"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," [ "], ["constant.numeric","80"], ["text"," "], ["constant.numeric","8080"], ["text"," "], ["constant.numeric","22"], ["text"," ];"] ],[ "start", ["text"," "], ["identifier","networking"], ["text","."], ["identifier","firewall"], ["text","."], ["identifier","allowPing"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["constant.language.nix","true"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","# Port forwarding using iptables"] ],[ "qqdoc", ["text"," "], ["identifier","networking"], ["text","."], ["identifier","firewall"], ["text","."], ["identifier","extraCommands"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","''"] ],[ "qqdoc", ["string"," iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080"] ],[ "start", ["string"," ''"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["comment","# To run our node.js program we're going to use a systemd service"] ],[ "start", ["text"," "], ["comment","# We can configure the service to automatically start on boot and to restart"] ],[ "start", ["text"," "], ["comment","# the process in case it crashes"] ],[ "start", ["text"," "], ["identifier","systemd"], ["text","."], ["identifier","services"], ["text","."], ["identifier","helloserver"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," {"] ],[ "start", ["text"," "], ["identifier","description"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","\"Hello world application\""], ["text",";"] ],[ "start", ["text"," "], ["comment","# Start the service after the network is available"] ],[ "start", ["text"," "], ["identifier","after"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," [ "], ["string","\"network.target\""], ["text"," ];"] ],[ "start", ["text"," "], ["comment","# We're going to run it on port 8080 in production"] ],[ "start", ["text"," "], ["identifier","environment"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," { "], ["identifier","PORT"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","\"8080\""], ["text","; };"] ],[ "start", ["text"," "], ["identifier","serviceConfig"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," {"] ],[ "start", ["text"," "], ["comment","# The actual command to run"] ],[ "start", ["text"," "], ["identifier","ExecStart"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","\""], ["constant.language.escape","${"], ["identifier","nodejs"], ["constant.language.escape","}"], ["string","/bin/node "], ["constant.language.escape","${"], ["identifier","app"], ["constant.language.escape","}"], ["string","/server.js\""], ["text",";"] ],[ "start", ["text"," "], ["comment","# For security reasons we'll run this process as a special 'nodejs' user"] ],[ "start", ["text"," "], ["identifier","User"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","\"nodejs\""], ["text",";"] ],[ "start", ["text"," "], ["identifier","Restart"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," "], ["string","\"always\""], ["text",";"] ],[ "start", ["text"," };"] ],[ "start", ["text"," };"] ],[ "start" ],[ "start", ["text"," "], ["comment","# And lastly we ensure the user we run our application as is created"] ],[ "start", ["text"," "], ["identifier","users"], ["text","."], ["identifier","extraUsers"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," {"] ],[ "start", ["text"," "], ["identifier","nodejs"], ["text"," "], ["keyword.operator.assignment.nix","="], ["text"," { };"] ],[ "start", ["text"," };"] ],[ "start", ["text"," };"] ],[ "start", ["text","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_nsis.json ================================================ [[ "punctuation.definition.comment.nsis", ["punctuation.definition.comment.nsis","/*"] ],[ "punctuation.definition.comment.nsis", ["comment.block.nsis"," NSIS Mode"] ],[ "punctuation.definition.comment.nsis", ["comment.block.nsis"," for Ace"] ],[ "start", ["punctuation.definition.comment.nsis","*/"] ],[ "start" ],[ "start", ["punctuation.definition.comment.nsis",";"], ["comment.line.nsis"," Includes"] ],[ "start", ["keyword.compiler.nsis","!include"], ["text"," MUI2.nsh"] ],[ "start" ],[ "start", ["punctuation.definition.comment.nsis",";"], ["comment.line.nsis"," Settings"] ],[ "start", ["keyword.command.nsis","Name"], ["text"," "], ["punctuation.definition.string.begin.nsis","\""], ["string.quoted.double.nsis","installer_name"], ["punctuation.definition.string.end.nsis","\""] ],[ "start", ["keyword.command.nsis","OutFile"], ["text"," "], ["punctuation.definition.string.begin.nsis","\""], ["string.quoted.double.nsis","installer_name.exe"], ["punctuation.definition.string.end.nsis","\""] ],[ "start", ["keyword.command.nsis","RequestExecutionLevel"], ["text"," "], ["constant.language.option.nsis","user"] ],[ "start", ["keyword.command.nsis","CRCCheck"], ["text"," "], ["constant.language.boolean.true.nsis","on"] ],[ "start", ["keyword.control.nsis","!ifdef"], ["text"," x64"] ],[ "start", ["keyword.command.nsis"," InstallDir"], ["text"," "], ["punctuation.definition.string.begin.nsis","\""], ["string.quoted.double.nsis","$PROGRAMFILES64\\installer_name"], ["punctuation.definition.string.end.nsis","\""] ],[ "start", ["keyword.control.nsis","!else"] ],[ "start", ["keyword.command.nsis"," InstallDir"], ["text"," "], ["punctuation.definition.string.begin.nsis","\""], ["string.quoted.double.nsis","$PROGRAMFILES\\installer_name"], ["punctuation.definition.string.end.nsis","\""] ],[ "start", ["keyword.control.nsis","!endif"] ],[ "start" ],[ "start", ["punctuation.definition.comment.nsis",";"], ["comment.line.nsis"," Pages"] ],[ "start", ["keyword.compiler.nsis","!insertmacro"], ["text"," MUI_PAGE_INSTFILES"] ],[ "start" ],[ "start", ["punctuation.definition.comment.nsis",";"], ["comment.line.nsis"," Sections"] ],[ "start", ["support.function.nsis","Section"], ["text"," "], ["punctuation.definition.string.begin.nsis","\""], ["string.quoted.double.nsis","section_name"], ["punctuation.definition.string.end.nsis","\""], ["text"," section_index"] ],[ "start", ["text"," "], ["punctuation.definition.comment.nsis","#"], ["comment.line.nsis"," your code here"] ],[ "start", ["support.function.nsis","SectionEnd"] ],[ "start" ],[ "start", ["punctuation.definition.comment.nsis",";"], ["comment.line.nsis"," Functions"] ],[ "start", ["support.function.nsis","Function"], ["text"," .onInit"] ],[ "start", ["keyword.command.nsis"," MessageBox"], ["text"," "], ["constant.nsis","MB_OK"], ["text"," "], ["punctuation.definition.string.begin.nsis","\""], ["string.quoted.double.nsis","Here comes a"], ["constant.character.escape.nsis","$\\n$\\r"], ["string.quoted.double.nsis","line-break!"], ["punctuation.definition.string.end.nsis","\""] ],[ "start", ["support.function.nsis","FunctionEnd"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_objectivec.json ================================================ [[ "start", ["storage.type.objc","@"], ["punctuation.definition.storage.type.objc","protocol"], ["entity.name.type.objc"," Printing"], ["text",": "], ["entity.other.inherited-class.objc","someParent"] ],[ "start", ["meta.function.objc","-"], ["paren.lparen","("], ["storage.type","void"], ["paren.rparen",")"], ["text"," "], ["identifier","print"], ["punctuation.operator",";"] ],[ "start", ["storage.type.objc","@end"] ],[ "start" ],[ "start", ["storage.type.objc","@"], ["punctuation.definition.storage.type.objc","interface"], ["entity.name.type.objc"," Fraction"], ["text",": "], ["entity.other.inherited-class.objc","NSObject"], ["text"," "], ["keyword.operator","<"], ["identifier","Printing"], ["punctuation.operator",","], ["text"," "], ["support.class.cocoa","NSCopying"], ["keyword.operator",">"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","int"], ["text"," "], ["identifier","numerator"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["storage.type","int"], ["text"," "], ["identifier","denominator"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["storage.type.objc","@end"] ],[ "start" ],[ "start", ["string.begin.objc","@\""], ["string","blah"], ["invalid.illegal.unknown-escape.objc","\\8"], ["punctuation.definition.string.end","\""], ["text"," "], ["string.begin.objc","@\""], ["string","a"], ["constant.character.escape.objc","\\222"], ["string","sd"], ["invalid.illegal.unknown-escape.objc","\\d"], ["punctuation.definition.string.end","\""], ["text"," "], ["string.begin.objc","@\""], ["constant.character.escape.objc","\\f"], ["string","aw"], ["constant.character.escape.objc","\\\"\\?"], ["string"," "], ["constant.character.escape.objc","\\'"], ["string"," "], ["constant.character.escape.objc","\\4"], ["string"," n"], ["constant.character.escape.objc","\\\\"], ["punctuation.definition.string.end","\""], ["text"," "], ["string.begin.objc","@\""], ["constant.character.escape.objc","\\56"], ["punctuation.definition.string.end","\""] ],[ "start", ["string.begin.objc","@\""], ["constant.character.escape.objc","\\xSF42"], ["punctuation.definition.string.end","\""] ],[ "start" ],[ "start", ["meta.function.objc","-"], ["paren.lparen","("], ["support.class.cocoa","NSDecimalNumber"], ["keyword.operator","*"], ["paren.rparen",")"], ["identifier","addCount"], ["punctuation.operator",":"], ["paren.lparen","("], ["storage.type.id.objc","id"], ["paren.rparen",")"], ["identifier","addObject"], ["paren.lparen","{"] ],[ "start" ],[ "start", ["keyword.control","return"], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["identifier","count"], ["text"," "], ["support.function.any-method.objc","decimalNumberByAdding:"], ["identifier","addObject"], ["punctuation.operator","."], ["identifier","count"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.macro.objc","NS_DURING"], ["text"," "], ["keyword.control.macro.objc","NS_HANDLER"], ["text"," "], ["keyword.control.macro.objc","NS_ENDHANDLER"] ],[ "start" ],[ "start", ["punctuation.definition.keyword.objc","@"], ["keyword.control.exception.objc","try"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.control","if"], ["text"," "], ["paren.lparen","("], ["identifier","argc"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","1"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["punctuation.definition.keyword.objc","@"], ["keyword.control.exception.objc","throw"], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSException"], ["text"," "], ["support.function.any-method.objc","exceptionWithName:"], ["string.begin.objc","@\""], ["string","Throwing a test exception"], ["punctuation.definition.string.end","\""], ["text"," "], ["identifier","reason"], ["punctuation.operator",":"], ["string.begin.objc","@\""], ["string","Testing the @throw directive."], ["punctuation.definition.string.end","\""], ["text"," "], ["identifier","userInfo"], ["punctuation.operator",":"], ["constant.language.objc","nil"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"], ["text"," "] ],[ "start", ["punctuation.definition.keyword.objc","@"], ["keyword.control.exception.objc","catch"], ["text"," "], ["paren.lparen","("], ["storage.type.id.objc","id"], ["text"," "], ["identifier","theException"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function.cocoa","NSLog"], ["paren.lparen","("], ["string.begin.objc","@\""], ["string","%@"], ["punctuation.definition.string.end","\""], ["punctuation.operator",","], ["text"," "], ["identifier","theException"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["identifier","result"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"], ["text"," "] ],[ "start", ["punctuation.definition.keyword.objc","@"], ["keyword.control.exception.objc","finally"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function.cocoa","NSLog"], ["paren.lparen","("], ["string.begin.objc","@\""], ["string","This always happens."], ["punctuation.definition.string.end","\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["identifier","result"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["constant.numeric","2"], ["text"," "], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.storage.modifier.objc","@"], ["storage.modifier.objc","synchronized"], ["paren.lparen","("], ["identifier","lock"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function.cocoa","NSLog"], ["paren.lparen","("], ["string.begin.objc","@\""], ["string","Hello World"], ["punctuation.definition.string.end","\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.type","struct"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["punctuation.definition.keyword.objc","@"], ["keyword.other.objc","defs"], ["paren.lparen","("], ["text"," "], ["support.class.cocoa","NSObject"], ["paren.rparen",")"], ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["storage.type","char"], ["text"," "], ["keyword.operator","*"], ["identifier","enc1"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.definition.keyword.objc","@"], ["keyword.other.objc","encode"], ["paren.lparen","("], ["storage.type","int"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["storage.type.objc","IBOutlet"], ["keyword.operator","|"], ["storage.type.objc","IBAction"], ["keyword.operator","|"], ["storage.type.objc","BOOL"], ["keyword.operator","|"], ["storage.type.objc","SEL"], ["keyword.operator","|"], ["storage.type.id.objc","id"], ["keyword.operator","|"], ["storage.type.objc","unichar"], ["keyword.operator","|"], ["storage.type.objc","IMP"], ["keyword.operator","|"], ["storage.type.objc","Class"], ["text"," "] ],[ "start" ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.storage.type.objc","@"], ["storage.type.objc","class"], ["text"," "], ["punctuation.definition.storage.type.objc","@"], ["storage.type.objc","protocol"] ],[ "start" ],[ "start", ["punctuation.definition.storage.modifier.objc","@"], ["storage.modifier.objc","public"] ],[ "start", ["text"," "], ["comment","// instance variables"] ],[ "start", ["punctuation.definition.storage.modifier.objc","@"], ["storage.modifier.objc","package"] ],[ "start", ["text"," "], ["comment","// instance variables"] ],[ "start", ["punctuation.definition.storage.modifier.objc","@"], ["storage.modifier.objc","protected"] ],[ "start", ["text"," "], ["comment","// instance variables"] ],[ "start", ["punctuation.definition.storage.modifier.objc","@"], ["storage.modifier.objc","private"] ],[ "start", ["text"," "], ["comment","// instance variables"] ],[ "start" ],[ "start", ["text"," "], ["constant.language.objc","YES"], ["text"," "], ["constant.language.objc","NO"], ["text"," "], ["constant.language.objc","Nil"], ["text"," "], ["constant.language.objc","nil"] ],[ "start", ["support.variable.foundation","NSApp"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["support.function.cocoa.leopard","NSRectToCGRect"], ["text"," "], ["paren.lparen","("], ["identifier","Protocol"], ["text"," "], ["identifier","ProtocolFromString"], ["punctuation.operator",":"], ["string.start","\""], ["string","NSTableViewDelegate"], ["string.end","\""], ["paren.rparen","))"] ],[ "start" ],[ "start", ["punctuation.section.scope.begin.objc","["], ["identifier","SPPoint"], ["text"," "], ["support.function.any-method.objc","pointFromCGPoint:"], ["identifier","self"], ["punctuation.operator","."], ["identifier","position"], ["paren.rparen","]"] ],[ "start" ],[ "start", ["support.function.cocoa","NSRoundDownToMultipleOfPageSize"] ],[ "start" ],[ "start", ["keyword","#import"], ["constant.other"," "] ],[ "start" ],[ "start", ["storage.type","int"], ["text"," "], ["identifier","main"], ["paren.lparen","("], ["text"," "], ["storage.type","int"], ["text"," "], ["identifier","argc"], ["punctuation.operator",","], ["text"," "], ["storage.modifier","const"], ["text"," "], ["storage.type","char"], ["text"," "], ["keyword.operator","*"], ["identifier","argv"], ["punctuation.section.scope.begin.objc","["], ["punctuation.section.scope.end.objc","]"], ["text"," "], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function.C99.c","printf"], ["paren.lparen","("], ["text"," "], ["string.start","\""], ["string","hello world"], ["constant.language.escape","\\n"], ["string.end","\""], ["text"," "], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.control","return"], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["support.class.cocoa","NSChangeSpelling"] ],[ "start" ],[ "start", ["string.begin.objc","@\""], ["string","0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"], ["punctuation.definition.string.end","\""] ],[ "start" ],[ "start", ["punctuation.definition.storage.type.objc","@selector"], ["punctuation","("], ["support.function.any-method.name-of-parameter.objc","lowercaseString"], ["punctuation",")"], ["text"," "], ["punctuation.definition.storage.type.objc","@selector"], ["punctuation","("], ["support.function.any-method.name-of-parameter.objc","uppercaseString:"], ["punctuation",")"] ],[ "start" ],[ "start", ["identifier","NSFetchRequest"], ["text"," "], ["keyword.operator","*"], ["identifier","localRequest"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","[["], ["identifier","NSFetchRequest"], ["text"," "], ["support.function.any-method.objc","alloc"], ["paren.rparen","]"], ["text"," "], ["identifier","init"], ["paren.rparen","]"], ["punctuation.operator",";"], ["text"," "] ],[ "start", ["identifier","localRequest"], ["punctuation.operator","."], ["identifier","entity"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["identifier","NSEntityDescription"], ["text"," "], ["support.function.any-method.objc","entityForName:"], ["string.begin.objc","@\""], ["string","VNSource"], ["punctuation.definition.string.end","\""], ["text"," "], ["identifier","inManagedObjectContext"], ["punctuation.operator",":"], ["identifier","context"], ["paren.rparen","]"], ["punctuation.operator",";"], ["text"," "] ],[ "start", ["identifier","localRequest"], ["punctuation.operator","."], ["identifier","sortDescriptors"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSArray"], ["text"," "], ["support.function.any-method.objc","arrayWithObject:"], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSSortDescriptor"], ["text"," "], ["support.function.any-method.objc","sortDescriptorWithKey:"], ["string.begin.objc","@\""], ["string","resolution"], ["punctuation.definition.string.end","\""], ["text"," "], ["identifier","ascending"], ["punctuation.operator",":"], ["constant.language.objc","YES"], ["paren.rparen","]]"], ["punctuation.operator",";"], ["text"," "] ],[ "start", ["support.class.cocoa","NSPredicate"], ["text"," "], ["keyword.operator","*"], ["identifier","predicate"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSPredicate"], ["text"," "], ["support.function.any-method.objc","predicateWithFormat:"], ["string.begin.objc","@\""], ["string","0 != SUBQUERY(image, $x, 0 != SUBQUERY($x.bookmarkItems, $y, $y.@count == 0).@count).@count"], ["punctuation.definition.string.end","\""], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSPredicate"], ["text"," "], ["support.function.any-method.objc","predicateWithFormat:"], ["paren.rparen","]"] ],[ "start", ["support.class.cocoa","NSString"], ["text"," "], ["keyword.operator","*"], ["identifier","predicateString"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSString"], ["text"," "], ["support.function.any-method.objc","stringWithFormat:"], ["string.begin.objc","@\""], ["string","SELF beginsWith[cd] %@"], ["punctuation.definition.string.end","\""], ["punctuation.operator",","], ["text"," "], ["identifier","searchString"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["support.class.cocoa","NSPredicate"], ["text"," "], ["keyword.operator","*"], ["identifier","pred"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSPredicate"], ["text"," "], ["support.function.any-method.objc","predicateWithFormat:"], ["identifier","predicateString"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["support.class.cocoa","NSArray"], ["text"," "], ["keyword.operator","*"], ["identifier","filteredKeys"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","[["], ["identifier","myMutableDictionary"], ["text"," "], ["support.function.any-method.objc","allKeys"], ["paren.rparen","]"], ["text"," "], ["identifier","filteredArrayUsingPredicate"], ["punctuation.operator",":"], ["identifier","pred"], ["paren.rparen","]"], ["punctuation.operator",";"], ["text"," "] ],[ "start" ],[ "start", ["identifier","localRequest"], ["punctuation.operator","."], ["identifier","predicate"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["support.class.cocoa","NSPredicate"], ["text"," "], ["support.function.any-method.objc","predicateWithFormat:"], ["string.begin.objc","@\""], ["string","whichChart = %@"], ["punctuation.definition.string.end","\""], ["text"," "], ["identifier","argumentArray"], ["punctuation.operator",":"], ["text"," "], ["identifier","listChartToDownload"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["identifier","localRequest"], ["punctuation.operator","."], ["identifier","fetchBatchSize"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","100"], ["punctuation.operator",";"] ],[ "start", ["identifier","arrayRequest"], ["text"," "], ["keyword.operator","="], ["text"," "], ["punctuation.section.scope.begin.objc","["], ["identifier","context"], ["text"," "], ["support.function.any-method.objc","executeFetchRequest:"], ["identifier","localRequest"], ["text"," "], ["identifier","error"], ["punctuation.operator",":"], ["keyword.operator","&"], ["identifier","error1"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["punctuation.section.scope.begin.objc","["], ["identifier","localRequest"], ["text"," "], ["support.function.any-method.objc","release"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","#ifndef"], ["text"," "], ["constant.language.objc","Nil"] ],[ "start", ["keyword","#define"], ["constant.other"," Nil __DARWIN_NULL "], ["comment","/* id of Nil class */"] ],[ "start", ["keyword","#endif"] ],[ "start" ],[ "start", ["storage.type.objc","@implementation"], ["entity.name.type.objc"," MyObject"] ],[ "start", ["meta.function.objc","- "], ["paren.lparen","("], ["storage.type","unsigned"], ["text"," "], ["storage.type","int"], ["paren.rparen",")"], ["identifier","areaOfWidth"], ["punctuation.operator",":"], ["paren.lparen","("], ["storage.type","unsigned"], ["text"," "], ["storage.type","int"], ["paren.rparen",")"], ["identifier","width"] ],[ "start", ["text"," "], ["identifier","height"], ["punctuation.operator",":"], ["paren.lparen","("], ["storage.type","unsigned"], ["text"," "], ["storage.type","int"], ["paren.rparen",")"], ["identifier","height"] ],[ "start", ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.control","return"], ["text"," "], ["identifier","width"], ["keyword.operator","*"], ["identifier","height"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start", ["storage.type.objc","@end"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_ocaml.json ================================================ [[ "comment", ["comment","(*"] ],[ "comment", ["comment"," * Example of early return implementation taken from"] ],[ "comment", ["comment"," * http://ocaml.janestreet.com/?q=node/91"] ],[ "start", ["comment"," *)"] ],[ "start" ],[ "start", ["keyword","let"], ["text"," "], ["identifier","with_return"], ["text"," "], ["paren.lparen","("], ["keyword","type"], ["text"," "], ["identifier","t"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","("], ["identifier","f"], ["text"," : "], ["identifier","_"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","t"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["keyword","module"], ["text"," "], ["identifier","M"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["keyword","struct"], ["text"," "], ["keyword","exception"], ["text"," "], ["identifier","Return"], ["text"," "], ["keyword","of"], ["text"," "], ["identifier","t"], ["text"," "], ["keyword","end"] ],[ "start", ["text"," "], ["keyword","in"] ],[ "start", ["text"," "], ["keyword","let"], ["text"," "], ["identifier","return"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","return"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["keyword","fun"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["support.function","raise"], ["text"," "], ["paren.lparen","("], ["identifier","M"], ["text","."], ["identifier","Return"], ["text"," "], ["identifier","x"], ["paren.rparen","))"], ["text","; "], ["paren.rparen","}"], ["text"," "], ["keyword","in"] ],[ "start", ["text"," "], ["keyword","try"], ["text"," "], ["identifier","f"], ["text"," "], ["identifier","return"], ["text"," "], ["keyword","with"], ["text"," "], ["identifier","M"], ["text","."], ["identifier","Return"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","x"] ],[ "start" ],[ "start" ],[ "start", ["comment","(* Function that uses the 'early return' functionality provided by `with_return` *)"] ],[ "start", ["keyword","let"], ["text"," "], ["identifier","sum_until_first_negative"], ["text"," "], ["support.function","list"], ["text"," "], ["keyword.operator","="] ],[ "start", ["text"," "], ["identifier","with_return"], ["text"," "], ["paren.lparen","("], ["keyword","fun"], ["text"," "], ["identifier","r"], ["text"," "], ["keyword.operator","->"] ],[ "start", ["text"," "], ["support.function","List"], ["text","."], ["support.function","fold"], ["text"," "], ["support.function","list"], ["text"," "], ["keyword.operator","~"], ["support.function","init"], ["text",":"], ["constant.numeric","0"], ["text"," "], ["keyword.operator","~"], ["identifier","f"], ["text",":"], ["paren.lparen","("], ["keyword","fun"], ["text"," "], ["identifier","acc"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator","->"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword","then"], ["text"," "], ["identifier","acc"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword","else"], ["text"," "], ["identifier","r"], ["text","."], ["identifier","return"], ["text"," "], ["identifier","acc"], ["paren.rparen","))"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_pascal.json ================================================ [[ "punctuation.definition.comment.pascal", ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one","****************************************************************************"] ],[ "punctuation.definition.comment.pascal", ["comment.block.pascal.one"," * A simple bubble sort program. Reads integers, one per line, and prints *"] ],[ "punctuation.definition.comment.pascal", ["comment.block.pascal.one"," * them out in sorted order. Blows up if there are more than 49. *"] ],[ "start", ["comment.block.pascal.one"," ****************************************************************************"], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["keyword.control.pascal","PROGRAM"], ["text"," Sort(input"], ["keyword.operator",","], ["text"," output)"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control.pascal","CONST"] ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Max array size. "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," MaxElts "], ["keyword.operator","="], ["text"," "], ["constant.numeric.pascal","50"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control.pascal","TYPE"], ["text"," "] ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Type of the element array. "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," IntArrType "], ["keyword.operator","="], ["text"," "], ["keyword.control.pascal","ARRAY"], ["text"," ["], ["constant.numeric.pascal","1"], ["text","..MaxElts] "], ["keyword.control.pascal","OF"], ["text"," Integer"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.pascal","VAR"] ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Indexes, exchange temp, array size. "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," i"], ["keyword.operator",","], ["text"," j"], ["keyword.operator",","], ["text"," tmp"], ["keyword.operator",","], ["text"," size: integer"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Array of ints "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," arr: IntArrType"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Read in the integers. "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," "], ["variable.pascal","PROCEDURE"], ["text"," "], ["storage.type.function.pascal","ReadArr"], ["text","("], ["keyword.control.pascal","VAR"], ["text"," size: Integer"], ["keyword.operator",";"], ["text"," "], ["keyword.control.pascal","VAR"], ["text"," a: IntArrType)"], ["keyword.operator",";"], ["text"," "] ],[ "start", ["text"," "], ["keyword.control.pascal","BEGIN"] ],[ "start", ["text"," size "], ["keyword.operator",":="], ["text"," "], ["constant.numeric.pascal","1"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control.pascal","WHILE"], ["text"," "], ["keyword.control.pascal","NOT"], ["text"," eof "], ["keyword.control.pascal","DO"], ["text"," "], ["keyword.control.pascal","BEGIN"] ],[ "start", ["text"," readln(a[size])"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control.pascal","IF"], ["text"," "], ["keyword.control.pascal","NOT"], ["text"," eof "], ["keyword.control.pascal","THEN"], ["text"," "] ],[ "start", ["text"," size "], ["keyword.operator",":="], ["text"," size "], ["keyword.operator","+"], ["text"," "], ["constant.numeric.pascal","1"] ],[ "start", ["text"," "], ["keyword.control.pascal","END"] ],[ "start", ["text"," "], ["keyword.control.pascal","END"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.pascal","BEGIN"] ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Read "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," ReadArr(size"], ["keyword.operator",","], ["text"," arr)"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Sort using bubble sort. "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," "], ["keyword.control.pascal","FOR"], ["text"," i "], ["keyword.operator",":="], ["text"," size "], ["keyword.operator","-"], ["text"," "], ["constant.numeric.pascal","1"], ["text"," DOWNTO "], ["constant.numeric.pascal","1"], ["text"," "], ["keyword.control.pascal","DO"] ],[ "start", ["text"," "], ["keyword.control.pascal","FOR"], ["text"," j "], ["keyword.operator",":="], ["text"," "], ["constant.numeric.pascal","1"], ["text"," "], ["keyword.control.pascal","TO"], ["text"," i "], ["keyword.control.pascal","DO"], ["text"," "] ],[ "start", ["text"," "], ["keyword.control.pascal","IF"], ["text"," arr[j] > arr[j "], ["keyword.operator","+"], ["text"," "], ["constant.numeric.pascal","1"], ["text","] "], ["keyword.control.pascal","THEN"], ["text"," "], ["keyword.control.pascal","BEGIN"] ],[ "start", ["text"," tmp "], ["keyword.operator",":="], ["text"," arr[j]"], ["keyword.operator",";"] ],[ "start", ["text"," arr[j] "], ["keyword.operator",":="], ["text"," arr[j "], ["keyword.operator","+"], ["text"," "], ["constant.numeric.pascal","1"], ["text","]"], ["keyword.operator",";"] ],[ "start", ["text"," arr[j "], ["keyword.operator","+"], ["text"," "], ["constant.numeric.pascal","1"], ["text","] "], ["keyword.operator",":="], ["text"," tmp"], ["keyword.operator",";"] ],[ "start", ["text"," "], ["keyword.control.pascal","END"], ["keyword.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["punctuation.definition.comment.pascal","(*"], ["comment.block.pascal.one"," Print. "], ["punctuation.definition.comment.pascal","*)"] ],[ "start", ["text"," "], ["keyword.control.pascal","FOR"], ["text"," i "], ["keyword.operator",":="], ["text"," "], ["constant.numeric.pascal","1"], ["text"," "], ["keyword.control.pascal","TO"], ["text"," size "], ["keyword.control.pascal","DO"] ],[ "start", ["text"," writeln(arr[i])"] ],[ "start", ["text"," "], ["keyword.control.pascal","END"], ["text","."] ],[ "start", ["text"," "] ]] ================================================ FILE: lib/ace/mode/_test/tokens_perl.json ================================================ [[ "start", ["comment","#!/usr/bin/perl"] ],[ "block_comment", ["comment.doc","=begin"] ],[ "block_comment", ["comment.doc"," perl example code for Ace"] ],[ "start", ["comment.doc","=cut"] ],[ "start" ],[ "start", ["keyword","use"], ["text"," "], ["identifier","strict"], ["text",";"] ],[ "start", ["keyword","use"], ["text"," "], ["identifier","warnings"], ["text",";"] ],[ "start", ["keyword","my"], ["text"," "], ["identifier","$num_primes"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["text",";"] ],[ "start", ["keyword","my"], ["text"," @"], ["identifier","primes"], ["text",";"] ],[ "start" ],[ "start", ["comment","# Put 2 as the first prime so we won't have an empty array"] ],[ "start", ["identifier","$primes"], ["lparen","["], ["identifier","$num_primes"], ["rparen","]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["identifier","$num_primes"], ["keyword.operator","++"], ["text",";"] ],[ "start" ],[ "start", ["identifier","MAIN_LOOP"], ["text",":"] ],[ "start", ["keyword","for"], ["text"," "], ["keyword","my"], ["text"," "], ["identifier","$number_to_check"], ["text"," "], ["lparen","("], ["constant.numeric","3"], ["text"," "], ["keyword.operator",".."], ["text"," "], ["constant.numeric","200"], ["rparen",")"] ],[ "start", ["lparen","{"] ],[ "start", ["text"," "], ["keyword","for"], ["text"," "], ["keyword","my"], ["text"," "], ["identifier","$p"], ["text"," "], ["lparen","("], ["constant.numeric","0"], ["text"," "], ["keyword.operator",".."], ["text"," "], ["lparen","("], ["identifier","$num_primes"], ["constant.numeric","-1"], ["rparen","))"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","$number_to_check"], ["text"," "], ["keyword.operator","%"], ["text"," "], ["identifier","$primes"], ["lparen","["], ["identifier","$p"], ["rparen","]"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["rparen",")"] ],[ "start", ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","next"], ["text"," "], ["identifier","MAIN_LOOP"], ["text",";"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start" ],[ "start", ["text"," "], ["comment","# If we reached this point it means $number_to_check is not"] ],[ "start", ["text"," "], ["comment","# divisable by any prime number that came before it."] ],[ "start", ["text"," "], ["identifier","$primes"], ["lparen","["], ["identifier","$num_primes"], ["rparen","]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","$number_to_check"], ["text",";"] ],[ "start", ["text"," "], ["identifier","$num_primes"], ["keyword.operator","++"], ["text",";"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","for"], ["text"," "], ["keyword","my"], ["text"," "], ["identifier","$p"], ["text"," "], ["lparen","("], ["constant.numeric","0"], ["text"," "], ["keyword.operator",".."], ["text"," "], ["lparen","("], ["identifier","$num_primes"], ["constant.numeric","-1"], ["rparen","))"] ],[ "start", ["lparen","{"] ],[ "start", ["text"," "], ["support.function","print"], ["text"," "], ["identifier","$primes"], ["lparen","["], ["identifier","$p"], ["rparen","]"], ["keyword.operator",","], ["text"," "], ["string","\", \""], ["text",";"] ],[ "start", ["rparen","}"] ],[ "start", ["support.function","print"], ["text"," "], ["string","\"\\n\""], ["text",";"] ],[ "start" ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_pgsql.json ================================================ [[ "start" ],[ "start", ["keyword.statementBegin","BEGIN"], ["statementEnd",";"] ],[ "start" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc","* Samples from PostgreSQL src/tutorial/basics.source"] ],[ "start", ["comment.doc","*/"] ],[ "statement", ["keyword.statementBegin","CREATE"], ["text"," "], ["keyword","TABLE"], ["text"," "], ["identifier","weather"], ["text"," "], ["paren.lparen","("] ],[ "statement", ["text","\t"], ["identifier","city"], ["text","\t\t"], ["keyword","varchar"], ["paren.lparen","("], ["constant.numeric","80"], ["paren.rparen",")"], ["text",","] ],[ "statement", ["text","\t"], ["identifier","temp_lo"], ["text","\t\t"], ["keyword","int"], ["text",",\t\t"], ["comment","-- low temperature"] ],[ "statement", ["text","\t"], ["identifier","temp_hi"], ["text","\t\t"], ["keyword","int"], ["text",",\t\t"], ["comment","-- high temperature"] ],[ "statement", ["text","\t"], ["identifier","prcp"], ["text","\t\t"], ["keyword","real"], ["text",",\t\t"], ["comment","-- precipitation"] ],[ "statement", ["text","\t"], ["variable.language","\"date\""], ["text","\t\t"], ["keyword","date"] ],[ "start", ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "statement", ["keyword.statementBegin","CREATE"], ["text"," "], ["keyword","TABLE"], ["text"," "], ["identifier","cities"], ["text"," "], ["paren.lparen","("] ],[ "statement", ["text","\t"], ["keyword","name"], ["text","\t\t"], ["keyword","varchar"], ["paren.lparen","("], ["constant.numeric","80"], ["paren.rparen",")"], ["text",","] ],[ "statement", ["text","\t"], ["keyword","location"], ["text","\t"], ["keyword","point"] ],[ "start", ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "start" ],[ "statement", ["keyword.statementBegin","INSERT"], ["text"," "], ["keyword","INTO"], ["text"," "], ["identifier","weather"] ],[ "start", ["text"," "], ["keyword","VALUES"], ["text"," "], ["paren.lparen","("], ["string","'San Francisco'"], ["text",", "], ["constant.numeric","46"], ["text",", "], ["constant.numeric","50"], ["text",", "], ["constant.numeric","0.25"], ["text",", "], ["string","'1994-11-27'"], ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "statement", ["keyword.statementBegin","INSERT"], ["text"," "], ["keyword","INTO"], ["text"," "], ["identifier","cities"] ],[ "start", ["text"," "], ["keyword","VALUES"], ["text"," "], ["paren.lparen","("], ["string","'San Francisco'"], ["text",", "], ["string","'(-194.0, 53.0)'"], ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "statement", ["keyword.statementBegin","INSERT"], ["text"," "], ["keyword","INTO"], ["text"," "], ["identifier","weather"], ["text"," "], ["paren.lparen","("], ["identifier","city"], ["text",", "], ["identifier","temp_lo"], ["text",", "], ["identifier","temp_hi"], ["text",", "], ["identifier","prcp"], ["text",", "], ["variable.language","\"date\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","VALUES"], ["text"," "], ["paren.lparen","("], ["string","'San Francisco'"], ["text",", "], ["constant.numeric","43"], ["text",", "], ["constant.numeric","57"], ["text",", "], ["constant.numeric","0.0"], ["text",", "], ["string","'1994-11-29'"], ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "statement", ["keyword.statementBegin","INSERT"], ["text"," "], ["keyword","INTO"], ["text"," "], ["identifier","weather"], ["text"," "], ["paren.lparen","("], ["keyword","date"], ["text",", "], ["identifier","city"], ["text",", "], ["identifier","temp_hi"], ["text",", "], ["identifier","temp_lo"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","VALUES"], ["text"," "], ["paren.lparen","("], ["string","'1994-11-29'"], ["text",", "], ["string","'Hayward'"], ["text",", "], ["constant.numeric","54"], ["text",", "], ["constant.numeric","37"], ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "start" ],[ "start", ["keyword.statementBegin","SELECT"], ["text"," "], ["identifier","city"], ["text",", "], ["paren.lparen","("], ["identifier","temp_hi"], ["keyword.operator","+"], ["identifier","temp_lo"], ["paren.rparen",")"], ["keyword.operator","/"], ["constant.numeric","2"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","temp_avg"], ["text",", "], ["variable.language","\"date\""], ["text"," "], ["keyword","FROM"], ["text"," "], ["identifier","weather"], ["statementEnd",";"] ],[ "start" ],[ "statement", ["keyword.statementBegin","SELECT"], ["text"," "], ["identifier","city"], ["text",", "], ["identifier","temp_lo"], ["text",", "], ["identifier","temp_hi"], ["text",", "], ["identifier","prcp"], ["text",", "], ["variable.language","\"date\""], ["text",", "], ["keyword","location"] ],[ "statement", ["text"," "], ["keyword","FROM"], ["text"," "], ["identifier","weather"], ["text",", "], ["identifier","cities"] ],[ "start", ["text"," "], ["keyword","WHERE"], ["text"," "], ["identifier","city"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","name"], ["statementEnd",";"] ],[ "start" ],[ "start" ],[ "start" ],[ "doc-start", ["comment.doc","/**"] ],[ "doc-start", ["comment.doc","* Dollar quotes starting at the end of the line are colored as SQL unless"] ],[ "doc-start", ["comment.doc","* a special language tag is used. Dollar quote syntax coloring is implemented"] ],[ "doc-start", ["comment.doc","* for Perl, Python, JavaScript, and Json."] ],[ "start", ["comment.doc","*/"] ],[ "statement", ["keyword.statementBegin","create"], ["text"," "], ["keyword","or"], ["text"," "], ["keyword","replace"], ["text"," "], ["keyword","function"], ["text"," "], ["identifier","blob_content_chunked"], ["paren.lparen","("] ],[ "statement", ["text"," "], ["keyword","in"], ["text"," "], ["identifier","p_data"], ["text"," "], ["keyword","bytea"], ["text",", "] ],[ "statement", ["text"," "], ["keyword","in"], ["text"," "], ["identifier","p_chunk"], ["text"," "], ["keyword","integer"], ["paren.rparen",")"] ],[ "dollarSql", ["keyword","returns"], ["text"," "], ["keyword","setof"], ["text"," "], ["keyword","bytea"], ["text"," "], ["keyword","as"], ["text"," "], ["string","$$"] ],[ "dollarSql", ["comment","-- Still SQL comments"] ],[ "dollarSql", ["keyword","declare"] ],[ "dollarSql", ["text","\t"], ["identifier","v_size"], ["text"," "], ["keyword","integer"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","octet_length"], ["paren.lparen","("], ["identifier","p_data"], ["paren.rparen",")"], ["text",";"] ],[ "dollarSql", ["keyword","begin"] ],[ "dollarSql", ["text","\t"], ["keyword","for"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword","in"], ["text"," "], ["constant.numeric","1"], ["text",".."], ["identifier","v_size"], ["text"," "], ["keyword","by"], ["text"," "], ["identifier","p_chunk"], ["text"," "], ["identifier","loop"] ],[ "dollarSql", ["text","\t\t"], ["identifier","return"], ["text"," "], ["keyword","next"], ["text"," "], ["keyword","substring"], ["paren.lparen","("], ["identifier","p_data"], ["text"," "], ["keyword","from"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword","for"], ["text"," "], ["identifier","p_chunk"], ["paren.rparen",")"], ["text",";"] ],[ "dollarSql", ["text","\t"], ["keyword","end"], ["text"," "], ["identifier","loop"], ["text",";"] ],[ "dollarSql", ["keyword","end"], ["text",";"] ],[ "start", ["string","$$"], ["text"," "], ["keyword","language"], ["text"," "], ["identifier","plpgsql"], ["text"," "], ["keyword","stable"], ["statementEnd",";"] ],[ "start" ],[ "start" ],[ "start", ["comment","-- pl/perl"] ],[ "perl-start", ["keyword.statementBegin","CREATE"], ["text"," "], ["keyword","FUNCTION"], ["text"," "], ["identifier","perl_max"], ["text"," "], ["paren.lparen","("], ["keyword","integer"], ["text",", "], ["keyword","integer"], ["paren.rparen",")"], ["text"," "], ["keyword","RETURNS"], ["text"," "], ["keyword","integer"], ["text"," "], ["keyword","AS"], ["text"," "], ["string","$perl$"] ],[ "perl-start", ["text"," "], ["comment","# perl comment..."] ],[ "perl-start", ["text"," "], ["keyword","my"], ["text"," "], ["lparen","("], ["identifier","$x"], ["keyword.operator",","], ["identifier","$y"], ["rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," @"], ["identifier","_"], ["text",";"] ],[ "perl-start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["keyword.operator","!"], ["text"," "], ["support.function","defined"], ["text"," "], ["identifier","$x"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "perl-start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["keyword.operator","!"], ["text"," "], ["support.function","defined"], ["text"," "], ["identifier","$y"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["support.function","return"], ["text"," "], ["support.function","undef"], ["text","; "], ["rparen","}"] ],[ "perl-start", ["text"," "], ["support.function","return"], ["text"," "], ["identifier","$y"], ["text",";"] ],[ "perl-start", ["text"," "], ["rparen","}"] ],[ "perl-start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["keyword.operator","!"], ["text"," "], ["support.function","defined"], ["text"," "], ["identifier","$y"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["support.function","return"], ["text"," "], ["identifier","$x"], ["text","; "], ["rparen","}"] ],[ "perl-start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["identifier","$x"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["identifier","$y"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["support.function","return"], ["text"," "], ["identifier","$x"], ["text","; "], ["rparen","}"] ],[ "perl-start", ["text"," "], ["support.function","return"], ["text"," "], ["identifier","$y"], ["text",";"] ],[ "start", ["string","$perl$"], ["text"," "], ["keyword","LANGUAGE"], ["text"," "], ["identifier","plperl"], ["statementEnd",";"] ],[ "start" ],[ "start", ["comment","-- pl/python"] ],[ "python-start", ["keyword.statementBegin","CREATE"], ["text"," "], ["keyword","FUNCTION"], ["text"," "], ["identifier","usesavedplan"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["keyword","RETURNS"], ["text"," "], ["keyword","trigger"], ["text"," "], ["keyword","AS"], ["text"," "], ["string","$python$"] ],[ "python-start", ["text"," "], ["comment","# python comment..."] ],[ "python-start", ["text"," "], ["keyword","if"], ["text"," "], ["identifier","SD"], ["text","."], ["identifier","has_key"], ["paren.lparen","("], ["string","\"plan\""], ["paren.rparen",")"], ["text",":"] ],[ "python-start", ["text"," "], ["identifier","plan"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","SD"], ["paren.lparen","["], ["string","\"plan\""], ["paren.rparen","]"] ],[ "python-start", ["text"," "], ["keyword","else"], ["text",":"] ],[ "python-start", ["text"," "], ["identifier","plan"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","plpy"], ["text","."], ["identifier","prepare"], ["paren.lparen","("], ["string","\"SELECT 1\""], ["paren.rparen",")"] ],[ "python-start", ["text"," "], ["identifier","SD"], ["paren.lparen","["], ["string","\"plan\""], ["paren.rparen","]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","plan"] ],[ "start", ["string","$python$"], ["text"," "], ["keyword","LANGUAGE"], ["text"," "], ["identifier","plpythonu"], ["statementEnd",";"] ],[ "start" ],[ "start", ["comment","-- pl/v8 (javascript)"] ],[ "javascript-start", ["keyword.statementBegin","CREATE"], ["text"," "], ["keyword","FUNCTION"], ["text"," "], ["identifier","plv8_test"], ["paren.lparen","("], ["identifier","keys"], ["text"," "], ["keyword","text"], ["text","[], "], ["identifier","vals"], ["text"," "], ["keyword","text"], ["text","[]"], ["paren.rparen",")"], ["text"," "], ["keyword","RETURNS"], ["text"," "], ["keyword","text"], ["text"," "], ["keyword","AS"], ["text"," "], ["string","$javascript$"] ],[ "javascript-start", ["storage.type","var"], ["text"," "], ["identifier","o"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["paren.rparen","}"], ["punctuation.operator",";"] ],[ "javascript-start", ["keyword","for"], ["paren.lparen","("], ["storage.type","var"], ["text"," "], ["identifier","i"], ["keyword.operator","="], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["identifier","i"], ["keyword.operator","<"], ["identifier","keys"], ["punctuation.operator","."], ["support.constant","length"], ["punctuation.operator",";"], ["text"," "], ["identifier","i"], ["keyword.operator","++"], ["paren.rparen",")"], ["paren.lparen","{"] ],[ "javascript-start", ["text"," "], ["identifier","o"], ["paren.lparen","["], ["identifier","keys"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","vals"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "javascript-no_regex", ["paren.rparen","}"] ],[ "javascript-start", ["keyword","return"], ["text"," "], ["variable.language","JSON"], ["punctuation.operator","."], ["identifier","stringify"], ["paren.lparen","("], ["identifier","o"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["string","$javascript$"], ["text"," "], ["keyword","LANGUAGE"], ["text"," "], ["identifier","plv8"], ["text"," "], ["keyword","IMMUTABLE"], ["text"," "], ["keyword","STRICT"], ["statementEnd",";"] ],[ "start" ],[ "start", ["comment","-- json"] ],[ "json-start", ["keyword.statementBegin","select"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["keyword","from"], ["text"," "], ["support.function","json_object_keys"], ["paren.lparen","("], ["string","$json$"] ],[ "json-start", ["paren.lparen","{"] ],[ "json-start", ["text"," "], ["variable","\"f1\""], ["text",": "], ["constant.numeric","5"], ["text",","] ],[ "json-start", ["text"," "], ["variable","\"f2\""], ["text",": "], ["string","\"test\""], ["text",","] ],[ "json-start", ["text"," "], ["variable","\"f3\""], ["text",": "], ["paren.lparen","{"], ["paren.rparen","}"] ],[ "json-start", ["paren.rparen","}"] ],[ "start", ["string","$json$"], ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "start" ],[ "start", ["comment","-- psql commands"] ],[ "start", ["support.buildin","\\df cash*"] ],[ "start" ],[ "start" ],[ "start", ["comment","-- Some string samples."] ],[ "start", ["keyword.statementBegin","select"], ["text"," "], ["string","'don''t do it now;'"], ["text"," "], ["keyword.operator","||"], ["text"," "], ["string","'maybe later'"], ["statementEnd",";"] ],[ "start", ["keyword.statementBegin","select"], ["text"," "], ["identifier","E"], ["string","'dont\\'t do it'"], ["statementEnd",";"] ],[ "start", ["keyword.statementBegin","select"], ["text"," "], ["support.function","length"], ["paren.lparen","("], ["string","'some other''s stuff'"], ["text"," "], ["keyword.operator","||"], ["text"," "], ["string","$$cat in hat's stuff $$"], ["paren.rparen",")"], ["statementEnd",";"] ],[ "start" ],[ "dollarStatementString", ["keyword.statementBegin","select"], ["text"," "], ["string","$$ strings"] ],[ "dollarStatementString", ["string","over multiple "] ],[ "dollarStatementString", ["string","lines - use dollar quotes"] ],[ "start", ["string","$$"], ["statementEnd",";"] ],[ "start" ],[ "start", ["keyword.statementBegin","END"], ["statementEnd",";"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_php.json ================================================ [[ "php-start", ["support.php_tag",""], ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["meta.tag.punctuation.tag-close.xml",">"], ["text"," "], ["support.php_tag",""] ],[ "js-comment1", ["comment","/*this is js "], ["support.php_tag",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," not "], ["constant.language.escape.reference.xml","&js;"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_powershell.json ================================================ [[ "start", ["comment","# This is a simple comment"] ],[ "start", ["keyword","function"], ["text"," "], ["identifier","Hello"], ["lparen","("], ["variable.instance","$name"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["identifier","Write-host"], ["text"," "], ["string","\"Hello $name\""] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","function"], ["text"," "], ["identifier","add"], ["lparen","("], ["variable.instance","$left"], ["text",", "], ["variable.instance","$right"], ["keyword.operator","="], ["constant.numeric","4"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["lparen","("], ["variable.instance","$right"], ["text"," "], ["keyword.operator","-ne"], ["text"," "], ["constant.numeric","4"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["variable.instance","$left"] ],[ "start", ["text"," "], ["rparen","}"], ["text"," "], ["keyword","elseif"], ["text"," "], ["lparen","("], ["variable.instance","$left"], ["text"," "], ["keyword.operator","-eq"], ["text"," "], ["constant.language","$null"], ["text"," "], ["keyword.operator","-and"], ["text"," "], ["variable.instance","$right"], ["text"," "], ["keyword.operator","-eq"], ["text"," "], ["constant.numeric","2"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["constant.numeric","3"] ],[ "start", ["text"," "], ["rparen","}"], ["text"," "], ["keyword","else"], ["text"," "], ["lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["constant.numeric","2"] ],[ "start", ["text"," "], ["rparen","}"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["variable.instance","$number"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["variable.instance","$number"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["constant.numeric","3"] ],[ "start" ],[ "start", ["support.function","Write-Host"], ["text"," "], ["identifier","Hello"], ["text"," "], ["keyword.operator","-"], ["identifier","name"], ["text"," "], ["string","\"World\""] ],[ "start" ],[ "start", ["variable.instance","$an_array"], ["text"," "], ["keyword.operator","="], ["text"," @"], ["lparen","("], ["constant.numeric","1"], ["text",", "], ["constant.numeric","2"], ["text",", "], ["constant.numeric","3"], ["rparen",")"] ],[ "start", ["variable.instance","$a_hash"], ["text"," "], ["keyword.operator","="], ["text"," @"], ["lparen","{"], ["string","\"something\""], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"something else\""], ["rparen","}"] ],[ "start" ],[ "start", ["keyword.operator","&"], ["text"," "], ["identifier","notepad"], ["text"," .\\"], ["identifier","readme"], ["text","."], ["identifier","md"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_praat.json ================================================ [[ "form", ["keyword","form"], ["text"," "], ["entity.name.section","Highlighter test"] ],[ "form", ["text"," "], ["keyword","sentence "], ["text","My_sentence "], ["string","This should all be a string"] ],[ "form", ["text"," "], ["keyword","text "], ["text","My_text "], ["string","This should also all be a string"] ],[ "form", ["text"," "], ["keyword","word "], ["text","My_word "], ["string","Only"], ["invalid.illegal"," the first word is a string, the rest is invalid"] ],[ "form", ["text"," "], ["keyword","boolean "], ["text","Binary "], ["constant.language","1"] ],[ "form", ["text"," "], ["keyword","boolean "], ["text","Text "], ["constant.language","no"] ],[ "form", ["text"," "], ["keyword","boolean "], ["text","Quoted "], ["constant.language","\"yes\""] ],[ "form", ["text"," "], ["keyword","comment "], ["string","This should be a string"] ],[ "form", ["text"," "], ["keyword","real "], ["text","left_Range "], ["constant.numeric","-123.6"] ],[ "form", ["text"," "], ["keyword","positive "], ["text","right_Range_max "], ["constant.numeric","3.3"] ],[ "form", ["text"," "], ["keyword","integer "], ["text","Int "], ["constant.numeric","4"] ],[ "form", ["text"," "], ["keyword","natural "], ["text","Nat "], ["constant.numeric","4"] ],[ "start", ["keyword","endform"] ],[ "start" ],[ "start", ["comment","# External scripts"] ],[ "start", ["keyword","include"], ["text"," "], ["string","/path/to/file"] ],[ "start", ["support.function","runScript"], ["text",":"], ["text"," "], ["string","\"/path/to/file\""] ],[ "start", ["keyword","execute"], ["text"," "], ["string","/path/to/file"] ],[ "start" ],[ "start", ["keyword","stopwatch"] ],[ "start" ],[ "start", ["comment","# old-style procedure call"] ],[ "start", ["keyword","call"], ["text"," "], ["entity.name.function","oldStyle"], ["text"," "], ["string","\"quoted\""], ["text"," "], ["constant.numeric","2"], ["text"," unquoted string"] ],[ "start", ["keyword","assert"], ["text"," oldStyle.local"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"] ],[ "start" ],[ "start", ["comment","# New-style procedure call with parens"] ],[ "start", ["entity.name.function","@newStyle"], ["text","("], ["string","\"quoted\""], ["text",", "], ["constant.numeric","2"], ["text",", "], ["string","\"quoted string\""], ["text",")"] ],[ "start", ["keyword","if"], ["text"," "], ["variable.language","praatVersion"], ["text"," "], ["keyword.operator",">="], ["text"," "], ["constant.numeric","5364"], ["text"," "] ],[ "start", ["comment"," # New-style procedure call with colon"] ],[ "start", ["text"," "], ["entity.name.function","@newStyle"], ["text",":"], ["text"," "], ["string","\"quoted\""], ["text",", "], ["constant.numeric","2"], ["text",", "], ["string","\"quoted string\""] ],[ "start", ["keyword","endif"] ],[ "start" ],[ "start", ["comment","# if-block with built-in variables"] ],[ "start", ["keyword","if"], ["text"," "], ["variable.language","windows"] ],[ "start", ["comment"," # We are on Windows"] ],[ "start", ["keyword","elsif"], ["text"," "], ["variable.language","unix"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.operator","or"], ["text"," "], ["text","!"], ["variable.language","macintosh"] ],[ "start", ["text"," "], ["support.function","exitScript"], ["text",":"], ["text"," "], ["string","\"We are on Linux\""] ],[ "start", ["keyword","else"], ["text"," "], ["variable.language","macintosh"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","exit"], ["text"," "], ["string","We are on Mac"] ],[ "start", ["keyword","endif"] ],[ "start" ],[ "start", ["comment","# inline if with inline comment"] ],[ "start", ["text","var"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","if"], ["text"," "], ["variable.language","macintosh"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword","then"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["keyword","else"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword","fi"], ["text"," "], ["comment","; This is an inline comment"] ],[ "start" ],[ "start", ["comment","# for-loop with explicit from using local variable"] ],[ "start", ["comment","# and paren-style function calls and variable interpolation"] ],[ "start", ["text","n"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","numberOfSelected"], ["text","("], ["string","\"Sound\""], ["text",")"] ],[ "start", ["keyword","for"], ["text"," i "], ["keyword","from"], ["text"," newStyle.local "], ["keyword","to"], ["text"," n"] ],[ "start", ["text"," sound"], ["string.interpolated","'i'"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","selected"], ["text","("], ["string","\"Sound\""], ["text",", i)"] ],[ "start", ["text"," sound[i]"], ["text"," "], ["keyword.operator","="], ["text"," "], ["text","sound"], ["string.interpolated","'i'"] ],[ "start", ["keyword","endfor"] ],[ "start" ],[ "start", ["keyword","for"], ["text"," i "], ["keyword","from"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword","to"], ["text"," n"] ],[ "start", ["comment"," # Different styles of object selection"] ],[ "start", ["text"," "], ["keyword","select"], ["text"," sound"], ["string.interpolated","'i'"] ],[ "start", ["text"," sound"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","selected"], ["text","("], ["text",")"] ],[ "start", ["text"," sound$"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","selected$"], ["text","("], ["string","\"Sound\""], ["text",")"] ],[ "start", ["text"," "], ["keyword","select"], ["text"," "], ["entity.name.type","Sound"], ["text"," "], ["string.interpolated","'sound$'"] ],[ "start", ["text"," "], ["support.function","selectObject"], ["text","("], ["text","sound[i])"] ],[ "start", ["text"," "], ["support.function","selectObject"], ["text",":"], ["text"," sound"] ],[ "start", ["text"," "] ],[ "start", ["comment"," # Pause commands"] ],[ "start", ["text"," "], ["support.function","beginPause"], ["text","("], ["string","\"Viewing \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["text","sound$)"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," i"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," button"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","endPause"], ["text","("], ["string","\"Stop\""], ["text",", "], ["string","\"Previous\""], ["text",","] ],[ "start", ["text"," ..."], ["keyword","if"], ["text"," i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["text","total_sounds "], ["keyword","then"], ["text"," "], ["string","\"Finish\""], ["text"," "], ["keyword","else"], ["text"," "], ["string","\"Next\""], ["text"," "], ["keyword","fi"], ["text",","] ],[ "start", ["text"," ..."], ["constant.numeric","3"], ["text",", "], ["constant.numeric","1"], ["text",")"] ],[ "start", ["text"," "], ["keyword","else"] ],[ "start", ["text"," button"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","endPause"], ["text","("], ["string","\"Stop\""], ["text",","] ],[ "start", ["text"," ..."], ["keyword","if"], ["text"," i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["text","total_sounds "], ["keyword","then"], ["text"," "], ["string","\"Finish\""], ["text"," "], ["keyword","else"], ["text"," "], ["string","\"Next\""], ["text"," "], ["keyword","fi"], ["text",","] ],[ "start", ["text"," ..."], ["constant.numeric","2"], ["text",", "], ["constant.numeric","1"], ["text",") "] ],[ "start", ["text"," "], ["keyword","endif"] ],[ "start", ["text"," editor_name$"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","if"], ["text"," total_textgrids "], ["keyword","then"], ["text"," "], ["string","\"TextGrid \""], ["text"," "], ["keyword","else"], ["text"," "], ["string","\"Sound \""], ["text"," "], ["keyword","fi"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["text","name$"] ],[ "start", ["text"," nocheck editor "], ["string.interpolated","'editor_name$'"] ],[ "start", ["text"," "], ["keyword","nocheck"], ["text"," "], ["keyword","Close"] ],[ "start", ["text"," nocheck endeditor"] ],[ "start", ["text"," "] ],[ "start", ["comment"," # New-style standalone command call"] ],[ "start", ["text"," "], ["keyword","Rename:"], ["text"," "], ["string","\"SomeName\""] ],[ "start" ],[ "start", ["comment"," # Command call with assignment"] ],[ "start", ["text"," "], ["text","duration "], ["keyword.operator","="], ["text"," "], ["keyword","Get total duration"] ],[ "start", ["text"," "] ],[ "start", ["comment"," # Multi-line command with modifier"] ],[ "start", ["text"," "], ["text","pitch "], ["keyword.operator","="], ["text"," "], ["keyword","noprogress"], ["text"," "], ["keyword","To Pitch (ac):"], ["text"," "], ["constant.numeric","0"], ["text",", "], ["constant.numeric","75"], ["text",", "], ["constant.numeric","15"], ["text",", "], ["string","\"no\""], ["text",","] ],[ "start", ["text"," ..."], ["constant.numeric","0.03"], ["text",", "], ["constant.numeric","0.45"], ["text",", "], ["constant.numeric","0.01"], ["text",", "], ["constant.numeric","0.35"], ["text",", "], ["constant.numeric","0.14"], ["text",", "], ["constant.numeric","600"] ],[ "start", ["text"," "] ],[ "start", ["comment"," # do-style command with assignment"] ],[ "start", ["text"," minimum"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","do"], ["text","("], ["string","\"Get minimum...\""], ["text",", "], ["constant.numeric","0"], ["text",", "], ["constant.numeric","0"], ["text",", "], ["string","\"Hertz\""], ["text",", "], ["string","\"Parabolic\""], ["text",")"] ],[ "start" ],[ "start", ["comment"," # New-style multi-line command call with broken strings"] ],[ "start", ["text"," "], ["text","table "], ["keyword.operator","="], ["text"," "], ["keyword","Create Table with column names:"], ["text"," "], ["string","\"table\""], ["text",", "], ["constant.numeric","0"], ["text",","] ],[ "brokenstring", ["text"," ..."], ["string","\"file subject speaker"] ],[ "start", ["text"," ..."], ["string","f0 f1 f2 f3 "], ["string","\""], ["text"," +"] ],[ "start", ["text"," ..."], ["string","\"duration response\""] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["support.function","removeObject"], ["text",":"], ["text"," pitch, table"] ],[ "start", ["text"," "] ],[ "start", ["comment"," # Picture window commands"] ],[ "start", ["text"," "], ["support.function","selectObject"], ["text",":"], ["text"," sound"] ],[ "start", ["comment"," # do-style command"] ],[ "start", ["text"," "], ["support.function","do"], ["text","("], ["string","\"Select inner viewport...\""], ["text",", "], ["constant.numeric","1"], ["text",", "], ["constant.numeric","6"], ["text",", "], ["constant.numeric","0.5"], ["text",", "], ["constant.numeric","1.5"], ["text",")"] ],[ "start", ["text"," "], ["keyword","Black"] ],[ "start", ["text"," "], ["keyword","Draw..."], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["string","\"no\""], ["text"," Curve"] ],[ "start", ["text"," "], ["keyword","Draw inner box"] ],[ "start", ["text"," "], ["keyword","Text bottom:"], ["text"," "], ["string","\"yes\""], ["text",", sound$"] ],[ "start", ["text"," "], ["keyword","Erase all"] ],[ "start", ["text"," "] ],[ "start", ["comment"," # Demo window commands"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Erase all"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Select inner viewport..."], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","100"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","100"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Axes..."], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","100"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","100"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Paint rectangle..."], ["text"," white "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","100"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","100"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Text..."], ["text"," "], ["constant.numeric","50"], ["text"," centre "], ["constant.numeric","50"], ["text"," half Click to finish"] ],[ "start", ["text"," "], ["support.function","demoWaitForInput"], ["text"," ("], ["text"," )"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Erase all"] ],[ "start", ["text"," "], ["keyword","demo"], ["text"," "], ["keyword","Text:"], ["text"," "], ["constant.numeric","50"], ["text",", "], ["string","\"centre\""], ["text",", "], ["constant.numeric","50"], ["text",", "], ["string","\"half\""], ["text",", "], ["string","\"Finished\""] ],[ "start", ["keyword","endfor"] ],[ "start" ],[ "start", ["comment","# An old-style sendpraat block"] ],[ "start", ["keyword","sendpraat"], ["text"," "], ["string","Praat"] ],[ "start", ["text"," ..."], ["string.interpolated","'newline$'"], ["text"," Create "], ["entity.name.type","Sound"], ["text"," as pure tone... "], ["string","\"tone\""], ["text"," "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0.4"], ["text"," "], ["constant.numeric","44100"], ["text"," "], ["constant.numeric","440"], ["text"," "], ["constant.numeric","0.2"], ["text"," "], ["constant.numeric","0.01"], ["text"," "], ["constant.numeric","0.01"] ],[ "start", ["text"," ..."], ["string.interpolated","'newline$'"], ["text"," Play"] ],[ "start", ["text"," ..."], ["string.interpolated","'newline$'"], ["text"," Remove"] ],[ "start" ],[ "start", ["comment","# A new-style sendpraat block"] ],[ "start", ["support.function","beginSendPraat"], ["text",":"], ["text"," "], ["string","\"Praat\""] ],[ "start", ["text"," "], ["keyword","Create Sound as pure tone:"], ["text"," "], ["string","\"tone\""], ["text",", "], ["constant.numeric","1"], ["text",", "], ["constant.numeric","0"], ["text",", "], ["constant.numeric","0.4"], ["text",", "], ["constant.numeric","44100"], ["text",", "], ["constant.numeric","440"], ["text",", "], ["constant.numeric","0.2"], ["text",", "], ["constant.numeric","0.01"], ["text",", "], ["constant.numeric","0.01"] ],[ "start", ["text"," "], ["text","duration "], ["keyword.operator","="], ["text"," "], ["keyword","Get total duration"] ],[ "start", ["text"," "], ["keyword","Remove"] ],[ "start", ["support.function","endSendPraat"], ["text",":"], ["text"," "], ["string","\"duration\""] ],[ "start", ["support.function","appendInfoLine"], ["text",":"], ["text"," "], ["string","\"The generated sound lasted for \""], ["text",", duration, "], ["string","\"seconds\""] ],[ "start" ],[ "start", ["text","time "], ["keyword.operator","="], ["text"," "], ["keyword","stopwatch"] ],[ "start", ["keyword","clearinfo"] ],[ "start", ["keyword","echo"], ["text"," "], ["string","This script took "] ],[ "start", ["keyword","print"], ["text"," "], ["string","'time' seconds to "] ],[ "start", ["keyword","printline"], ["text"," "], ["string","execute."] ],[ "start" ],[ "start", ["comment","# Old-style procedure declaration"] ],[ "start", ["keyword","procedure"], ["text"," "], ["entity.name.function","oldStyle"], ["text"," .str1$ .num .str2$"] ],[ "start", ["text"," .local"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"] ],[ "start", ["keyword","endproc"] ],[ "start" ],[ "start", ["comment","# New-style procedure declaration"] ],[ "start", ["keyword","procedure"], ["text"," "], ["entity.name.function","newStyle"], ["text"," (.str1$, .num, .str2$)"] ],[ "start", ["text"," .local"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"] ],[ "start", ["keyword","endproc"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_prolog.json ================================================ [[ "start", ["entity.name.function.fact.prolog","partition"], ["punctuation.begin.fact.parameters.prolog","("], ["punctuation.begin.list.prolog","["], ["punctuation.end.list.prolog","]"], ["punctuation.separator.parameters.prolog",","], ["meta.fact.prolog"," "], ["variable.language.anonymous.prolog","_"], ["punctuation.separator.parameters.prolog",","], ["meta.fact.prolog"," "], ["punctuation.begin.list.prolog","["], ["punctuation.end.list.prolog","]"], ["punctuation.separator.parameters.prolog",","], ["meta.fact.prolog"," "], ["punctuation.begin.list.prolog","["], ["punctuation.end.list.prolog","]"], ["punctuation.end.fact.parameters.prolog",")"], ["punctuation.end.fact.prolog","."] ],[ ["keyword.operator.definition.prolog","meta.rule.prolog"], ["entity.name.function.rule.prolog","partition"], ["punctuation.rule.parameters.begin.prolog","("], ["punctuation.begin.list.prolog","["], ["variable.other.prolog","X"], ["punctuation.concat.list.prolog","|"], ["variable.other.prolog","Xs"], ["punctuation.end.list.prolog","]"], ["punctuation.separator.parameters.prolog",","], ["meta.rule.parameters.prolog"," "], ["variable.parameter.prolog","Pivot"], ["punctuation.separator.parameters.prolog",","], ["meta.rule.parameters.prolog"," "], ["variable.parameter.prolog","Smalls"], ["punctuation.separator.parameters.prolog",","], ["meta.rule.parameters.prolog"," "], ["variable.parameter.prolog","Bigs"], ["punctuation.rule.parameters.end.prolog",")"], ["meta.rule.signature.prolog"," "], ["keyword.operator.definition.prolog",":-"] ],[ ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.rule.definition.prolog"," "], ["meta.expression.prolog","( "], ["variable.other.prolog","X"], ["meta.expression.prolog"," @"], ["keyword.operator.prolog","<"], ["meta.expression.prolog"," "], ["variable.other.prolog","Pivot"], ["meta.expression.prolog"," "], ["keyword.operator.prolog","->"] ],[ ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.expression.prolog"," "], ["variable.other.prolog","Smalls"], ["meta.expression.prolog"," "], ["keyword.operator.prolog","="], ["meta.expression.prolog"," "], ["punctuation.begin.list.prolog","["], ["variable.other.prolog","X"], ["punctuation.concat.list.prolog","|"], ["variable.other.prolog","Rest"], ["punctuation.end.list.prolog","]"], ["punctuation.control.and.prolog",","] ],[ ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.expression.prolog"," "], ["constant.other.atom.prolog","partition"], ["punctuation.begin.statement.parameters.prolog","("], ["variable.other.prolog","Xs"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","Pivot"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","Rest"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","Bigs"], ["punctuation.end.statement.parameters.prolog",")"] ],[ ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.expression.prolog"," "], ["punctuation.control.or.prolog",";"], ["meta.expression.prolog"," "], ["variable.other.prolog","Bigs"], ["meta.expression.prolog"," "], ["keyword.operator.prolog","="], ["meta.expression.prolog"," "], ["punctuation.begin.list.prolog","["], ["variable.other.prolog","X"], ["punctuation.concat.list.prolog","|"], ["variable.other.prolog","Rest"], ["punctuation.end.list.prolog","]"], ["punctuation.control.and.prolog",","] ],[ ["meta.expression.prolog","keyword.operator.definition.prolog","keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.expression.prolog"," "], ["constant.other.atom.prolog","partition"], ["punctuation.begin.statement.parameters.prolog","("], ["variable.other.prolog","Xs"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","Pivot"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","Smalls"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","Rest"], ["punctuation.end.statement.parameters.prolog",")"] ],[ "start", ["meta.expression.prolog"," )"], ["punctuation.rule.end.prolog","."] ],[ "start", ["text"," "] ],[ "start", ["entity.name.function.fact.prolog","quicksort"], ["punctuation.begin.fact.parameters.prolog","("], ["punctuation.begin.list.prolog","["], ["punctuation.end.list.prolog","]"], ["punctuation.end.fact.parameters.prolog",")"], ["text"," --> []."] ],[ "start", ["entity.name.function.fact.prolog","quicksort"], ["punctuation.begin.fact.parameters.prolog","("], ["punctuation.begin.list.prolog","["], ["variable.other.prolog","X"], ["punctuation.concat.list.prolog","|"], ["variable.other.prolog","Xs"], ["punctuation.end.list.prolog","]"], ["punctuation.end.fact.parameters.prolog",")"], ["text"," -->"] ],[ "start", ["text"," { "], ["entity.name.function.fact.prolog","partition"], ["punctuation.begin.fact.parameters.prolog","("], ["variable.parameter.prolog","Xs"], ["punctuation.separator.parameters.prolog",","], ["meta.fact.prolog"," "], ["variable.parameter.prolog","X"], ["punctuation.separator.parameters.prolog",","], ["meta.fact.prolog"," "], ["variable.parameter.prolog","Smaller"], ["punctuation.separator.parameters.prolog",","], ["meta.fact.prolog"," "], ["variable.parameter.prolog","Bigger"], ["punctuation.end.fact.parameters.prolog",")"], ["text"," },"] ],[ "start", ["text"," "], ["entity.name.function.fact.prolog","quicksort"], ["punctuation.begin.fact.parameters.prolog","("], ["variable.parameter.prolog","Smaller"], ["punctuation.end.fact.parameters.prolog",")"], ["text",", [X], "], ["entity.name.function.fact.prolog","quicksort"], ["punctuation.begin.fact.parameters.prolog","("], ["variable.parameter.prolog","Bigger"], ["punctuation.end.fact.parameters.prolog",")"], ["punctuation.end.fact.prolog","."] ],[ "start" ],[ ["keyword.operator.definition.prolog","meta.rule.prolog"], ["entity.name.function.rule.prolog","perfect"], ["punctuation.rule.parameters.begin.prolog","("], ["variable.parameter.prolog","N"], ["punctuation.rule.parameters.end.prolog",")"], ["meta.rule.signature.prolog"," "], ["keyword.operator.definition.prolog",":-"] ],[ ["keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.rule.definition.prolog"," "], ["constant.other.atom.prolog","between"], ["punctuation.begin.statement.parameters.prolog","("], ["constant.numeric.prolog","1"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["constant.other.atom.prolog","inf"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","N"], ["punctuation.end.statement.parameters.prolog",")"], ["punctuation.control.and.prolog",","], ["meta.rule.definition.prolog"," "], ["variable.other.prolog","U"], ["meta.rule.definition.prolog"," "], ["keyword.operator.prolog","is"], ["meta.rule.definition.prolog"," "], ["variable.other.prolog","N"], ["meta.rule.definition.prolog"," // "], ["constant.numeric.prolog","2"], ["punctuation.control.and.prolog",","] ],[ ["keyword.operator.definition.prolog","meta.rule.prolog"], ["meta.rule.definition.prolog"," "], ["constant.other.atom.prolog","findall"], ["punctuation.begin.statement.parameters.prolog","("], ["variable.other.prolog","D"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," ("], ["constant.other.atom.prolog","between"], ["punctuation.begin.statement.parameters.prolog","("], ["constant.numeric.prolog","1"], ["punctuation.separator.statement.prolog",","], ["variable.other.prolog","U"], ["punctuation.separator.statement.prolog",","], ["variable.other.prolog","D"], ["punctuation.end.statement.parameters.prolog",")"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","N"], ["meta.statement.parameters.prolog"," "], ["constant.other.atom.prolog","mod"], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","D"], ["meta.statement.parameters.prolog"," "], ["keyword.operator.prolog","=:="], ["meta.statement.parameters.prolog"," "], ["constant.numeric.prolog","0"], ["punctuation.end.statement.parameters.prolog",")"], ["punctuation.control.and.prolog",","], ["meta.rule.definition.prolog"," "], ["variable.other.prolog","Ds"], ["meta.rule.definition.prolog",")"], ["punctuation.control.and.prolog",","] ],[ "start", ["meta.rule.definition.prolog"," "], ["constant.other.atom.prolog","sumlist"], ["punctuation.begin.statement.parameters.prolog","("], ["variable.other.prolog","Ds"], ["punctuation.separator.statement.prolog",","], ["meta.statement.parameters.prolog"," "], ["variable.other.prolog","N"], ["punctuation.end.statement.parameters.prolog",")"], ["punctuation.rule.end.prolog","."] ]] ================================================ FILE: lib/ace/mode/_test/tokens_properties.json ================================================ [[ "start", ["comment","# You are reading the \".properties\" entry."] ],[ "start", ["comment","! The exclamation mark can also mark text as comments."] ],[ "start", ["comment","# The key and element characters #, !, =, and : are written with a preceding backslash to ensure that they are properly loaded."] ],[ "start", ["variable","website "], ["keyword","="], ["string"," http"], ["constant.language.escape","\\"], ["string","://en.wikipedia.org/"] ],[ "start", ["variable","language "], ["keyword","="], ["string"," English"] ],[ "start", ["comment","# The backslash below tells the application to continue reading"] ],[ "start", ["comment","# the value onto the next line."] ],[ "value", ["variable","message "], ["keyword","="], ["string"," Welcome to \\"] ],[ "start", ["string"," Wikipedia!"] ],[ "start", ["comment","# Add spaces to the key"] ],[ "start", ["variable","key"], ["constant.language.escape","\\"], ["variable"," with"], ["constant.language.escape","\\"], ["variable"," spaces "], ["keyword","="], ["string"," This is the value that could be looked up with the key \"key with spaces\"."] ],[ "start", ["comment","# Unicode"] ],[ "start", ["variable","tab "], ["keyword",":"], ["string"," "], ["constant.language.escape","\\u0009"] ],[ "start", ["variable","empty-key"], ["keyword","="] ],[ "start", ["variable","last.line"], ["keyword","="], ["string","value"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_protobuf.json ================================================ [[ "start", ["keyword.declaration.protobuf","message"], ["text"," "], ["identifier","Point"], ["text"," {"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","required"], ["text"," "], ["support.type","int32"], ["text"," "], ["identifier","x"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","1"], ["text",";"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","required"], ["text"," "], ["support.type","int32"], ["text"," "], ["identifier","y"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","optional"], ["text"," "], ["support.type","string"], ["text"," "], ["identifier","label"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","3"], ["text",";"] ],[ "start", ["text","}"] ],[ "start" ],[ "start", ["keyword.declaration.protobuf","message"], ["text"," "], ["identifier","Line"], ["text"," {"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","required"], ["text"," "], ["identifier","Point"], ["text"," "], ["identifier","start"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","1"], ["text",";"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","required"], ["text"," "], ["identifier","Point"], ["text"," "], ["identifier","end"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","optional"], ["text"," "], ["support.type","string"], ["text"," "], ["identifier","label"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","3"], ["text",";"] ],[ "start", ["text","}"] ],[ "start" ],[ "start", ["keyword.declaration.protobuf","message"], ["text"," "], ["identifier","Polyline"], ["text"," {"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","repeated"], ["text"," "], ["identifier","Point"], ["text"," "], ["identifier","point"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","1"], ["text",";"] ],[ "start", ["text"," "], ["keyword.declaration.protobuf","optional"], ["text"," "], ["support.type","string"], ["text"," "], ["identifier","label"], ["text"," "], ["keyword.operator.assignment.protobuf","="], ["text"," "], ["constant.numeric","2"], ["text",";"] ],[ "start", ["text","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_python.json ================================================ [[ "start", ["comment","#!/usr/local/bin/python"] ],[ "start" ],[ "start", ["keyword","import"], ["text"," "], ["identifier","string"], ["text",", "], ["identifier","sys"] ],[ "start" ],[ "start", ["comment","# If no arguments were given, print a helpful message"] ],[ "start", ["keyword","if"], ["text"," "], ["support.function","len"], ["paren.lparen","("], ["identifier","sys"], ["text","."], ["identifier","argv"], ["paren.rparen",")"], ["keyword.operator","=="], ["constant.numeric","1"], ["text",":"] ],[ "qstring3", ["text"," "], ["keyword","print"], ["text"," "], ["string","'''Usage:"] ],[ "start", ["string","celsius temp1 temp2 ...'''"] ],[ "start", ["text"," "], ["identifier","sys"], ["text","."], ["identifier","exit"], ["paren.lparen","("], ["constant.numeric","0"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["comment","# Loop over the arguments"] ],[ "start", ["keyword","for"], ["text"," "], ["identifier","i"], ["text"," "], ["keyword","in"], ["text"," "], ["identifier","sys"], ["text","."], ["identifier","argv"], ["paren.lparen","["], ["constant.numeric","1"], ["text",":"], ["paren.rparen","]"], ["text",":"] ],[ "start", ["text"," "], ["keyword","try"], ["text",":"] ],[ "start", ["text"," "], ["identifier","fahrenheit"], ["keyword.operator","="], ["support.function","float"], ["paren.lparen","("], ["identifier","string"], ["text","."], ["identifier","atoi"], ["paren.lparen","("], ["identifier","i"], ["paren.rparen","))"] ],[ "start", ["text"," "], ["keyword","except"], ["text"," "], ["identifier","string"], ["text","."], ["identifier","atoi_error"], ["text",":"] ],[ "start", ["text"," "], ["keyword","print"], ["text"," "], ["support.function","repr"], ["paren.lparen","("], ["identifier","i"], ["paren.rparen",")"], ["text",", "], ["string","\"not a numeric value\""] ],[ "start", ["text"," "], ["keyword","else"], ["text",":"] ],[ "start", ["text"," "], ["identifier","celsius"], ["keyword.operator","="], ["paren.lparen","("], ["identifier","fahrenheit"], ["keyword.operator","-"], ["constant.numeric","32"], ["paren.rparen",")"], ["keyword.operator","*"], ["constant.numeric","5.0"], ["keyword.operator","/"], ["constant.numeric","9.0"] ],[ "start", ["text"," "], ["keyword","print"], ["text"," "], ["string","'%i"], ["constant.language.escape","\\260"], ["string","F = %i"], ["constant.language.escape","\\260"], ["string","C'"], ["text"," "], ["keyword.operator","%"], ["text"," "], ["paren.lparen","("], ["support.function","int"], ["paren.lparen","("], ["identifier","fahrenheit"], ["paren.rparen",")"], ["text",", "], ["support.function","int"], ["paren.lparen","("], ["identifier","celsius"], ["keyword.operator","+"], ["constant.numeric",".5"], ["paren.rparen","))"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_r.json ================================================ [[ "start", ["identifier","Call"], ["keyword.operator",":"] ],[ "start", ["identifier","lm"], ["paren.keyword.operator","("], ["identifier","formula"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","y"], ["text"," "], ["keyword.operator","~"], ["text"," "], ["identifier","x"], ["paren.keyword.operator",")"] ],[ "start", ["text"," "] ],[ "start", ["identifier","Residuals"], ["keyword.operator",":"] ],[ "start", ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["constant.numeric","3"], ["text"," "], ["constant.numeric","4"], ["text"," "], ["constant.numeric","5"], ["text"," "], ["constant.numeric","6"] ],[ "start", ["constant.numeric","3.3333"], ["text"," "], ["keyword.operator","-"], ["constant.numeric","0.6667"], ["text"," "], ["keyword.operator","-"], ["constant.numeric","2.6667"], ["text"," "], ["keyword.operator","-"], ["constant.numeric","2.6667"], ["text"," "], ["keyword.operator","-"], ["constant.numeric","0.6667"], ["text"," "], ["constant.numeric","3.3333"] ],[ "start", ["text"," "] ],[ "start", ["identifier","Coefficients"], ["keyword.operator",":"] ],[ "start", ["text"," "], ["identifier","Estimate"], ["text"," "], ["identifier","Std"], ["text",". "], ["identifier","Error"], ["text"," "], ["identifier","t"], ["text"," "], ["identifier","value"], ["text"," "], ["identifier","Pr"], ["paren.keyword.operator","("], ["keyword.operator",">|"], ["identifier","t"], ["keyword.operator","|"], ["paren.keyword.operator",")"] ],[ "start", ["paren.keyword.operator","("], ["identifier","Intercept"], ["paren.keyword.operator",")"], ["text"," "], ["keyword.operator","-"], ["constant.numeric","9.3333"], ["text"," "], ["constant.numeric","2.8441"], ["text"," "], ["keyword.operator","-"], ["constant.numeric","3.282"], ["text"," "], ["constant.numeric","0.030453"], ["text"," "], ["keyword.operator","*"] ],[ "start", ["identifier","x"], ["text"," "], ["constant.numeric","7.0000"], ["text"," "], ["constant.numeric","0.7303"], ["text"," "], ["constant.numeric","9.585"], ["text"," "], ["constant.numeric","0.000662"], ["text"," "], ["keyword.operator","***"] ],[ "start", ["keyword.operator","---"] ],[ "start", ["identifier","Signif"], ["text",". "], ["identifier","codes"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","0"], ["text"," ‘"], ["keyword.operator","***"], ["text","’ "], ["constant.numeric","0.001"], ["text"," ‘"], ["keyword.operator","**"], ["text","’ "], ["constant.numeric","0.01"], ["text"," ‘"], ["keyword.operator","*"], ["text","’ "], ["constant.numeric","0.05"], ["text"," ‘.’ "], ["constant.numeric","0.1"], ["text"," ‘ ’ "], ["constant.numeric","1"] ],[ "start", ["text"," "] ],[ "start", ["identifier","Residual"], ["text"," "], ["identifier","standard"], ["text"," "], ["identifier","error"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","3.055"], ["text"," "], ["identifier","on"], ["text"," "], ["constant.numeric","4"], ["text"," "], ["identifier","degrees"], ["text"," "], ["identifier","of"], ["text"," "], ["identifier","freedom"] ],[ "start", ["identifier","Multiple"], ["text"," "], ["identifier","R"], ["keyword.operator","-"], ["identifier","squared"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","0.9583"], ["text",", "], ["identifier","Adjusted"], ["text"," "], ["identifier","R"], ["keyword.operator","-"], ["identifier","squared"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","0.9478"] ],[ "start", ["constant.language.boolean","F"], ["keyword.operator","-"], ["identifier","statistic"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","91.88"], ["text"," "], ["identifier","on"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["identifier","and"], ["text"," "], ["constant.numeric","4"], ["text"," "], ["identifier","DF"], ["text",", "], ["identifier","p"], ["keyword.operator","-"], ["identifier","value"], ["keyword.operator",":"], ["text"," "], ["constant.numeric","0.000662"] ],[ "start", ["text"," "] ],[ "start", ["keyword.operator",">"], ["text"," "], ["identifier","par"], ["paren.keyword.operator","("], ["identifier","mfrow"], ["keyword.operator","="], ["identifier","c"], ["paren.keyword.operator","("], ["constant.numeric","2"], ["text",", "], ["constant.numeric","2"], ["paren.keyword.operator","))"], ["text"," "], ["comment","# Request 2x2 plot layout"] ],[ "start", ["keyword.operator",">"], ["text"," "], ["identifier","plot"], ["paren.keyword.operator","("], ["identifier","lm_1"], ["paren.keyword.operator",")"], ["text"," "], ["comment","# Diagnostic plot of regression model"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_razor.json ================================================ [[ ["razor-block-start","@{"], ["punctuation.block.razor","@{"] ],[ ["razor-block-start","@{"], ["text","\t"], ["identifier","Layout"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","\""], ["string","~/layout"], ["string.end","\""] ],[ "start", ["punctuation.block.razor","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_rdoc.json ================================================ [[ "start", ["keyword","\\name"], ["paren.keyword.operator","{"], ["nospell.text","picker"], ["paren.keyword.operator","}"] ],[ "start", ["keyword","\\alias"], ["paren.keyword.operator","{"], ["nospell.text","picker"], ["paren.keyword.operator","}"] ],[ "start", ["keyword","\\title"], ["paren.keyword.operator","{"], ["text","Create a picker control"], ["paren.keyword.operator","}"] ],[ "start", ["keyword","\\description"], ["paren.keyword.operator","{"] ],[ "start", ["text"," Create a picker control to enable manipulation of plot variables based on a set of fixed choices."] ],[ "start", ["paren.keyword.operator","}"] ],[ "start" ],[ "nospell", ["keyword","\\usage"], ["paren.keyword.operator","{"] ],[ "nospell", ["nospell.text","picker"], ["paren.keyword.operator","("], ["text","...,"], ["nospell.text"," initial "], ["text","="], ["nospell.text"," NULL"], ["text",","], ["nospell.text"," label "], ["text","="], ["nospell.text"," NULL"], ["paren.keyword.operator",")"] ],[ "start", ["paren.keyword.operator","}"] ],[ "start" ],[ "start" ],[ "start", ["keyword","\\arguments"], ["paren.keyword.operator","{"] ],[ "start", ["text"," "], ["keyword","\\item"], ["paren.keyword.operator","{"], ["keyword","\\dots"], ["paren.keyword.operator","}{"] ],[ "start", ["text"," Arguments containing objects to be presented as choices for the picker "], ["paren.keyword.operator","("], ["text","or a list containing the choices"], ["paren.keyword.operator",")"], ["text",". If an element is named then the name is used to display it within the picker. If an element is not named then it is displayed within the picker using "], ["keyword","\\code"], ["paren.keyword.operator","{"], ["keyword","\\link"], ["paren.keyword.operator","{"], ["nospell.text","as"], ["text","."], ["nospell.text","character"], ["paren.keyword.operator","}}"], ["text",". "] ],[ "start", ["paren.keyword.operator","}"] ],[ "start", ["text"," "], ["keyword","\\item"], ["paren.keyword.operator","{"], ["nospell.text","initial"], ["paren.keyword.operator","}{"] ],[ "start", ["text"," Initial value for picker. Value must be present in the list of choices specified. If not specified defaults to the first choice."] ],[ "start", ["paren.keyword.operator","}"] ],[ "start", ["text"," "], ["keyword","\\item"], ["paren.keyword.operator","{"], ["nospell.text","label"], ["paren.keyword.operator","}{"] ],[ "start", ["text"," Display label for picker. Defaults to the variable name if not specified."] ],[ "start", ["paren.keyword.operator","}"] ],[ "start", ["paren.keyword.operator","}"] ],[ "start" ],[ "start", ["keyword","\\value"], ["paren.keyword.operator","{"] ],[ "start", ["text"," An object of class \"manipulator.picker\" which can be passed to the "], ["keyword","\\code"], ["paren.keyword.operator","{"], ["keyword","\\link"], ["paren.keyword.operator","{"], ["nospell.text","manipulate"], ["paren.keyword.operator","}}"], ["text"," function."] ],[ "start", ["paren.keyword.operator","}"] ],[ "start" ],[ "start", ["keyword","\\seealso"], ["paren.keyword.operator","{"] ],[ "start", ["keyword","\\code"], ["paren.keyword.operator","{"], ["keyword","\\link"], ["paren.keyword.operator","{"], ["nospell.text","manipulate"], ["paren.keyword.operator","}}"], ["text",", "], ["keyword","\\code"], ["paren.keyword.operator","{"], ["keyword","\\link"], ["paren.keyword.operator","{"], ["nospell.text","slider"], ["paren.keyword.operator","}}"], ["text",", "], ["keyword","\\code"], ["paren.keyword.operator","{"], ["keyword","\\link"], ["paren.keyword.operator","{"], ["nospell.text","checkbox"], ["paren.keyword.operator","}}"], ["text",", "], ["keyword","\\code"], ["paren.keyword.operator","{"], ["keyword","\\link"], ["paren.keyword.operator","{"], ["nospell.text","button"], ["paren.keyword.operator","}}"] ],[ "start", ["paren.keyword.operator","}"] ],[ "start" ],[ "start" ],[ "nospell", ["keyword","\\examples"], ["paren.keyword.operator","{"] ],[ "nospell", ["keyword","\\dontrun"], ["paren.keyword.operator","{"] ],[ "nospell" ],[ "nospell", ["text","##"], ["nospell.text"," Filtering data with a picker"] ],[ "nospell", ["nospell.text","manipulate"], ["paren.keyword.operator","("] ],[ "nospell", ["nospell.text"," barplot"], ["paren.keyword.operator","("], ["nospell.text","as"], ["text","."], ["nospell.text","matrix"], ["paren.keyword.operator","("], ["nospell.text","longley"], ["paren.keyword.operator","["], ["text",","], ["nospell.text","factor"], ["paren.keyword.operator","])"], ["text",","], ["nospell.text"," "] ],[ "nospell", ["nospell.text"," beside "], ["text","="], ["nospell.text"," TRUE"], ["text",","], ["nospell.text"," main "], ["text","="], ["nospell.text"," factor"], ["paren.keyword.operator",")"], ["text",","] ],[ "nospell", ["nospell.text"," factor "], ["text","="], ["nospell.text"," picker"], ["paren.keyword.operator","("], ["text","\""], ["nospell.text","GNP"], ["text","\","], ["nospell.text"," "], ["text","\""], ["nospell.text","Unemployed"], ["text","\","], ["nospell.text"," "], ["text","\""], ["nospell.text","Employed"], ["text","\""], ["paren.keyword.operator","))"] ],[ "nospell" ],[ "nospell", ["text","##"], ["nospell.text"," Create a picker with labels"] ],[ "nospell", ["nospell.text","manipulate"], ["paren.keyword.operator","("] ],[ "nospell", ["nospell.text"," plot"], ["paren.keyword.operator","("], ["nospell.text","pressure"], ["text",","], ["nospell.text"," type "], ["text","="], ["nospell.text"," type"], ["paren.keyword.operator",")"], ["text",","], ["nospell.text"," "] ],[ "nospell", ["nospell.text"," type "], ["text","="], ["nospell.text"," picker"], ["paren.keyword.operator","("], ["text","\""], ["nospell.text","points"], ["text","\""], ["nospell.text"," "], ["text","="], ["nospell.text"," "], ["text","\""], ["nospell.text","p"], ["text","\","], ["nospell.text"," "], ["text","\""], ["nospell.text","line"], ["text","\""], ["nospell.text"," "], ["text","="], ["nospell.text"," "], ["text","\""], ["nospell.text","l"], ["text","\","], ["nospell.text"," "], ["text","\""], ["nospell.text","step"], ["text","\""], ["nospell.text"," "], ["text","="], ["nospell.text"," "], ["text","\""], ["nospell.text","s"], ["text","\""], ["paren.keyword.operator","))"] ],[ "nospell", ["nospell.text"," "] ],[ "nospell", ["text","##"], ["nospell.text"," Picker with groups"] ],[ "nospell", ["nospell.text","manipulate"], ["paren.keyword.operator","("] ],[ "nospell", ["nospell.text"," barplot"], ["paren.keyword.operator","("], ["nospell.text","as"], ["text","."], ["nospell.text","matrix"], ["paren.keyword.operator","("], ["nospell.text","mtcars"], ["paren.keyword.operator","["], ["nospell.text","group"], ["text",",\""], ["nospell.text","mpg"], ["text","\""], ["paren.keyword.operator","])"], ["text",","], ["nospell.text"," beside"], ["text","="], ["nospell.text","TRUE"], ["paren.keyword.operator",")"], ["text",","] ],[ "nospell", ["nospell.text"," group "], ["text","="], ["nospell.text"," picker"], ["paren.keyword.operator","("], ["text","\""], ["nospell.text","Group 1"], ["text","\""], ["nospell.text"," "], ["text","="], ["nospell.text"," 1"], ["text",":"], ["nospell.text","11"], ["text",","], ["nospell.text"," "] ],[ "nospell", ["nospell.text"," "], ["text","\""], ["nospell.text","Group 2"], ["text","\""], ["nospell.text"," "], ["text","="], ["nospell.text"," 12"], ["text",":"], ["nospell.text","22"], ["text",","], ["nospell.text"," "] ],[ "nospell", ["nospell.text"," "], ["text","\""], ["nospell.text","Group 3"], ["text","\""], ["nospell.text"," "], ["text","="], ["nospell.text"," 23"], ["text",":"], ["nospell.text","32"], ["paren.keyword.operator","))"] ],[ "nospell" ],[ "nospell", ["text","##"], ["nospell.text"," Histogram w"], ["text","/"], ["nospell.text"," picker to select type"] ],[ "nospell", ["nospell.text","require"], ["paren.keyword.operator","("], ["nospell.text","lattice"], ["paren.keyword.operator",")"] ],[ "nospell", ["nospell.text","require"], ["paren.keyword.operator","("], ["nospell.text","stats"], ["paren.keyword.operator",")"] ],[ "nospell", ["nospell.text","manipulate"], ["paren.keyword.operator","("] ],[ "nospell", ["nospell.text"," histogram"], ["paren.keyword.operator","("], ["text","~"], ["nospell.text"," height "], ["text","|"], ["nospell.text"," voice"], ["text","."], ["nospell.text","part"], ["text",","], ["nospell.text"," "] ],[ "nospell", ["nospell.text"," data "], ["text","="], ["nospell.text"," singer"], ["text",","], ["nospell.text"," type "], ["text","="], ["nospell.text"," type"], ["paren.keyword.operator",")"], ["text",","] ],[ "nospell", ["nospell.text"," type "], ["text","="], ["nospell.text"," picker"], ["paren.keyword.operator","("], ["text","\""], ["nospell.text","percent"], ["text","\","], ["nospell.text"," "], ["text","\""], ["nospell.text","count"], ["text","\","], ["nospell.text"," "], ["text","\""], ["nospell.text","density"], ["text","\""], ["paren.keyword.operator","))"] ],[ "nospell" ],[ "start", ["paren.keyword.operator","}"] ],[ "start", ["paren.keyword.operator","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_rhtml.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","head"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Title"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","This is an R HTML document. When you click the "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Knit HTML"], ["meta.tag.punctuation.end-tag-open.xml",""], ["text.xml"," button a web page will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "r-start", ["support.function.codebegin",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","p"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","You can also embed plots, for example:"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "r-start", ["support.function.codebegin",""] ],[ "start" ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_ruby.json ================================================ [[ "start", ["text"," "], ["comment","#test: symbol tokenizer"] ],[ "start", ["text"," "], ["paren.lparen","["], ["constant.other.symbol.ruby",":@thing"], ["text",", "], ["constant.other.symbol.ruby",":$thing"], ["text",", "], ["constant.other.symbol.ruby",":_thing"], ["text",", "], ["constant.other.symbol.ruby",":thing"], ["text",", "], ["constant.other.symbol.ruby",":Thing"], ["text",", "], ["constant.other.symbol.ruby",":thing1"], ["text",", "], ["constant.other.symbol.ruby",":thing_a"], ["text",","] ],[ "start", ["text"," "], ["constant.other.symbol.ruby",":THING"], ["text",", "], ["constant.other.symbol.ruby",":thing!"], ["text",", "], ["constant.other.symbol.ruby",":thing="], ["text",", "], ["constant.other.symbol.ruby",":thing?"], ["text",", "], ["constant.other.symbol.ruby",":t?"], ["text",","] ],[ "start", ["text"," :, :@, :"], ["keyword.operator","$"], ["text",", :"], ["constant.numeric","1"], ["text",", :1"], ["identifier","thing"], ["text",", "], ["constant.other.symbol.ruby",":th?"], ["identifier","ing"], ["text",", "], ["constant.other.symbol.ruby",":thi="], ["identifier","ng"], ["text",", :1"], ["identifier","thing"], ["text",","] ],[ "start", ["text"," "], ["constant.other.symbol.ruby",":th!"], ["identifier","ing"], ["text",", "], ["constant.other.symbol.ruby",":thing"], ["comment","#"] ],[ "start", ["text"," "], ["paren.rparen","]"] ],[ "start" ],[ "start", ["text"," "], ["comment","#test: namespaces aren't symbols\" : function() {"] ],[ "start", ["text"," "], ["support.class","Namespaced"], ["text","::"], ["support.class","Class"] ],[ "start", ["text"," "], ["comment","#test: hex tokenizer "] ],[ "start", ["text"," "], ["constant.numeric","0x9a"], ["text",", "], ["constant.numeric","0XA1"], ["text",", "], ["constant.numeric","0x9_a"], ["text",", 0"], ["identifier","x"], ["text",", 0"], ["identifier","x_9a"], ["text",", 0"], ["identifier","x9a_"], ["text",","] ],[ "start", ["text"," "], ["comment","#test: float tokenizer"] ],[ "start", ["text"," "], ["paren.lparen","["], ["constant.numeric","1"], ["text",", "], ["constant.numeric","+1"], ["text",", "], ["constant.numeric","-1"], ["text",", "], ["constant.numeric","12_345"], ["text",", "], ["constant.numeric","0.000_1"], ["text",","] ],[ "start", ["text"," "], ["identifier","_"], ["text",", "], ["constant.numeric","3_1"], ["text",", "], ["constant.numeric","1_2"], ["text",", 1"], ["identifier","_"], ["text","."], ["constant.numeric","0"], ["text",", "], ["constant.numeric","0"], ["text","."], ["identifier","_1"], ["paren.rparen","]"], ["text",";"] ],[ "start", ["text"," "] ],[ "start", ["paren.lparen","{"], ["constant.other.symbol.ruby",":id"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["string.character","?\""], ["text",", "], ["constant.other.symbol.ruby",":key"], ["text"," "], ["punctuation.separator.key-value","=>"], ["text"," "], ["string.start","\""], ["string","value"], ["string.end","\""], ["text",", "], ["identifier","anotherKey"], ["text",": "], ["paren.lparen","["], ["identifier","x"], ["text",", "], ["identifier","y"], ["text","?"], ["paren.rparen","]}"] ],[ "start" ],[ "comment", ["comment","=begin"] ],[ "start", ["comment","=end"] ],[ "start" ],[ "comment", ["comment","=begin x"] ],[ "comment", ["comment","=end-"] ],[ "start", ["comment","=end x"] ],[ "start" ],[ ["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], ["text"," "], ["identifier","herDocs"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["constant","<<"], ["string","'"], ["support.class","FOO"], ["string","'"], ["text",", "], ["constant","<<"], ["string",""], ["support.class","BAR"], ["string",""], ["text",", "], ["constant","<<-"], ["string",""], ["support.class","BAZ"], ["string",""], ["text",", "], ["constant","<<-"], ["string","`"], ["support.class","EXEC"], ["string","`"], ["paren.rparen","]"], ["text"," "], ["comment","#comment"] ],[ ["heredoc","FOO","heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], ["string"," FOO #{literal}"] ],[ ["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], ["support.class","FOO"] ],[ ["heredoc","BAR","indentedHeredoc","BAZ","indentedHeredoc","EXEC"], ["string"," BAR #{fact(10)}"] ],[ ["indentedHeredoc","BAZ","indentedHeredoc","EXEC"], ["support.class","BAR"] ],[ ["indentedHeredoc","BAZ","indentedHeredoc","EXEC"], ["string"," BAZ indented"] ],[ ["indentedHeredoc","EXEC"], ["string"," "], ["support.class","BAZ"] ],[ ["indentedHeredoc","EXEC"], ["string"," echo hi"] ],[ "start", ["string"," "], ["support.class","EXEC"] ],[ "start", ["support.function","puts"], ["text"," "], ["identifier","herDocs"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_rust.json ================================================ [[ "start", ["keyword.source.rust","use"], ["text"," "], ["support.constant","core::rand::"], ["text","RngUtil"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword.source.rust","fn"], ["text"," "], ["entity.name.function.source.rust","main"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","for"], ["text"," "], ["paren.lparen","["], ["string.quoted.double.source.rust","\"Alice\""], ["punctuation.operator",","], ["text"," "], ["string.quoted.double.source.rust","\"Bob\""], ["punctuation.operator",","], ["text"," "], ["string.quoted.double.source.rust","\"Carol\""], ["paren.rparen","]"], ["punctuation.operator","."], ["text","each "], ["keyword.operator","|&"], ["text","name"], ["keyword.operator","|"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","do"], ["text"," spawn "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","let"], ["text"," v "], ["keyword.operator","="], ["text"," "], ["support.constant","rand::"], ["text","Rng"], ["paren.lparen","("], ["paren.rparen",")"], ["punctuation.operator","."], ["text","shuffle"], ["paren.lparen","(["], ["constant.numeric.source.rust","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric.source.rust","2"], ["punctuation.operator",","], ["text"," "], ["constant.numeric.source.rust","3"], ["paren.rparen","])"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.source.rust","for"], ["text"," v"], ["punctuation.operator","."], ["text","each "], ["keyword.operator","|&"], ["text","num"], ["keyword.operator","|"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," print"], ["paren.lparen","("], ["text","fmt"], ["keyword.operator","!"], ["paren.lparen","("], ["string.quoted.double.source.rust","\"%s says: '%d'"], ["constant.character.escape.source.rust","\\n\\\\"], ["string.quoted.double.source.rust","\""], ["punctuation.operator",","], ["text"," name"], ["punctuation.operator",","], ["text"," num "], ["keyword.operator","+"], ["text"," "], ["constant.numeric.source.rust","1"], ["paren.rparen","))"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword.source.rust","let"], ["text"," _ "], ["punctuation.operator",":"], ["storage.type.source.rust","i128"], ["keyword.operator","=-"], ["constant.numeric.source.rust","42i128"], ["punctuation.operator",";"] ],[ "start", ["keyword.source.rust","let"], ["text"," _ "], ["punctuation.operator",":"], ["storage.type.source.rust","u128"], ["keyword.operator","="], ["constant.numeric.source.rust","42u128"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ ["comment","comment"], ["comment.start.block.source.rust","/*"], ["comment.block.source.rust"," nested "], ["comment.start.block.source.rust","/*"], ["comment.block.source.rust"," "] ],[ "start", ["comment.block.source.rust"," comments "], ["comment.end.block.source.rust","*/"], ["comment.block.source.rust"," "], ["comment.end.block.source.rust","*/"] ],[ "start" ],[ "start", ["keyword.source.rust","fn"], ["text"," "], ["entity.name.function.source.rust","map"], ["keyword.operator","<"], ["text","T"], ["punctuation.operator",","], ["text"," U"], ["keyword.operator",">"], ["paren.lparen","("], ["text","vector"], ["punctuation.operator",":"], ["text"," "], ["keyword.operator","&"], ["paren.lparen","["], ["text","T"], ["paren.rparen","]"], ["punctuation.operator",","], ["text"," function"], ["punctuation.operator",":"], ["text"," "], ["keyword.operator","&"], ["text","fn"], ["paren.lparen","("], ["text","v"], ["punctuation.operator",":"], ["text"," "], ["keyword.operator","&"], ["text","T"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","->"], ["text"," U"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","->"], ["text"," ~"], ["paren.lparen","["], ["text","U"], ["paren.rparen","]"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.source.rust","let"], ["text"," "], ["keyword.source.rust","mut"], ["text"," accumulator "], ["keyword.operator","="], ["text"," ~"], ["paren.lparen","["], ["paren.rparen","]"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.source.rust","for"], ["text"," "], ["support.constant","vec::"], ["text","each"], ["paren.lparen","("], ["text","vector"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","|"], ["text","element"], ["keyword.operator","|"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," accumulator"], ["punctuation.operator","."], ["text","push"], ["paren.lparen","("], ["text","function"], ["paren.lparen","("], ["text","element"], ["paren.rparen","))"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword.source.rust","return"], ["text"," accumulator"], ["punctuation.operator",";"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start" ],[ "start", ["comment.line.double-dash.source.rust","// numbers"] ],[ "start", ["constant.numeric.source.rust","14E-111_f64"], ["punctuation.operator",";"], ["text"," "], ["constant.numeric.source.rust","45isize"], ["text"," "], ["constant.numeric.source.rust","0x1i32"], ["text"," "], ["constant.numeric.source.rust","0o777u32"], ["text"," "], ["constant.numeric.source.rust","0b01"], ["text"," "], ["constant.numeric.source.rust","14f32"], ["text"," "], ["constant.numeric.source.rust","1_2.78f32"], ["text"," "], ["constant.numeric.source.rust","1_2.3E+7f32"] ],[ "start" ],[ "start", ["comment.line.double-dash.source.rust","// not numbers"] ],[ "start", ["constant.numeric.source.rust","14"], ["punctuation.operator","."], ["text","_E"], ["keyword.operator","-"], ["constant.numeric.source.rust","111_f64"], ["punctuation.operator",";"], ["text","0xi32"], ["punctuation.operator",";"], ["text","0b777u"] ],[ "start", ["text","foo1"], ["punctuation.operator",";"], ["text","foo1u32"], ["punctuation.operator",";"], ["text","foo1f32"], ["punctuation.operator",";"], ["text","foo0xF"], ["punctuation.operator",";"], ["text","foo1"], ["punctuation.operator","."], ["constant.numeric.source.rust","0"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_sass.json ================================================ [[ "start", ["comment","// sass ace mode;"] ],[ "start" ],[ "start", ["keyword","@import"], ["text"," "], ["support.function","url("], ["string","http://fonts.googleapis.com/css?family=Ace:700"], ["support.function",")"] ],[ "start" ],[ "start", ["variable.language","html"], ["text",", "], ["variable.language","body"] ],[ "start", ["support.type"," :background-color "], ["constant.numeric","#ace"] ],[ "start", ["text"," "], ["support.type","text-align"], ["text",": "], ["constant.language","center"] ],[ "start", ["text"," "], ["support.type","height"], ["text",": "], ["constant.numeric","100%"] ],[ ["comment",-1,2,"start"], ["comment"," /*;*********;"] ],[ ["comment",3,2,"start"], ["comment"," ;comment ;"] ],[ ["comment",3,2,"start"], ["comment"," ;*********;"] ],[ "start" ],[ "start", ["variable.language",".toggle"] ],[ "start", ["text"," "], ["variable","$size"], ["text",": "], ["constant.numeric","14px"] ],[ "start" ],[ "start", ["support.type"," :background "], ["support.function","url("], ["string","http://subtlepatterns.com/patterns/dark_stripes.png"], ["support.function",")"] ],[ "start", ["text"," "], ["support.type","border-radius"], ["text",": "], ["constant.numeric","8px"] ],[ "start", ["text"," "], ["support.type","height"], ["text",": "], ["variable","$size"] ],[ "start" ],[ "start", ["text"," &"], ["variable.language",":before"] ],[ "start", ["text"," "], ["variable","$radius"], ["text",": "], ["variable","$size"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","0.845"] ],[ "start", ["text"," "], ["variable","$glow"], ["text",": "], ["variable","$size"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","0.125"] ],[ "start" ],[ "start", ["text"," "], ["support.type","box-shadow"], ["text",": "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["variable","$glow"], ["text"," "], ["variable","$glow"], ["text"," / "], ["constant.numeric","2"], ["text"," "], ["constant.numeric","#fff"] ],[ "start", ["text"," "], ["support.type","border-radius"], ["text",": "], ["variable","$radius"] ],[ "start", ["text"," "] ],[ "start", ["text"," &"], ["variable.language",":active"] ],[ "start", ["text"," ~ "], ["variable.language",".button"] ],[ "start", ["text"," "], ["support.type","box-shadow"], ["text",": "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","15px"], ["text"," "], ["constant.numeric","25px"], ["text"," "], ["constant.numeric","-4px"], ["text"," "], ["support.function","rgba"], ["paren.lparen","("], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0.4"], ["paren.rparen",")"], ["text"," "] ],[ "start", ["text"," ~ "], ["variable.language",".label"] ],[ "start", ["text"," "], ["support.type","font-size"], ["text",": "], ["constant.numeric","40px"] ],[ "start", ["text"," "], ["support.type","color"], ["text",": "], ["support.function","rgba"], ["paren.lparen","("], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0.45"], ["paren.rparen",")"] ],[ "start" ],[ "start", ["text"," &"], ["variable.language",":checked"], ["text"," "] ],[ "start", ["text"," ~ "], ["variable.language",".button"] ],[ "start", ["text"," "], ["support.type","box-shadow"], ["text",": "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","15px"], ["text"," "], ["constant.numeric","25px"], ["text"," "], ["constant.numeric","-4px"], ["text"," "], ["constant.numeric","#ace"] ],[ "start", ["text"," ~ "], ["variable.language",".label"] ],[ "start", ["text"," "], ["support.type","font-size"], ["text",": "], ["constant.numeric","40px"] ],[ "start", ["text"," "], ["support.type","color"], ["text",": "], ["constant.numeric","#c9c9c9"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_scad.json ================================================ [[ "start", ["comment","// ace can highlight scad!"] ],[ "start", ["keyword","module"], ["text"," "], ["identifier","Element"], ["paren.lparen","("], ["identifier","xpos"], ["text",", "], ["identifier","ypos"], ["text",", "], ["identifier","zpos"], ["paren.rparen",")"], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","translate"], ["paren.lparen","(["], ["identifier","xpos"], ["text",","], ["identifier","ypos"], ["text",","], ["identifier","zpos"], ["paren.rparen","])"], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["identifier","union"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.lparen","{"] ],[ "start", ["text","\t\t\t"], ["identifier","cube"], ["paren.lparen","(["], ["constant.numeric","10"], ["text",","], ["constant.numeric","10"], ["text",","], ["constant.numeric","4"], ["paren.rparen","]"], ["text",","], ["identifier","true"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text","\t\t\t"], ["identifier","cylinder"], ["paren.lparen","("], ["constant.numeric","10"], ["text",","], ["constant.numeric","15"], ["text",","], ["constant.numeric","5"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text","\t\t\t"], ["identifier","translate"], ["paren.lparen","(["], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","10"], ["paren.rparen","])"], ["identifier","sphere"], ["paren.lparen","("], ["constant.numeric","5"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text","\t\t"], ["paren.rparen","}"] ],[ "start", ["text","\t"], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["identifier","union"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["keyword","for"], ["paren.lparen","("], ["identifier","i"], ["keyword.operator","="], ["paren.lparen","["], ["constant.numeric","0"], ["text",":"], ["constant.numeric","30"], ["paren.rparen","])"], ["paren.lparen","{"] ],[ "start", ["text","\t\t# "], ["identifier","Element"], ["paren.lparen","("], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text","\t\t"], ["identifier","Element"], ["paren.lparen","("], ["constant.numeric","15"], ["keyword.operator","*"], ["identifier","i"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text","\t"], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","for"], ["text"," "], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","["], ["constant.numeric","3"], ["text",", "], ["constant.numeric","5"], ["text",", "], ["constant.numeric","7"], ["text",", "], ["constant.numeric","11"], ["paren.rparen","])"], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["identifier","rotate"], ["paren.lparen","(["], ["identifier","i"], ["keyword.operator","*"], ["constant.numeric","10"], ["text",","], ["constant.numeric","0"], ["text",","], ["constant.numeric","0"], ["paren.rparen","])"], ["identifier","scale"], ["paren.lparen","(["], ["constant.numeric","1"], ["text",","], ["constant.numeric","1"], ["text",","], ["identifier","i"], ["paren.rparen","])"], ["identifier","cube"], ["paren.lparen","("], ["constant.numeric","10"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_scala.json ================================================ [[ "start", ["comment","// http://www.scala-lang.org/node/54"] ],[ "start" ],[ "start", ["keyword","package"], ["text"," "], ["identifier","examples"], ["text","."], ["identifier","actors"] ],[ "start" ],[ "start", ["keyword","import"], ["text"," "], ["identifier","scala"], ["text","."], ["identifier","actors"], ["text","."], ["identifier","Actor"] ],[ "start", ["keyword","import"], ["text"," "], ["identifier","scala"], ["text","."], ["identifier","actors"], ["text","."], ["identifier","Actor"], ["text","."], ["identifier","_"] ],[ "start" ],[ "start", ["keyword","abstract"], ["text"," "], ["keyword","class"], ["text"," "], ["identifier","PingMessage"] ],[ "start", ["keyword","case"], ["text"," "], ["keyword","object"], ["text"," "], ["identifier","Start"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","PingMessage"] ],[ "start", ["keyword","case"], ["text"," "], ["keyword","object"], ["text"," "], ["identifier","SendPing"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","PingMessage"] ],[ "start", ["keyword","case"], ["text"," "], ["keyword","object"], ["text"," "], ["identifier","Pong"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","PingMessage"] ],[ "start" ],[ "start", ["keyword","abstract"], ["text"," "], ["keyword","class"], ["text"," "], ["identifier","PongMessage"] ],[ "start", ["keyword","case"], ["text"," "], ["keyword","object"], ["text"," "], ["identifier","Ping"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","PongMessage"] ],[ "start", ["keyword","case"], ["text"," "], ["keyword","object"], ["text"," "], ["identifier","Stop"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","PongMessage"] ],[ "start" ],[ "start", ["keyword","object"], ["text"," "], ["identifier","pingpong"], ["text"," "], ["keyword","extends"], ["text"," "], ["support.function","Application"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","val"], ["text"," "], ["identifier","pong"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Pong"] ],[ "start", ["text"," "], ["keyword","val"], ["text"," "], ["identifier","ping"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Ping"], ["paren.lparen","("], ["constant.numeric","100000"], ["text",", "], ["identifier","pong"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","ping"], ["text","."], ["identifier","start"] ],[ "start", ["text"," "], ["identifier","pong"], ["text","."], ["identifier","start"] ],[ "start", ["text"," "], ["identifier","ping"], ["text"," "], ["keyword.operator","!"], ["text"," "], ["identifier","Start"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Ping"], ["paren.lparen","("], ["identifier","count"], ["text",": "], ["support.function","Int"], ["text",", "], ["identifier","pong"], ["text",": "], ["identifier","Actor"], ["paren.rparen",")"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","Actor"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","def"], ["text"," "], ["identifier","act"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","println"], ["paren.lparen","("], ["string","\"Ping: Initializing with count \""], ["keyword.operator","+"], ["identifier","count"], ["keyword.operator","+"], ["string","\": \""], ["keyword.operator","+"], ["identifier","pong"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","var"], ["text"," "], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","count"] ],[ "start", ["text"," "], ["identifier","loop"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","react"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","case"], ["text"," "], ["identifier","Start"], ["text"," "], ["keyword.operator","=>"] ],[ "start", ["text"," "], ["keyword","println"], ["paren.lparen","("], ["string","\"Ping: starting.\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","pong"], ["text"," "], ["keyword.operator","!"], ["text"," "], ["identifier","Ping"] ],[ "start", ["text"," "], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","case"], ["text"," "], ["identifier","SendPing"], ["text"," "], ["keyword.operator","=>"] ],[ "start", ["text"," "], ["identifier","pong"], ["text"," "], ["keyword.operator","!"], ["text"," "], ["identifier","Ping"] ],[ "start", ["text"," "], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator","-"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","case"], ["text"," "], ["identifier","Pong"], ["text"," "], ["keyword.operator","=>"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator","%"], ["text"," "], ["constant.numeric","1000"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","println"], ["paren.lparen","("], ["string","\"Ping: pong from: \""], ["keyword.operator","+"], ["identifier","sender"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","pingsLeft"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","self"], ["text"," "], ["keyword.operator","!"], ["text"," "], ["identifier","SendPing"] ],[ "start", ["text"," "], ["keyword","else"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","println"], ["paren.lparen","("], ["string","\"Ping: Stop.\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","pong"], ["text"," "], ["keyword.operator","!"], ["text"," "], ["identifier","Stop"] ],[ "start", ["text"," "], ["identifier","exit"], ["paren.lparen","("], ["symbol.constant","'stop"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Pong"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","Actor"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","def"], ["text"," "], ["identifier","act"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","var"], ["text"," "], ["identifier","pongCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["identifier","loop"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","react"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","case"], ["text"," "], ["identifier","Ping"], ["text"," "], ["keyword.operator","=>"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","pongCount"], ["text"," "], ["keyword.operator","%"], ["text"," "], ["constant.numeric","1000"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["keyword","println"], ["paren.lparen","("], ["string","\"Pong: ping \""], ["keyword.operator","+"], ["identifier","pongCount"], ["keyword.operator","+"], ["string","\" from \""], ["keyword.operator","+"], ["identifier","sender"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","sender"], ["text"," "], ["keyword.operator","!"], ["text"," "], ["identifier","Pong"] ],[ "start", ["text"," "], ["identifier","pongCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","pongCount"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","case"], ["text"," "], ["identifier","Stop"], ["text"," "], ["keyword.operator","=>"] ],[ "start", ["text"," "], ["keyword","println"], ["paren.lparen","("], ["string","\"Pong: Stop.\""], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","exit"], ["paren.lparen","("], ["symbol.constant","'stop"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_scheme.json ================================================ [[ "start", ["text","("], ["storage.type.function-type.scheme","define"], ["text"," "], ["text","("], ["identifier","prompt-for-cd"], ["text",")"] ],[ "start", ["text"," "], ["string","\"Prompts"] ],[ "start", ["text"," "], ["identifier","for"], ["text"," "], ["identifier","CD"], ["text","\""] ],[ "start", ["text"," ("], ["identifier","prompt-read"], ["text"," "], ["string","\"Title\""], ["text"," "], ["constant.numeric","1.53"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text","/"], ["constant.numeric","4"], ["text"," "], ["constant.numeric","1.7"], ["text"," "], ["constant.numeric","1.7e0"], ["text"," "], ["constant.numeric","2.9E-4"], ["text"," "], ["constant.numeric","+42"], ["text"," "], ["constant.numeric","-7"], ["text"," "], ["constant.numeric","#b001"], ["text"," "], ["constant.numeric","#b001"], ["text","/"], ["constant.numeric","100"], ["text"," "], ["constant.numeric","#o777"], ["text"," "], ["constant.numeric","#O777"], ["text"," "], ["constant.numeric","#xabc55"], ["text"," "], ["identifier","#c"], ["text","("], ["constant.numeric","0"], ["text"," "], ["constant.numeric","-5.6"], ["text","))"] ],[ "start", ["text"," ("], ["identifier","prompt-read"], ["text"," "], ["string","\"Artist\""], ["text",")"] ],[ "start", ["text"," ("], ["keyword.operator","or"], ["text"," ("], ["identifier","parse-integer"], ["text"," ("], ["identifier","prompt-read"], ["text"," "], ["string","\"Rating\""], ["text",") "], ["punctuation.definition.constant.character.scheme","#:junk-allowed"], ["text"," "], ["constant.language","#t"], ["text",") "], ["constant.numeric","0"], ["text",")"] ],[ "start", ["text"," ("], ["keyword.control","if"], ["text"," "], ["identifier","x"], ["text"," ("], ["support.function","format"], ["text"," "], ["constant.language","#t"], ["text"," "], ["string","\"yes\""], ["text",") ("], ["support.function","format"], ["text"," "], ["constant.language","#f"], ["text"," "], ["string","\"no\""], ["text",") "], ["comment",";and here comment"] ],[ "start", ["text"," ) "] ],[ "start", ["text"," "], ["comment",";; second line comment"] ],[ "start", ["text"," '(+ "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text",")"] ],[ "start", ["text"," ("], ["identifier","position-if-not"], ["text"," "], ["identifier","char-set"], ["text",":"], ["identifier","whitespace"], ["text"," "], ["identifier","line"], ["text"," "], ["punctuation.definition.constant.character.scheme","#:start"], ["text"," "], ["identifier","beg"], ["text","))"] ],[ "start", ["text"," ("], ["support.function","quote"], ["text"," ("], ["identifier","privet"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["constant.numeric","3"], ["text","))"] ],[ "start", ["text"," '("], ["identifier","hello"], ["text"," "], ["identifier","world"], ["text",")"] ],[ "start", ["text"," (* "], ["constant.numeric","5"], ["text"," "], ["constant.numeric","7"], ["text",")"] ],[ "start", ["text"," ("], ["constant.numeric","1"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["constant.numeric","34"], ["text"," "], ["constant.numeric","5"], ["text",")"] ],[ "start", ["text"," ("], ["punctuation.definition.constant.character.scheme","#:use"], ["text"," "], ["string","\"aaaa\""], ["text",")"] ],[ "start", ["text"," ("], ["keyword.control","let"], ["text"," (("], ["identifier","x"], ["text"," "], ["constant.numeric","10"], ["text",") ("], ["identifier","y"], ["text"," "], ["constant.numeric","20"], ["text","))"] ],[ "start", ["text"," ("], ["identifier","display"], ["text"," (+ "], ["identifier","x"], ["text"," "], ["identifier","y"], ["text","))"] ],[ "start", ["text"," ) "] ],[ "start" ],[ "start", ["text"," "], ["string","\"asdad"], ["constant.character.escape.scheme","\\0"], ["string","eqweqe\""] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_scss.json ================================================ [[ "start", ["comment","/* style.scss */"] ],[ "start" ],[ "start", ["variable.language","#navbar"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable","$navbar-width"], ["text",": "], ["constant.numeric","800px"], ["text",";"] ],[ "start", ["text"," "], ["variable","$items"], ["text",": "], ["constant.numeric","5"], ["text",";"] ],[ "start", ["text"," "], ["variable","$navbar-color"], ["text",": "], ["constant.numeric","#ce4dd6"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["support.type","width"], ["text",": "], ["variable","$navbar-width"], ["text",";"] ],[ "start", ["text"," "], ["support.type","border-bottom"], ["text",": "], ["constant.numeric","2px"], ["text"," "], ["constant.language","solid"], ["text"," "], ["variable","$navbar-color"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["variable.language","li"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.type","float"], ["text",": "], ["support.type","left"], ["text",";"] ],[ "start", ["text"," "], ["support.type","width"], ["text",": "], ["variable","$navbar-width"], ["text","/"], ["variable","$items"], ["text"," "], ["constant","-"], ["text"," "], ["constant.numeric","10px"], ["text",";"] ],[ "start" ],[ "start", ["text"," "], ["support.type","background-color"], ["text",": "], ["support.function","lighten"], ["paren.lparen","("], ["variable","$navbar-color"], ["text",", "], ["constant.numeric","20%"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," &"], ["variable.language",":hover"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.type","background-color"], ["text",": "], ["support.function","lighten"], ["paren.lparen","("], ["variable","$navbar-color"], ["text",", "], ["constant.numeric","10%"], ["paren.rparen",")"], ["text",";"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_sh.json ================================================ [[ "start", ["comment","#!/bin/sh"] ],[ "start" ],[ "start", ["comment","# Script to open a browser to current branch"] ],[ "start", ["comment","# Repo formats:"] ],[ "start", ["comment","# ssh git@github.com:richo/gh_pr.git"] ],[ "start", ["comment","# http https://richoH@github.com/richo/gh_pr.git"] ],[ "start", ["comment","# git git://github.com/richo/gh_pr.git"] ],[ "start" ],[ "start", ["variable","username"], ["keyword.operator","=`"], ["identifier","git"], ["text"," "], ["identifier","config"], ["text"," "], ["keyword.operator","--"], ["identifier","get"], ["text"," "], ["identifier","github"], ["text","."], ["identifier","user"], ["keyword.operator","`"] ],[ "start" ],[ "start", ["support.function","get_repo()"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","git"], ["text"," "], ["identifier","remote"], ["text"," "], ["keyword.operator","-"], ["identifier","v"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","grep"], ["text"," "], ["variable","$"], ["paren.lparen","{"], ["variable","@"], ["keyword.operator",":-"], ["variable","$username"], ["paren.rparen","}"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["keyword","while"], ["text"," "], ["keyword","read"], ["text"," "], ["identifier","remote"], ["punctuation.operator",";"], ["text"," "], ["keyword","do"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","repo"], ["keyword.operator","=`"], ["support.function.builtin","echo"], ["text"," "], ["variable","$remote"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","grep"], ["text"," "], ["keyword.operator","-"], ["identifier","E"], ["text"," "], ["keyword.operator","-"], ["identifier","o"], ["text"," "], ["string.start","\""], ["string","git@github.com:[^ ]*"], ["string.end","\""], ["keyword.operator","`"], ["punctuation.operator",";"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["support.function.builtin","echo"], ["text"," "], ["variable","$repo"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","sed"], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s/^git@github\\.com://"], ["string.end","\""], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s/\\.git$//"], ["string.end","\""] ],[ "start", ["text"," "], ["support.function.builtin","exit"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","fi"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","repo"], ["keyword.operator","=`"], ["support.function.builtin","echo"], ["text"," "], ["variable","$remote"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","grep"], ["text"," "], ["keyword.operator","-"], ["identifier","E"], ["text"," "], ["keyword.operator","-"], ["identifier","o"], ["text"," "], ["string.start","\""], ["string","https?://([^@]*@)?github.com/[^ ]*\\.git"], ["string.end","\""], ["keyword.operator","`"], ["punctuation.operator",";"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["support.function.builtin","echo"], ["text"," "], ["variable","$repo"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","sed"], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s|^https?://||"], ["string.end","\""], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s/^.*github\\.com\\///"], ["string.end","\""], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s/\\.git$//"], ["string.end","\""] ],[ "start", ["text"," "], ["support.function.builtin","exit"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","fi"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["variable","repo"], ["keyword.operator","=`"], ["support.function.builtin","echo"], ["text"," "], ["variable","$remote"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","grep"], ["text"," "], ["keyword.operator","-"], ["identifier","E"], ["text"," "], ["keyword.operator","-"], ["identifier","o"], ["text"," "], ["string.start","\""], ["string","git://github.com/[^ ]*\\.git"], ["string.end","\""], ["keyword.operator","`"], ["punctuation.operator",";"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["support.function.builtin","echo"], ["text"," "], ["variable","$repo"], ["text"," "], ["keyword.operator","|"], ["text"," "], ["identifier","sed"], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s|^git://github.com/||"], ["string.end","\""], ["text"," "], ["keyword.operator","-"], ["identifier","e"], ["text"," "], ["string.start","\""], ["string","s/\\.git$//"], ["string.end","\""] ],[ "start", ["text"," "], ["support.function.builtin","exit"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","fi"] ],[ "start", ["text"," "], ["keyword","done"] ],[ "start" ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","["], ["text"," "], ["variable.language","$?"], ["text"," "], ["keyword.operator","-"], ["identifier","eq"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["paren.rparen","]"], ["punctuation.operator",";"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["support.function.builtin","echo"], ["text"," "], ["string.start","\""], ["string","Couldn't find a valid remote"], ["string.end","\""], ["text"," "], ["keyword.operator",">"], ["support.function","&2"] ],[ "start", ["text"," "], ["support.function.builtin","exit"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text"," "], ["keyword","fi"] ],[ "start", ["paren.rparen","}"] ],[ "start" ],[ "start", ["support.function.builtin","echo"], ["text"," "], ["variable","$"], ["paren.lparen","{"], ["keyword.operator","#"], ["variable","x"], ["paren.lparen","["], ["text","@"], ["paren.rparen","]}"] ],[ "start" ],[ "start", ["keyword","if"], ["text"," "], ["variable","repo"], ["keyword.operator","=`"], ["identifier","get_repo"], ["text"," "], ["variable","$@"], ["keyword.operator","`"], ["punctuation.operator",";"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["variable","branch"], ["keyword.operator","=`"], ["identifier","git"], ["text"," "], ["identifier","symbolic"], ["keyword.operator","-"], ["identifier","ref"], ["text"," "], ["identifier","HEAD"], ["text"," "], ["constant.numeric","2"], ["keyword.operator",">/"], ["identifier","dev"], ["keyword.operator","/"], ["identifier","null"], ["keyword.operator","`"] ],[ "start", ["text"," "], ["support.function.builtin","echo"], ["text"," "], ["string.start","\""], ["string","http://github.com/"], ["variable","$repo"], ["string","/pull/new/"], ["variable","$"], ["paren.lparen","{"], ["variable","branch"], ["keyword.operator","##"], ["identifier","refs"], ["keyword.operator","/"], ["identifier","heads"], ["keyword.operator","/"], ["paren.rparen","}"], ["string.end","\""] ],[ "start", ["keyword","else"] ],[ "start", ["text"," "], ["support.function.builtin","exit"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["keyword","fi"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_sjs.json ================================================ [[ "start", ["storage.type","var"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","each"], ["punctuation.operator",","], ["text"," "], ["identifier","map"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","require"], ["paren.lparen","("], ["string","'sjs:sequence'"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["storage.type","var"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["keyword","get"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","require"], ["paren.lparen","("], ["string","'sjs:http'"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["storage.type","function"], ["text"," "], ["entity.name.function","foo"], ["paren.lparen","("], ["variable.parameter","items"], ["punctuation.operator",", "], ["variable.parameter","nada"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ ["no_regex"], ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","component"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","name"], ["punctuation.operator",":"], ["text"," "], ["string","\"Ace\""], ["punctuation.operator",","], ["text"," "], ["identifier","role"], ["punctuation.operator",":"], ["text"," "], ["string","\"Editor\""], ["text"," "], ["paren.rparen","}"], ["punctuation.operator",";"] ],[ ["qqstring","no_regex"], ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","\""] ],[ ["qqstring","no_regex"], ["string"," Welcome, "], ["paren.lparen","#{"], ["identifier","component"], ["text","."], ["identifier","name"], ["paren.rparen","}"] ],[ ["no_regex"], ["string"," \""], ["punctuation.operator","."], ["identifier","trim"], ["paren.lparen","("], ["paren.rparen","))"], ["punctuation.operator",";"] ],[ ["no_regex"] ],[ ["no_regex"], ["text"," "], ["identifier","logging"], ["punctuation.operator","."], ["identifier","debug"], ["paren.lparen","("], ["string","`Component added: "], ["paren.lparen","$"], ["identifier","String"], ["paren.lparen","("], ["identifier","component"], ["paren.rparen",")"], ["string"," ("], ["paren.lparen","${"], ["identifier","component"], ["paren.rparen","}"], ["string",")`"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ ["no_regex"] ],[ ["bstring","no_regex"], ["text"," "], ["storage.type","console"], ["punctuation.operator","."], ["support.function.firebug","log"], ["paren.lparen","("], ["string","`"] ],[ ["string_interp","string_interp","bstring","no_regex"], ["string"," Welcome, {"], ["paren.lparen","${"], ["storage.type","function"], ["text","() "], ["paren.lparen","{"] ],[ ["string_interp","string_interp","bstring","no_regex"], ["text"," "], ["keyword","return"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["identifier","x"], ["text",": "], ["constant.numeric","1"], ["text",", "], ["identifier","y"], ["text",": "], ["string","\"why?}\""], ["paren.rparen","}"], ["text",";"] ],[ ["bstring","no_regex"], ["text"," "], ["paren.rparen","}"], ["text","()"], ["paren.rparen","}"] ],[ ["no_regex"], ["string"," `"], ["punctuation.operator","."], ["identifier","trim"], ["paren.lparen","("], ["paren.rparen","))"], ["punctuation.operator",";"] ],[ ["no_regex"] ],[ ["no_regex"], ["text"," "], ["keyword","waitfor"], ["text"," "], ["paren.lparen","{"] ],[ ["no_regex"], ["text"," "], ["identifier","items"], ["text"," "], ["keyword.operator",".."], ["text"," "], ["identifier","each"], ["punctuation.operator","."], ["identifier","par"], ["text"," "], ["paren.lparen","{"], ["text"," "], ["paren.rparen","|"], ["variable.parameter","item"], ["paren.rparen","|"] ],[ ["no_regex"], ["text"," "], ["keyword","get"], ["paren.lparen","("], ["identifier","item"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ ["no_regex"], ["text"," "], ["paren.rparen","}"] ],[ ["no_regex"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","and"], ["text"," "], ["paren.lparen","{"] ],[ ["no_regex"], ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","lengths"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","items"], ["text"," "], ["keyword.operator",".."], ["text"," "], ["identifier","map"], ["paren.lparen","("], ["identifier","i"], ["text"," "], ["keyword.operator","->"], ["text"," "], ["identifier","i"], ["punctuation.operator","."], ["support.constant","length"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ ["no_regex"], ["text"," "], ["paren.rparen","}"], ["text"," "], ["keyword","or"], ["text"," "], ["paren.lparen","{"] ],[ ["no_regex"], ["text"," "], ["variable.language","hold"], ["paren.lparen","("], ["constant.numeric","1500"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ ["no_regex"], ["text"," "], ["keyword","throw"], ["text"," "], ["keyword","new"], ["text"," "], ["variable.language","Error"], ["paren.lparen","("], ["string","\"timed out\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ ["no_regex"], ["text"," "], ["paren.rparen","}"] ],[ ["no_regex"], ["paren.rparen","}"], ["text","\t"], ["comment","// Real Tab."] ],[ ["no_regex"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_smarty.json ================================================ [[ "start", ["punctuation.section.embedded.begin.smarty","{"], ["keyword.control.smarty","foreach"], ["source.smarty"," "], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","foo"], ["source.smarty"," as "], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["punctuation.section.embedded.end.smarty","}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.section.embedded.begin.smarty","{"], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["source.smarty",".zig"], ["punctuation.section.embedded.end.smarty","}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.section.embedded.begin.smarty","{"], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["source.smarty",".zag"], ["punctuation.section.embedded.end.smarty","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.section.embedded.begin.smarty","{"], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["source.smarty",".zig2"], ["punctuation.section.embedded.end.smarty","}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.section.embedded.begin.smarty","{"], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["source.smarty",".zag2"], ["punctuation.section.embedded.end.smarty","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["punctuation.section.embedded.begin.smarty","{"], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["source.smarty",".zig3"], ["punctuation.section.embedded.end.smarty","}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["punctuation.section.embedded.begin.smarty","{"], ["punctuation.definition.variable.smarty","$"], ["variable.other.smarty","bar"], ["source.smarty",".zag3"], ["punctuation.section.embedded.end.smarty","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["punctuation.section.embedded.begin.smarty","{"], ["keyword.control.smarty","foreachelse"], ["punctuation.section.embedded.end.smarty","}"] ],[ "start", ["text.xml"," There were no rows found."] ],[ "start", ["punctuation.section.embedded.begin.smarty","{"], ["source.smarty","/"], ["keyword.control.smarty","foreach"], ["punctuation.section.embedded.end.smarty","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_snippets.json ================================================ [[ "start", ["comment","# Function"] ],[ "start", ["constant.language.escape","snippet"], ["text"," fun"] ],[ "sn-start", ["text","\tfunction "], ["markup.list","${"], ["constant.numeric","1"], ["text","?:function_name"], ["markup.list","}"], ["text","("], ["markup.list","${"], ["constant.numeric","2"], ["punctuation.operator",":"], ["text","argument"], ["markup.list","}"], ["text",") {"] ],[ "sn-start", ["text","\t\t"], ["markup.list","${"], ["constant.numeric","3"], ["punctuation.operator",":"], ["text","// body..."], ["markup.list","}"] ],[ "sn-start", ["text","\t}"] ],[ "start", ["comment","# Anonymous Function"] ],[ "start", ["constant.language.escape","regex "], ["keyword","/"], ["text","((=)\\s*|(:)\\s*|(\\()|\\b)"], ["keyword","/"], ["text","f"], ["keyword","/"], ["text","(\\))?"], ["keyword","/"] ],[ "start", ["constant.language.escape","name"], ["text"," f"] ],[ "sn-start", ["text","\tfunction"], ["markup.list","${"], ["variable","M1"], ["text","?: "], ["markup.list","${"], ["constant.numeric","1"], ["punctuation.operator",":"], ["text","functionName"], ["markup.list","}}"], ["text","("], ["variable","$2"], ["text",") {"] ],[ "sn-start", ["text","\t\t"], ["markup.list","${"], ["constant.numeric","0"], ["punctuation.operator",":"], ["keyword","$TM_SELECTED_TEXT"], ["markup.list","}"] ],[ "sn-start", ["text","\t}"], ["markup.list","${"], ["variable","M2"], ["text","?;"], ["markup.list","}${"], ["variable","M3"], ["text","?,"], ["markup.list","}${"], ["variable","M4"], ["text","?)"], ["markup.list","}"] ],[ "start", ["comment","# Immediate function"] ],[ "start", ["constant.language.escape","trigger"], ["text"," \\(?f\\("] ],[ "start", ["constant.language.escape","endTrigger"], ["text"," \\)?"] ],[ "start", ["constant.language.escape","snippet"], ["text"," f("] ],[ "sn-start", ["text","\t(function("], ["markup.list","${"], ["constant.numeric","1"], ["markup.list","}"], ["text",") {"] ],[ "sn-start", ["text","\t\t"], ["markup.list","${"], ["constant.numeric","0"], ["punctuation.operator",":"], ["markup.list","${"], ["keyword","TM_SELECTED_TEXT"], ["punctuation.operator",":"], ["text","/* code */"], ["markup.list","}}"] ],[ "sn-start", ["text","\t}("], ["markup.list","${"], ["constant.numeric","1"], ["markup.list","}"], ["text","));"] ],[ "start", ["comment","# if"] ],[ "start", ["constant.language.escape","snippet"], ["text"," if"] ],[ "sn-start", ["text","\tif ("], ["markup.list","${"], ["constant.numeric","1"], ["punctuation.operator",":"], ["text","true"], ["markup.list","}"], ["text",") {"] ],[ "sn-start", ["text","\t\t"], ["markup.list","${"], ["constant.numeric","0"], ["markup.list","}"] ],[ "sn-start", ["text","\t}"] ],[ "sn-start", ["text","\t"] ],[ "sn-start", ["text","\t"] ],[ "sn-start", ["text","\t"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_soy_template.json ================================================ [[ "punctuation.definition.comment.begin.soy1", ["punctuation.definition.comment.begin.soy","/**"] ],[ "punctuation.definition.comment.begin.soy1", ["comment.block.documentation.soy"," * Greets a person using \"Hello\" by default."] ],[ "punctuation.definition.comment.begin.soy1", ["comment.block.documentation.soy"," * "], ["support.type.soy","@param"], ["text"," "], ["variable.parameter.soy","name"], ["comment.block.documentation.soy"," The name of the person."] ],[ "punctuation.definition.comment.begin.soy1", ["comment.block.documentation.soy"," * "], ["support.type.soy","@param?"], ["text"," "], ["variable.parameter.soy","greetingWord"], ["comment.block.documentation.soy"," Optional greeting word to use instead of \"Hello\"."] ],[ "start", ["comment.block.documentation.soy"," "], ["punctuation.definition.comment.end.soy","*/"] ],[ "start", ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","template"], ["text"," "], ["entity.name.function.soy",".helloName"], ["meta.tag.template.soy"," #eee"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","if"], ["meta.tag.if.soy"," "], ["keyword.operator.soy","not"], ["meta.tag.if.soy"," "], ["variable.other.soy","$greetingWord"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," Hello "], ["punctuation.definition.tag.begin.soy","{"], ["variable.other.soy","$name"], ["punctuation.definition.tag.end.soy","}"], ["text.xml","!"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["text","else"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["variable.other.soy","$greetingWord"], ["punctuation.definition.tag.end.soy","}"], ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["variable.other.soy","$name"], ["punctuation.definition.tag.end.soy","}"], ["text.xml","!"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{/"], ["entity.name.tag.soy","if"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["punctuation.definition.tag.begin.soy","{/"], ["meta.tag.template.soy","template"], ["punctuation.definition.tag.end.soy","}"] ],[ "start" ],[ "punctuation.definition.comment.begin.soy1", ["punctuation.definition.comment.begin.soy","/**"] ],[ "punctuation.definition.comment.begin.soy1", ["comment.block.documentation.soy"," * Greets a person and optionally a list of other people."] ],[ "punctuation.definition.comment.begin.soy1", ["comment.block.documentation.soy"," * "], ["support.type.soy","@param"], ["text"," "], ["variable.parameter.soy","name"], ["comment.block.documentation.soy"," The name of the person."] ],[ "punctuation.definition.comment.begin.soy1", ["comment.block.documentation.soy"," * "], ["support.type.soy","@param"], ["text"," "], ["variable.parameter.soy","additionalNames"], ["comment.block.documentation.soy"," The additional names to greet. May be an empty list."] ],[ "start", ["comment.block.documentation.soy"," "], ["punctuation.definition.comment.end.soy","*/"] ],[ "start", ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","template"], ["text"," "], ["entity.name.function.soy",".helloNames"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["comment.line.double-slash.soy","//"], ["comment.line.double-slash.soy"," Greet the person."] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","call"], ["variable.parameter.soy"," .helloName"], ["meta.tag.call.soy"," "], ["entity.other.attribute-name.soy","data"], ["keyword.operator.soy","="], ["string.quoted.double","\"all\""], ["meta.tag.call.soy"," /"], ["punctuation.definition.tag.end.soy","}"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","br"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["comment.line.double-slash.soy","//"], ["comment.line.double-slash.soy"," Greet the additional people."] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","foreach"], ["meta.tag.foreach.soy"," "], ["variable.other.soy","$additionalName"], ["meta.tag.foreach.soy"," "], ["keyword.operator.soy","in"], ["meta.tag.foreach.soy"," "], ["variable.other.soy","$additionalNames"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","call"], ["variable.parameter.soy"," .helloName"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","param"], ["meta.tag.param.soy"," "], ["entity.other.attribute-name.soy","name"], ["keyword.operator.soy",":"], ["meta.tag.param.soy"," "], ["variable.other.soy","$additionalName"], ["meta.tag.param.soy"," /"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{/"], ["meta.tag.call.soy","call"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","if"], ["meta.tag.if.soy"," "], ["keyword.operator.soy","not"], ["meta.tag.if.soy"," "], ["support.function.soy","isLast"], ["meta.tag.if.soy","("], ["variable.other.soy","$additionalName"], ["meta.tag.if.soy",")"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","br"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml"," "], ["comment.line.double-slash.soy","//"], ["comment.line.double-slash.soy"," break after every line except the last"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{/"], ["entity.name.tag.soy","if"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{"], ["text","ifempty"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," No additional people to greet."] ],[ "start", ["text.xml"," "], ["punctuation.definition.tag.begin.soy","{/"], ["entity.name.tag.soy","foreach"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["punctuation.definition.tag.begin.soy","{/"], ["meta.tag.template.soy","template"], ["punctuation.definition.tag.end.soy","}"] ],[ "start" ],[ "start" ],[ "start", ["punctuation.definition.tag.begin.soy","{/"], ["entity.name.tag.soy","foreach"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","if"], ["meta.tag.if.soy"," "], ["support.function.soy","length"], ["meta.tag.if.soy","("], ["variable.other.soy","$items"], ["meta.tag.if.soy",") > 5"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","msg"], ["meta.tag.msg.soy"," "], ["entity.other.attribute-name.soy","desc"], ["keyword.operator.soy","="], ["string.quoted.double","\"Says hello to the user.\""], ["punctuation.definition.tag.end.soy","}"] ],[ "start" ],[ "start" ],[ "start", ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","namespace"], ["text"," "], ["variable.parameter.soy","ns"], ["text"," autoescape=\"contextual\""], ["punctuation.definition.tag.end.soy","}"] ],[ "start" ],[ "start", ["punctuation.definition.comment.begin.soy","/**"], ["comment.block.documentation.soy"," Example. "], ["punctuation.definition.comment.end.soy","*/"] ],[ "start", ["punctuation.definition.tag.begin.soy","{"], ["entity.name.tag.soy","template"], ["text"," "], ["entity.name.function.soy",".example"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["text.xml"," foo is "], ["punctuation.definition.tag.begin.soy","{"], ["variable.other.soy","$ij.foo"], ["punctuation.definition.tag.end.soy","}"] ],[ "start", ["punctuation.definition.tag.begin.soy","{/"], ["meta.tag.template.soy","template"], ["punctuation.definition.tag.end.soy","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_space.json ================================================ [[ "start", ["variable","query"] ],[ "start", ["empty_line"," "], ["variable","count"], ["keyword.operator"," "], ["string","10"] ],[ "start", ["empty_line"," "], ["variable","created"], ["keyword.operator"," "], ["string","2011-06-21T08:10:46Z"] ],[ "start", ["empty_line"," "], ["variable","lang"], ["keyword.operator"," "], ["string","en-US"] ],[ "start", ["empty_line"," "], ["variable","results"] ],[ "start", ["empty_line"," "], ["variable","photo"] ],[ "start", ["empty_line"," "], ["variable","0"] ],[ "start", ["empty_line"," "], ["variable","farm"], ["keyword.operator"," "], ["string","6"] ],[ "start", ["empty_line"," "], ["variable","id"], ["keyword.operator"," "], ["string","5855620975"] ],[ "start", ["empty_line"," "], ["variable","isfamily"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","isfriend"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","ispublic"], ["keyword.operator"," "], ["string","1"] ],[ "start", ["empty_line"," "], ["variable","owner"], ["keyword.operator"," "], ["string","32021554@N04"] ],[ "start", ["empty_line"," "], ["variable","secret"], ["keyword.operator"," "], ["string","f1f5e8515d"] ],[ "start", ["empty_line"," "], ["variable","server"], ["keyword.operator"," "], ["string","5110"] ],[ "start", ["empty_line"," "], ["variable","title"], ["keyword.operator"," "], ["string","7087 bandit cat"] ],[ "start", ["empty_line"," "], ["variable","1"] ],[ "start", ["empty_line"," "], ["variable","farm"], ["keyword.operator"," "], ["string","4"] ],[ "start", ["empty_line"," "], ["variable","id"], ["keyword.operator"," "], ["string","5856170534"] ],[ "start", ["empty_line"," "], ["variable","isfamily"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","isfriend"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","ispublic"], ["keyword.operator"," "], ["string","1"] ],[ "start", ["empty_line"," "], ["variable","owner"], ["keyword.operator"," "], ["string","32021554@N04"] ],[ "start", ["empty_line"," "], ["variable","secret"], ["keyword.operator"," "], ["string","ff1efb2a6f"] ],[ "start", ["empty_line"," "], ["variable","server"], ["keyword.operator"," "], ["string","3217"] ],[ "start", ["empty_line"," "], ["variable","title"], ["keyword.operator"," "], ["string","6975 rusty cat"] ],[ "start", ["empty_line"," "], ["variable","2"] ],[ "start", ["empty_line"," "], ["variable","farm"], ["keyword.operator"," "], ["string","6"] ],[ "start", ["empty_line"," "], ["variable","id"], ["keyword.operator"," "], ["string","5856172972"] ],[ "start", ["empty_line"," "], ["variable","isfamily"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","isfriend"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","ispublic"], ["keyword.operator"," "], ["string","1"] ],[ "start", ["empty_line"," "], ["variable","owner"], ["keyword.operator"," "], ["string","51249875@N03"] ],[ "start", ["empty_line"," "], ["variable","secret"], ["keyword.operator"," "], ["string","6c6887347c"] ],[ "start", ["empty_line"," "], ["variable","server"], ["keyword.operator"," "], ["string","5192"] ],[ "start", ["empty_line"," "], ["variable","title"], ["keyword.operator"," "], ["string","watermarked-cats"] ],[ "start", ["empty_line"," "], ["variable","3"] ],[ "start", ["empty_line"," "], ["variable","farm"], ["keyword.operator"," "], ["string","6"] ],[ "start", ["empty_line"," "], ["variable","id"], ["keyword.operator"," "], ["string","5856168328"] ],[ "start", ["empty_line"," "], ["variable","isfamily"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","isfriend"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","ispublic"], ["keyword.operator"," "], ["string","1"] ],[ "start", ["empty_line"," "], ["variable","owner"], ["keyword.operator"," "], ["string","32021554@N04"] ],[ "start", ["empty_line"," "], ["variable","secret"], ["keyword.operator"," "], ["string","0c1cfdf64c"] ],[ "start", ["empty_line"," "], ["variable","server"], ["keyword.operator"," "], ["string","5078"] ],[ "start", ["empty_line"," "], ["variable","title"], ["keyword.operator"," "], ["string","7020 mandy cat"] ],[ "start", ["empty_line"," "], ["variable","4"] ],[ "start", ["empty_line"," "], ["variable","farm"], ["keyword.operator"," "], ["string","3"] ],[ "start", ["empty_line"," "], ["variable","id"], ["keyword.operator"," "], ["string","5856171774"] ],[ "start", ["empty_line"," "], ["variable","isfamily"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","isfriend"], ["keyword.operator"," "], ["string","0"] ],[ "start", ["empty_line"," "], ["variable","ispublic"], ["keyword.operator"," "], ["string","1"] ],[ "start", ["empty_line"," "], ["variable","owner"], ["keyword.operator"," "], ["string","32021554@N04"] ],[ "start", ["empty_line"," "], ["variable","secret"], ["keyword.operator"," "], ["string","7f5a3180ab"] ],[ "start", ["empty_line"," "], ["variable","server"], ["keyword.operator"," "], ["string","2696"] ],[ "start", ["empty_line"," "], ["variable","title"], ["keyword.operator"," "], ["string","7448 bobby cat"] ],[ "key" ]] ================================================ FILE: lib/ace/mode/_test/tokens_sql.json ================================================ [[ "start", ["keyword","SELECT"], ["text"," "], ["identifier","city"], ["text",", "], ["support.function","COUNT"], ["paren.lparen","("], ["identifier","id"], ["paren.rparen",")"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","users_count"] ],[ "start", ["keyword","FROM"], ["text"," "], ["identifier","users"] ],[ "start", ["keyword","WHERE"], ["text"," "], ["identifier","group_name"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","'salesman'"] ],[ "start", ["keyword","AND"], ["text"," "], ["identifier","created"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["string","'2011-05-21'"] ],[ "start", ["keyword","GROUP"], ["text"," "], ["keyword","BY"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["keyword","ORDER"], ["text"," "], ["keyword","BY"], ["text"," "], ["constant.numeric","2"], ["text"," "], ["keyword","DESC"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_sqlserver.json ================================================ [[ "start", ["comment","-- ============================================="] ],[ "start", ["comment","-- Author:\t\tMorgan Yarbrough"] ],[ "start", ["comment","-- Create date: 4/27/2015"] ],[ "start", ["comment","-- Description:\tTest procedure that shows off language features."] ],[ "start", ["comment","-- \t\t\t\tIncludes non-standard folding with region comments using either"] ],[ "start", ["comment","-- \t\t\t\tline comments or block comments (both are demonstrated below)."] ],[ "start", ["comment","--\t\t\t\tThis mode imitates SSMS and it designed to be used with SQL Server theme."] ],[ "start", ["comment","-- ============================================="] ],[ "start", ["keyword","CREATE"], ["text"," "], ["keyword","PROCEDURE"], ["text"," "], ["identifier","dbo"], ["text","."], ["identifier","TestProcedure"] ],[ "start", ["text","\t"] ],[ "start", ["comment","--#region parameters"] ],[ "start", ["text","\t"], ["identifier","@vint"], ["text"," "], ["storage.type","INT"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text","\t"], ["punctuation",","], ["identifier","@vdate"], ["text"," "], ["storage.type","DATE"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.language","NULL"] ],[ "start", ["text","\t"], ["punctuation",","], ["identifier","@vdatetime"], ["text"," "], ["storage.type","DATETIME"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","DATEADD"], ["paren.lparen","("], ["identifier","dd"], ["punctuation",","], ["text"," "], ["constant.numeric","1"], ["punctuation",","], ["text"," "], ["support.function","GETDATE"], ["paren.lparen","("], ["paren.rparen","))"] ],[ "start", ["text","\t"], ["punctuation",","], ["identifier","@vvarchar"], ["text"," "], ["storage.type","VARCHAR"], ["paren.lparen","("], ["support.function","MAX"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string.end","'"] ],[ "start", ["comment","--#endregion"] ],[ "start" ],[ "start", ["keyword","AS"] ],[ "start", ["keyword","BEGIN"] ],[ "start" ],[ "start", ["text","\t"], ["comment.start","/*"], ["comment","#region set statements "], ["comment.end","*/"] ],[ "start", ["text","\t"], ["set.statement","SET NOCOUNT"], ["text"," "], ["keyword","ON"], ["punctuation",";"] ],[ "start", ["text","\t"], ["set.statement","SET XACT_ABORT"], ["text"," "], ["keyword","ON"], ["punctuation",";"] ],[ "start", ["text","\t"], ["set.statement","SET QUOTED_IDENTIFIER"], ["text"," "], ["keyword","ON"], ["punctuation",";"] ],[ "start", ["text","\t"], ["comment.start","/*"], ["comment","#endregion"], ["comment.end","*/"] ],[ "start", ["text","\t"] ],[ "doc-start", ["text","\t"], ["comment.doc","/**"] ],[ "doc-start", ["comment.doc","\t * These comments will produce a fold widget"] ],[ "start", ["comment.doc","\t */"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["comment","-- folding demonstration"] ],[ "start", ["text","\t"], ["keyword","SET"], ["text"," "], ["identifier","@vint"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","CASE"] ],[ "start", ["text","\t\t\t\t\t"], ["keyword","WHEN"], ["text"," "], ["identifier","@vdate"], ["text"," "], ["constant.language","IS"], ["text"," "], ["constant.language","NULL"] ],[ "start", ["text","\t\t\t\t\t\t"], ["keyword","THEN"], ["text"," "], ["constant.numeric","1"] ],[ "start", ["text","\t\t\t\t\t"], ["keyword","ELSE"], ["text"," "], ["constant.numeric","2"] ],[ "start", ["text","\t\t\t\t"], ["keyword","END"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["comment","-- another folding demonstration"] ],[ "start", ["text","\t"], ["keyword","IF"], ["text"," "], ["identifier","@vint"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","1"], ["text"," "] ],[ "start", ["text","\t"], ["keyword","BEGIN"] ],[ "start", ["text","\t\t"], ["keyword","SET"], ["text"," "], ["identifier","@vvarchar"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string.start","'"], ["string","one"], ["string.end","'"] ],[ "start", ["text","\t\t"], ["keyword","SET"], ["text"," "], ["identifier","@vint"], ["text"," "], ["keyword.operator","="], ["text"," "], ["support.function","DATEDIFF"], ["paren.lparen","("], ["identifier","dd"], ["punctuation",","], ["text"," "], ["identifier","@vdate"], ["punctuation",","], ["text"," "], ["identifier","@vdatetime"], ["paren.rparen",")"] ],[ "start", ["text","\t"], ["keyword","END"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["comment","-- this mode handles strings properly"] ],[ "string.start", ["text","\t"], ["keyword","DECLARE"], ["text"," "], ["identifier","@sql"], ["text"," "], ["storage.type","NVARCHAR"], ["paren.lparen","("], ["constant.numeric","4000"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","N"], ["string.start","'"], ["string","SELECT TOP(1) OrderID "] ],[ "string.start", ["string","\t\t\t\t\t\t\t\t\tFROM Orders"] ],[ "start", ["string","\t\t\t\t\t\t\t\t\tWHERE @OrderDate > GETDATE()"], ["string.end","'"] ],[ "start", ["text","\t\t\t\t\t\t\t\t"] ],[ "start", ["text","\t"], ["comment","-- this mode is aware of built in stored procedures "] ],[ "start", ["text","\t"], ["keyword","EXECUTE"], ["text"," "], ["support.storedprocedure","sp_executesql"], ["text"," "], ["identifier","@sql"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["comment","-- demonstrating some syntax highlighting"] ],[ "start", ["text","\t"], ["keyword","SELECT"], ["text"," "], ["identifier","Orders"], ["text","."], ["identifier","OrderID"] ],[ "start", ["text","\t\t"], ["punctuation",","], ["identifier","Customers"], ["text","."], ["identifier","CompanyName"] ],[ "start", ["text","\t\t"], ["punctuation",","], ["support.function","DATEFROMPARTS"], ["paren.lparen","("], ["support.function","YEAR"], ["paren.lparen","("], ["support.function","GETDATE"], ["paren.lparen","("], ["paren.rparen","))"], ["punctuation",","], ["text"," "], ["constant.numeric","1"], ["punctuation",","], ["text"," "], ["constant.numeric","1"], ["paren.rparen",")"], ["text"," "], ["keyword","AS"], ["text"," "], ["identifier","FirstDayOfYear"] ],[ "start", ["text","\t"], ["keyword","FROM"], ["text"," "], ["identifier","Orders"] ],[ "start", ["text","\t"], ["constant.language","INNER"], ["text"," "], ["constant.language","JOIN"], ["text"," "], ["identifier","Customers"] ],[ "start", ["text","\t\t"], ["keyword","ON"], ["text"," "], ["identifier","Orders"], ["text","."], ["identifier","CustomerID"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","Customers"], ["text","."], ["identifier","CustomerID"] ],[ "start", ["text","\t"], ["keyword","WHERE"], ["text"," "], ["identifier","CompanyName"], ["text"," "], ["constant.language","NOT"], ["text"," "], ["constant.language","LIKE"], ["text"," "], ["string.start","'"], ["string","%something"], ["string.end","'"] ],[ "start", ["text","\t\t"], ["constant.language","OR"], ["text"," "], ["identifier","CompanyName"], ["text"," "], ["constant.language","IS"], ["text"," "], ["constant.language","NULL"] ],[ "start", ["text","\t\t"], ["constant.language","OR"], ["text"," "], ["identifier","CompanyName"], ["text"," "], ["constant.language","IN"], ["text"," "], ["paren.lparen","("], ["string.start","'"], ["string","bla"], ["string.end","'"], ["punctuation",","], ["text"," "], ["string.start","'"], ["string","nothing"], ["string.end","'"], ["paren.rparen",")"] ],[ "start", ["text","\t\t"] ],[ "start", ["text","\t"], ["comment","-- this mode includes snippets"] ],[ "start", ["text","\t"], ["comment","-- place your cusor at the end of the line below and trigger auto complete (Ctrl+Space)"] ],[ "start", ["text","\t"], ["identifier","createpr"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["comment","-- SQL Server allows using keywords as object names (not recommended) as long as they are wrapped in brackets"] ],[ "start", ["text","\t"], ["keyword","DATABASE"], ["text"," "], ["comment","-- keyword"] ],[ "start", ["text","\t[DATABASE] "], ["comment","-- not a keyword"] ],[ "start", ["text","\t"] ],[ "start", ["keyword","END"] ],[ "start" ]] ================================================ FILE: lib/ace/mode/_test/tokens_stylus.json ================================================ [[ "start", ["comment","// I'm a comment!"] ],[ "start" ],[ "comment", ["comment","/*"] ],[ "comment", ["comment"," * Adds the given numbers together."] ],[ "start", ["comment"," */"] ],[ "start" ],[ "start" ],[ "comment", ["comment","/*!"] ],[ "comment", ["comment"," * Adds the given numbers together."] ],[ "start", ["comment"," */"] ],[ "start" ],[ "start" ],[ "start", ["entity.name.function.stylus","asdasdasdad"], ["text","("], ["text","df, ad"], ["keyword.operator.stylus","="], ["constant.numeric","23"], ["text",")"] ],[ "start" ],[ "start", ["entity.name.function.stylus","add"], ["text","("], ["entity.name.tag.stylus","a"], ["text",", "], ["entity.name.tag.stylus","b"], ["text"," "], ["keyword.operator.stylus","="], ["text"," "], ["entity.name.tag.stylus","a"], ["text",")"] ],[ "start", ["text"," "], ["entity.name.tag.stylus","a"], ["text"," "], ["keyword.operator.stylus","+"], ["text"," "], ["entity.name.tag.stylus","b"] ],[ "start", ["entity.name.function.stylus","green"], ["text","("], ["constant.numeric","#0c0"], ["text",")"] ],[ "start", ["text"," add("], ["constant.numeric","10"], ["text",", "], ["constant.numeric","5"], ["text",")"] ],[ "start", ["text"," "], ["comment","// => 15"] ],[ "start" ],[ "start", ["text"," add("], ["constant.numeric","10"], ["text",")"] ],[ "start", ["text"," add("], ["entity.name.tag.stylus","a"], ["text",", "], ["entity.name.tag.stylus","b"], ["text",")"] ],[ "start" ],[ "start", ["entity.language.stylus"," &"], ["text","asdasd"] ],[ "start" ],[ "start", ["text"," ("], ["variable.language.stylus","arguments"], ["text",")"] ],[ "start" ],[ "start", ["text"," "], ["keyword.stylus","@sdfsdf"] ],[ "start", ["entity.other.attribute-name.class.stylus",".signatures"] ],[ "start", ["text"," "], ["support.type","background-color"], ["text"," "], ["constant.numeric","#e0e8e0"] ],[ "start", ["text"," "], ["support.type","border"], ["text"," "], ["constant.numeric","1"], ["keyword","px"], ["text"," "], ["support.constant","solid"], ["text"," grayLighter"] ],[ "start", ["text"," "], ["support.type","box-shadow"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","3"], ["keyword","px"], ["text"," grayLightest"] ],[ "start", ["text"," "], ["support.type","border-radius"], ["text"," "], ["constant.numeric","3"], ["keyword","px"] ],[ "start", ["text"," "], ["support.type","padding"], ["text"," "], ["constant.numeric","3"], ["keyword","px"], ["text"," "], ["constant.numeric","5"], ["keyword","px"] ],[ "start", ["text"," "], ["string","\"adsads\""] ],[ "start", ["text"," "], ["support.type","margin-left"], ["text"," "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["support.type","list-style"], ["text"," "], ["support.constant","none"] ],[ "start", ["entity.other.attribute-name.class.stylus",".signature"] ],[ "start", ["text"," "], ["support.type","list-style"], ["text"," "], ["support.constant","none"] ],[ "start", ["text"," "], ["support.type","display"], ["text",": "], ["support.constant","inline"] ],[ "start", ["text"," "], ["support.type","margin-left"], ["text"," "], ["constant.numeric","0"] ],[ "start", ["text"," "], ["keyword.operator.stylus",">"], ["text"," "], ["entity.name.tag.stylus","li"] ],[ "start", ["text"," "], ["support.type","display"], ["text"," "], ["support.constant","inline"] ],[ "start", ["keyword.operator.stylus","is"], ["text"," "], ["keyword.operator.stylus","not"] ],[ "start", ["entity.other.attribute-name.class.stylus",".signature-values"] ],[ "start", ["text"," "], ["support.type","list-style"], ["text"," "], ["support.constant","none"] ],[ "start", ["text"," "], ["support.type","display"], ["text"," "], ["support.constant","inline"] ],[ "start", ["text"," "], ["support.type","margin-left"], ["text"," "], ["constant.numeric","0"] ],[ "start", ["entity.language.stylus"," &"], ["punctuation",":"], ["entity.other.attribute-name.pseudo-element.css","before"] ],[ "start", ["text"," "], ["support.type","content"], ["text"," "], ["string","'→'"] ],[ "start", ["text"," "], ["support.type","margin"], ["text"," "], ["constant.numeric","0"], ["text"," "], ["constant.numeric","5"], ["keyword","px"] ],[ "start", ["text"," "], ["keyword.operator.stylus",">"], ["text"," "], ["entity.name.tag.stylus","li"] ],[ "start", ["text"," "], ["keyword.control.stylus","!important"] ],[ "start" ],[ "start", ["text"," "], ["keyword.control.stylus","unless"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_svg.json ================================================ [[ "meta.tag.punctuation.tag-open.xml1", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","svg"] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","width"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"800\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","height"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"600\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","xmlns"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"http://www.w3.org/2000/svg\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","onload"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"StartAnimation(evt)\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Test Tube Progress Bar"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","desc"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","Created for the Web Directions SVG competition"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "js-no_regex", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","type"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"text/ecmascript\""], ["meta.tag.punctuation.tag-close.xml",">"], ["string.cdata.xml",""], ["text"," "], ["identifier","max_time"], ["paren.rparen",")"] ],[ "js-start", ["text"," "], ["keyword","return"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["comment","// Scale the text string gradually until it is 20 times larger"] ],[ "js-start", ["text"," "], ["identifier","scalefactor"], ["text"," "], ["keyword.operator","="], ["text"," "], ["paren.lparen","("], ["identifier","timevalue"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["constant.numeric","650"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","/"], ["text"," "], ["identifier","max_time"], ["punctuation.operator",";"] ],[ "js-start" ],[ "js-start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","timevalue"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["constant.numeric","30"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["identifier","hickory"], ["punctuation.operator","."], ["support.function.dom","setAttribute"], ["paren.lparen","("], ["string","\"display\""], ["punctuation.operator",","], ["text"," "], ["string","\"\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["identifier","hickory"], ["punctuation.operator","."], ["support.function.dom","setAttribute"], ["paren.lparen","("], ["string","\"transform\""], ["punctuation.operator",","], ["text"," "], ["string","\"translate(\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["paren.lparen","("], ["constant.numeric","600"], ["keyword.operator","+"], ["identifier","scalefactor"], ["keyword.operator","*"], ["constant.numeric","3"], ["keyword.operator","*-"], ["constant.numeric","1"], ["text"," "], ["paren.rparen",")"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\", -144 )\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "js-no_regex" ],[ "js-start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","timevalue"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","30"], ["text"," "], ["keyword.operator","&&"], ["text"," "], ["identifier","timevalue"], ["text"," "], ["keyword.operator","<"], ["text"," "], ["constant.numeric","66"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["identifier","dickory"], ["punctuation.operator","."], ["support.function.dom","setAttribute"], ["paren.lparen","("], ["string","\"display\""], ["punctuation.operator",","], ["text"," "], ["string","\"\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["identifier","dickory"], ["punctuation.operator","."], ["support.function.dom","setAttribute"], ["paren.lparen","("], ["string","\"transform\""], ["punctuation.operator",","], ["text"," "], ["string","\"translate(\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["paren.lparen","("], ["keyword.operator","-"], ["constant.numeric","795"], ["keyword.operator","+"], ["identifier","scalefactor"], ["keyword.operator","*"], ["constant.numeric","2"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\", 0 )\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "js-start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","timevalue"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","66"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["identifier","dock"], ["punctuation.operator","."], ["support.function.dom","setAttribute"], ["paren.lparen","("], ["string","\"display\""], ["punctuation.operator",","], ["text"," "], ["string","\"\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-start", ["text"," "], ["identifier","dock"], ["punctuation.operator","."], ["support.function.dom","setAttribute"], ["paren.lparen","("], ["string","\"transform\""], ["punctuation.operator",","], ["text"," "], ["string","\"translate(\""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["paren.lparen","("], ["constant.numeric","1450"], ["keyword.operator","+"], ["identifier","scalefactor"], ["keyword.operator","*"], ["constant.numeric","2"], ["keyword.operator","*-"], ["constant.numeric","1"], ["paren.rparen",")"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\", 144 )\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "js-no_regex" ],[ "js-no_regex", ["text"," "], ["comment","// Call ShowAndGrowElement again milliseconds later."] ],[ "js-no_regex", ["text"," "], ["identifier","setTimeout"], ["paren.lparen","("], ["string","\"ShowAndGrowElement()\""], ["punctuation.operator",","], ["text"," "], ["identifier","timer_increment"], ["paren.rparen",")"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "js-no_regex", ["text"," "], ["variable.language","window"], ["punctuation.operator","."], ["identifier","ShowAndGrowElement"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","ShowAndGrowElement"] ],[ "start", ["text"," "], ["string.cdata.xml","]]>"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "meta.tag.punctuation.tag-open.xml1", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","rect"] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","fill"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"#2e3436\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","fill-rule"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"nonzero\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","stroke-width"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"3\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","y"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"0\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","x"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"0\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","height"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"600\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","width"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"800\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"rect3590\""], ["meta.tag.punctuation.tag-close.xml","/>"] ],[ "start" ],[ "meta.tag.punctuation.tag-open.xml1", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","text"] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","style"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","x"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"50\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","y"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"350\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"hickory\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","display"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"none\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," Hickory,"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","text"] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","style"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","x"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"50\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","y"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"350\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"dickory\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","display"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"none\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," dickory,"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","text"] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","style"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"font-size:144px;font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;fill:#000000;fill-opacity:1;stroke:none;font-family:Bitstream Vera Sans;-inkscape-font-specification:Bitstream Vera Sans Bold\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","x"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"50\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","y"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"350\""] ],[ "meta.tag.punctuation.tag-open.xml1", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"dock\""] ],[ "start", ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","display"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"none\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," dock!"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_swift.json ================================================ [[ "start", ["keyword","import"], ["text"," "], ["identifier","UIKit"] ],[ "start", ["text"," "] ],[ "start", ["keyword","class"], ["text"," "], ["identifier","DetailsViewController"], ["punctuation.operator",":"], ["text"," "], ["identifier","UIViewController"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","var"], ["text"," "], ["identifier","album"], ["punctuation.operator",":"], ["text"," "], ["identifier","Album"], ["punctuation.operator","?"] ],[ "start", ["text"," "], ["variable.parameter","@IBOutlet"], ["text"," "], ["keyword","weak"], ["text"," "], ["keyword","var"], ["text"," "], ["identifier","albumCover"], ["punctuation.operator",":"], ["text"," "], ["identifier","UIImageView"], ["keyword.operator","!"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","required"], ["text"," "], ["keyword","init"], ["paren.lparen","("], ["identifier","coder"], ["text"," "], ["identifier","aDecoder"], ["punctuation.operator",":"], ["text"," "], ["identifier","NSCoder"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["constant.language","super"], ["punctuation.operator","."], ["keyword","init"], ["paren.lparen","("], ["identifier","coder"], ["punctuation.operator",":"], ["text"," "], ["identifier","aDecoder"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","override"], ["text"," "], ["keyword","func"], ["text"," "], ["identifier","viewDidLoad"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["constant.language","super"], ["punctuation.operator","."], ["identifier","viewDidLoad"], ["paren.lparen","("], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","mLabel"], ["punctuation.operator","."], ["identifier","text"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","self"], ["punctuation.operator","."], ["identifier","album"], ["punctuation.operator","?."], ["identifier","title"], ["text"," "], ["keyword.operator","&&"], ["text"," "], ["string.start","\""], ["string","Juhu "], ["paren.quasi.start","\\("], ["text"," "], ["string.start","\""], ["string","kinners"], ["string.end","\""], ["text"," "], ["paren.quasi.end",")"], ["string","! "], ["string.end","\""] ],[ "start", ["text"," "], ["identifier","albumCover"], ["punctuation.operator","."], ["identifier","image"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","UIImage"], ["paren.lparen","("], ["identifier","data"], ["punctuation.operator",":"], ["text"," "], ["identifier","NSData"], ["paren.lparen","("], ["identifier","contentsOfURL"], ["punctuation.operator",":"], ["text"," "], ["identifier","NSURL"], ["paren.lparen","("], ["storage.type","string"], ["punctuation.operator",":"], ["text"," "], ["keyword","self"], ["punctuation.operator","."], ["identifier","album"], ["keyword.operator","!"], ["punctuation.operator","."], ["identifier","largeImageURL"], ["paren.rparen",")"], ["keyword.operator","!"], ["paren.rparen",")"], ["keyword.operator","!"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_tcl.json ================================================ [[ "commandItem" ],[ "commandItem", ["keyword","proc"], ["text"," "], ["identifier","dijkstra"], ["text"," "], ["paren.lparen","{"], ["keyword","graph"], ["text"," "], ["identifier","origin"], ["paren.rparen","}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["comment","# Initialize"] ],[ "commandItem", ["text"," "], ["keyword","dict"], ["text"," "], ["identifier","for"], ["text"," "], ["paren.lparen","{"], ["keyword","vertex"], ["text"," "], ["identifier","distmap"], ["paren.rparen","}"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","dist"], ["text"," "], ["variable.instance","$vertex"], ["text"," "], ["identifier","Inf"] ],[ "commandItem", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","path"], ["text"," "], ["variable.instance","$vertex"], ["text"," "], ["paren.lparen","{"], ["paren.rparen","}"] ],[ "commandItem", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","dist"], ["text"," "], ["variable.instance","$origin"], ["text"," 0"] ],[ "start", ["text"," "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","path"], ["text"," "], ["variable.instance","$origin"], ["text"," "], ["paren.lparen","["], ["keyword","list"], ["text"," "], ["variable.instance","$origin"], ["paren.rparen","]"] ],[ "commandItem", ["text"," "] ],[ "commandItem", ["text"," "], ["keyword","while"], ["text"," "], ["paren.lparen","{"], ["text","["], ["keyword","dict"], ["text"," "], ["identifier","size"], ["text"," "], ["variable.instance","$graph"], ["paren.rparen","]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["comment","# Find unhandled node with least weight"] ],[ "start", ["text","\t"], ["keyword","set"], ["text"," "], ["identifier","d"], ["text"," "], ["identifier","Inf"] ],[ "commandItem", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","for"], ["text"," "], ["paren.lparen","{"], ["keyword","uu"], ["text"," "], ["support.function","-"], ["paren.rparen","}"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["paren.lparen","{"] ],[ "commandItem", ["text","\t "], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$d"], ["text"," "], ["support.function",">"], ["text"," "], ["paren.lparen","["], ["keyword","set"], ["text"," "], ["identifier","dd"], ["text"," "], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$dist"], ["text"," "], ["variable.instance","$uu"], ["paren.rparen","]]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","set"], ["text"," "], ["identifier","u"], ["text"," "], ["variable.instance","$uu"] ],[ "start", ["text","\t\t"], ["keyword","set"], ["text"," "], ["identifier","d"], ["text"," "], ["variable.instance","$dd"] ],[ "commandItem", ["text","\t "], ["paren.rparen","}"] ],[ "commandItem", ["text","\t"], ["paren.rparen","}"] ],[ "commandItem", ["text"," "] ],[ "start", ["text","\t"], ["comment","# No such node; graph must be disconnected"] ],[ "start", ["text","\t"], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$d"], ["text"," "], ["support.function","=="], ["text"," "], ["identifier","Inf"], ["paren.rparen","}"], ["text"," "], ["identifier","break"] ],[ "commandItem", ["text"," "] ],[ "commentfollow", ["text","\t"], ["comment","# Update the weights for nodes\\"] ],[ "start", ["comment","\t lead to by the node we've picked"] ],[ "commandItem", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","for"], ["text"," "], ["paren.lparen","{"], ["keyword","v"], ["text"," "], ["identifier","dd"], ["paren.rparen","}"], ["text"," "], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["variable.instance","$u"], ["paren.rparen","]"], ["text"," "], ["paren.lparen","{"] ],[ "commandItem", ["text","\t "], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["text","["], ["keyword","dict"], ["text"," "], ["identifier","exists"], ["text"," "], ["variable.instance","$graph"], ["text"," "], ["variable.instance","$v"], ["paren.rparen","]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","set"], ["text"," "], ["identifier","alt"], ["text"," "], ["paren.lparen","["], ["keyword","expr"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$d"], ["text"," "], ["support.function","+"], ["text"," "], ["variable.instance","$dd"], ["paren.rparen","}]"] ],[ "commandItem", ["text","\t\t"], ["keyword","if"], ["text"," "], ["paren.lparen","{"], ["variable.instance","$alt"], ["text"," "], ["support.function","<"], ["text"," "], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$dist"], ["text"," "], ["variable.instance","$v"], ["paren.rparen","]}"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","dist"], ["text"," "], ["variable.instance","$v"], ["text"," "], ["variable.instance","$alt"] ],[ "start", ["text","\t\t "], ["keyword","dict"], ["text"," "], ["identifier","set"], ["text"," "], ["identifier","path"], ["text"," "], ["variable.instance","$v"], ["text"," "], ["paren.lparen","["], ["keyword","list"], ["text"," "], ["support.function","{*}"], ["paren.lparen","["], ["keyword","dict"], ["text"," "], ["identifier","get"], ["text"," "], ["variable.instance","$path"], ["text"," "], ["variable.instance","$u"], ["paren.rparen","]"], ["text"," "], ["variable.instance","$v"], ["paren.rparen","]"] ],[ "commandItem", ["text","\t\t"], ["paren.rparen","}"] ],[ "commandItem", ["text","\t "], ["paren.rparen","}"] ],[ "commandItem", ["text","\t"], ["paren.rparen","}"] ],[ "commandItem", ["text"," "] ],[ "start", ["text","\t"], ["comment","# Remove chosen node from graph still to be handled"] ],[ "start", ["text","\t"], ["keyword","dict"], ["text"," "], ["identifier","unset"], ["text"," "], ["identifier","graph"], ["text"," "], ["variable.instance","$u"] ],[ "commandItem", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["paren.lparen","["], ["keyword","list"], ["text"," "], ["variable.instance","$dist"], ["text"," "], ["variable.instance","$path"], ["paren.rparen","]"] ],[ "commandItem", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_tex.json ================================================ [[ "start", ["text","The quadratic formula is $$-b "], ["keyword","\\pm"], ["text"," "], ["keyword","\\sqrt"], ["paren.keyword.operator","{"], ["text","b^2 - 4ac"], ["paren.keyword.operator","}"], ["text"," "], ["keyword","\\over"], ["text"," 2a$$"] ],[ "start", ["keyword","\\bye"] ],[ "start" ],[ "start", ["keyword","\\makeatletter"] ],[ "start", ["text"," "], ["keyword","\\newcommand"], ["paren.keyword.operator","{"], ["keyword","\\be"], ["paren.keyword.operator","}{"], ["comment","%"] ],[ "start", ["text"," "], ["keyword","\\begingroup"] ],[ "start", ["text"," "], ["comment","% \\setlength{\\arraycolsep}{2pt}"] ],[ "start", ["text"," "], ["keyword","\\eqnarray"], ["comment","%"] ],[ "start", ["text"," "], ["keyword","\\@"], ["text","ifstar"], ["paren.keyword.operator","{"], ["keyword","\\nonumber"], ["paren.keyword.operator","}{}"], ["comment","%"] ],[ "start", ["text"," "], ["paren.keyword.operator","}"] ],[ "start", ["text"," "], ["keyword","\\newcommand"], ["paren.keyword.operator","{"], ["keyword","\\ee"], ["paren.keyword.operator","}{"], ["keyword","\\endeqnarray\\endgroup"], ["paren.keyword.operator","}"] ],[ "start", ["text"," "], ["keyword","\\makeatother"] ],[ "start" ],[ "start", ["text"," "], ["keyword","\\begin"], ["paren.keyword.operator","{"], ["nospell.text","equation"], ["paren.keyword.operator","}"] ],[ "start", ["text"," x="], ["keyword","\\left"], ["text", "\\{ "], ["keyword","\\begin"], ["paren.keyword.operator","{"], ["nospell.text","array"], ["paren.keyword.operator","}{"], ["text","cl"], ["paren.keyword.operator","}"] ],[ "start", ["text"," 0 & "], ["keyword","\\textrm"], ["paren.keyword.operator","{"], ["text","if "], ["paren.keyword.operator","}"], ["text","A="], ["keyword","\\ldots\\\\"] ],[ "start", ["text"," 1 & "], ["keyword","\\textrm"], ["paren.keyword.operator","{"], ["text","if "], ["paren.keyword.operator","}"], ["text","B="], ["keyword","\\ldots\\\\"] ],[ "start", ["text"," x & "], ["keyword","\\textrm"], ["paren.keyword.operator","{"], ["text","this runs with as much text as you like, but without an raggeright text"] ],[ "start", ["text","."], ["paren.keyword.operator","}"], ["keyword","\\end"], ["paren.keyword.operator","{"], ["nospell.text","array"], ["paren.keyword.operator","}"], ["keyword","\\right"], ["text","."] ],[ "start", ["text"," "], ["keyword","\\end"], ["paren.keyword.operator","{"], ["nospell.text","equation"], ["paren.keyword.operator","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_text.json ================================================ [[ "start", ["text","Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet."] ],[ "start" ],[ "start", ["text","Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat."] ],[ "start" ],[ "start", ["text","Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat. Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis at vero eros et accumsan et iusto odio dignissim qui blandit praesent luptatum zzril delenit augue duis dolore te feugait nulla facilisi."] ],[ "start" ],[ "start", ["text","Nam liber tempor cum soluta nobis eleifend option congue nihil imperdiet doming id quod mazim placerat facer possim assum. Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat."] ],[ "start" ],[ "start", ["text","Duis autem vel eum iriure dolor in hendrerit in vulputate velit esse molestie consequat, vel illum dolore eu feugiat nulla facilisis."] ],[ "start" ],[ "start", ["text","At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, At accusam aliquyam diam diam dolore dolores duo eirmod eos erat, et nonumy sed tempor et et invidunt justo labore Stet clita ea et gubergren, kasd magna no rebum. sanctus sea sed takimata ut vero voluptua. est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_textile.json ================================================ [[ "start", ["markup.heading.1","h1"], ["keyword",". "], ["text","Textile document"] ],[ "start" ],[ "start", ["markup.heading.2","h2"], ["keyword",". "], ["text","Heading Two"] ],[ "start" ],[ "start", ["markup.heading.3","h3"], ["keyword",". "], ["text","A two-line"] ],[ "start", ["text"," header"] ],[ "start" ],[ "start", ["markup.heading.2","h2"], ["keyword",". "], ["text","Another two-line"] ],[ "start", ["text","header"] ],[ "start" ],[ "start", ["text","Paragraph:"] ],[ "start", ["text","one, two,"] ],[ "start", ["text","thee lines!"] ],[ "start" ],[ "start", ["markup.heading","p"], ["keyword","("], ["string","classone"], ["text"," "], ["string","two"], ["text"," "], ["string","three"], ["keyword","). "], ["text","This is a paragraph with classes"] ],[ "start" ],[ "start", ["markup.heading","p"], ["keyword","(#"], ["string","id"], ["keyword","). "], ["text","(one with an id)"] ],[ "start" ],[ "start", ["markup.heading","p"], ["keyword","("], ["string","one"], ["text"," "], ["string","two"], ["text"," "], ["string","three"], ["keyword","#"], ["string","my_id"], ["keyword","). "], ["text","..classes + id"] ],[ "start" ],[ "start", ["keyword","*"], ["text"," Unordered list"] ],[ "start", ["keyword","**"], ["text"," sublist"] ],[ "start", ["keyword","*"], ["text"," back again!"] ],[ "start", ["keyword","**"], ["text"," sublist again.."] ],[ "start" ],[ "start", ["keyword","#"], ["text"," ordered"] ],[ "start" ],[ "start", ["text","bg. Blockquote!"] ],[ "start", ["text"," This is a two-list blockquote..!"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_toml.json ================================================ [[ "start", ["comment.toml","# This is a TOML document. Boom."] ],[ "start" ],[ "start", ["identifier","title"], ["text"," = "], ["string","\"TOML Example\""] ],[ "start" ],[ "start", ["variable.keygroup.toml","[owner]"] ],[ "start", ["identifier","name"], ["text"," = "], ["string","\"Tom Preston-Werner\""] ],[ "start", ["identifier","organization"], ["text"," = "], ["string","\"GitHub\""] ],[ "start", ["identifier","bio"], ["text"," = "], ["string","\"GitHub Cofounder & CEO"], ["constant.language.escape","\\n"], ["string","Likes tater tots and beer.\""] ],[ "start", ["identifier","dob"], ["text"," = "], ["support.date.toml","1979-05-27T07:32:00Z"], ["text"," "], ["comment.toml","# First class dates? Why not?"] ],[ "start" ],[ "start", ["variable.keygroup.toml","[database]"] ],[ "start", ["identifier","server"], ["text"," = "], ["string","\"192.168.1.1\""] ],[ "start", ["identifier","ports"], ["text"," = [ "], ["constant.numeric.toml","8001"], ["text",", "], ["constant.numeric.toml","8001"], ["text",", "], ["constant.numeric.toml","8002"], ["text"," ]"] ],[ "start", ["identifier","connection_max"], ["text"," = "], ["constant.numeric.toml","5000"] ],[ "start", ["identifier","enabled"], ["text"," = "], ["constant.language.boolean","true"] ],[ "start" ],[ "start", ["variable.keygroup.toml","[servers]"] ],[ "start" ],[ "start", ["text"," "], ["comment.toml","# You can indent as you please. Tabs or spaces. TOML don't care."] ],[ "start", ["variable.keygroup.toml"," [servers.alpha]"] ],[ "start", ["text"," "], ["identifier","ip"], ["text"," = "], ["string","\"10.0.0.1\""] ],[ "start", ["text"," "], ["identifier","dc"], ["text"," = "], ["string","\"eqdc10\""] ],[ "start" ],[ "start", ["variable.keygroup.toml"," [servers.beta]"] ],[ "start", ["text"," "], ["identifier","ip"], ["text"," = "], ["string","\"10.0.0.2\""] ],[ "start", ["text"," "], ["identifier","dc"], ["text"," = "], ["string","\"eqdc10\""] ],[ "start" ],[ "start", ["variable.keygroup.toml","[clients]"] ],[ "start", ["identifier","data"], ["text"," = [ ["], ["string","\"gamma\""], ["text",", "], ["string","\"delta\""], ["text","], ["], ["constant.numeric.toml","1"], ["text",", "], ["constant.numeric.toml","2"], ["text","] ] "], ["comment.toml","# just an update to make sure parsers support it"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_tsx.json ================================================ [[ ["jsx",1], ["storage.type","var"], ["text"," "], ["identifier","mode"], ["text"," "], ["keyword.operator","="], ["text"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","div"], ["meta.tag.punctuation.tag-close.xml",">"], ["string"," "] ],[ ["jsx",1], ["string"," Typescript + "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","b"], ["meta.tag.punctuation.tag-close.xml",">"], ["string"," JSX "], ["meta.tag.punctuation.end-tag-open.xml",""], ["string"," "] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""], ["punctuation.operator",";"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_twig.json ================================================ [[ "start", ["xml-pe.doctype.xml",""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","html"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","head"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","title"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","My Webpage"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","body"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","id"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"navigation\""], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml"," "], ["meta.tag.twig","{%"], ["text"," "], ["keyword.control.twig","for"], ["text"," "], ["identifier","item"], ["text"," "], ["keyword.operator.twig","in"], ["text"," "], ["identifier","navigation"], ["text"," "], ["meta.tag.twig","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.anchor.tag-name.xml","a"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","href"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\""], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["identifier","item"], ["punctuation.operator","."], ["identifier","href"], ["keyword.operator.other","|"], ["support.function.twig","escape"], ["text"," "], ["variable.other.readwrite.local.twig","}}"], ["string.attribute-value.xml","\""], ["meta.tag.punctuation.tag-close.xml",">"], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["identifier","item"], ["punctuation.operator","."], ["identifier","caption"], ["text"," "], ["variable.other.readwrite.local.twig","}}"], ["meta.tag.punctuation.end-tag-open.xml",""], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["meta.tag.twig","{%"], ["text"," "], ["keyword.control.twig","endfor"], ["text"," "], ["meta.tag.twig","%}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.twig","{%"], ["text"," "], ["keyword.control.twig","if"], ["text"," "], ["constant.numeric","1"], ["text"," "], ["keyword.operator.twig","not"], ["text"," "], ["keyword.operator.twig","in"], ["text"," "], ["paren.lparen","["], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","2"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","3"], ["paren.rparen","]"], ["text"," "], ["meta.tag.twig","%}"] ],[ "start" ],[ "start", ["text.xml"," "], ["comment.block.twig","{# is equivalent to #}"] ],[ "start", ["text.xml"," "], ["meta.tag.twig","{%"], ["text"," "], ["keyword.control.twig","if"], ["text"," "], ["keyword.operator.twig","not"], ["text"," "], ["paren.lparen","("], ["constant.numeric","1"], ["text"," "], ["keyword.operator.twig","in"], ["text"," "], ["paren.lparen","["], ["constant.numeric","1"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","2"], ["punctuation.operator",","], ["text"," "], ["constant.numeric","3"], ["paren.rparen","])"], ["text"," "], ["meta.tag.twig","%}"] ],[ "start" ],[ "start", ["text.xml"," "], ["meta.tag.twig","{%"], ["text"," "], ["keyword.control.twig","autoescape"], ["text"," "], ["constant.language.boolean","true"], ["text"," "], ["meta.tag.twig","%}"] ],[ "start", ["text.xml"," "], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["identifier","var"], ["text"," "], ["variable.other.readwrite.local.twig","}}"] ],[ "start", ["text.xml"," "], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["identifier","var"], ["keyword.operator.other","|"], ["support.function.twig","raw"], ["text"," "], ["variable.other.readwrite.local.twig","}}"], ["text.xml"," "], ["comment.block.twig","{# var won't be escaped #}"] ],[ "start", ["text.xml"," "], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["identifier","var"], ["keyword.operator.other","|"], ["support.function.twig","escape"], ["text"," "], ["variable.other.readwrite.local.twig","}}"], ["text.xml"," "], ["comment.block.twig","{# var won't be doubled-escaped #}"] ],[ "start", ["text.xml"," "], ["meta.tag.twig","{%"], ["text"," "], ["keyword.control.twig","endautoescape"], ["text"," "], ["meta.tag.twig","%}"] ],[ "start" ],[ "start", ["text.xml"," "], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["keyword.control.twig","include"], ["paren.lparen","("], ["string","'twig.html'"], ["punctuation.operator",","], ["text"," "], ["identifier","sandboxed"], ["text"," "], ["keyword.operator.assignment","="], ["text"," "], ["constant.language.boolean","true"], ["paren.rparen",")"], ["text"," "], ["variable.other.readwrite.local.twig","}}"] ],[ "start" ],[ "start", ["text.xml"," "], ["variable.other.readwrite.local.twig","{{"], ["string","\"string "], ["constant.language.escape","#{with}"], ["string"," "], ["constant.language.escape","\\\""], ["string"," escapes\""], ["text"," "], ["string","'another#one'"], ["text"," "], ["variable.other.readwrite.local.twig","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","h1"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","My Webpage"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml"," "], ["variable.other.readwrite.local.twig","{{"], ["text"," "], ["identifier","a_variable"], ["text"," "], ["variable.other.readwrite.local.twig","}}"] ],[ "start", ["text.xml"," "], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_typescript.json ================================================ [[ "start", ["keyword.operator.ts","class"], ["text"," "], ["identifier","Greeter"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t"], ["variable.parameter.function.ts","greeting"], ["text",": "], ["variable.parameter.function.ts","string"], ["punctuation.operator",";"] ],[ "start", ["text","\t"], ["keyword.operator.ts","constructor"], ["text"," "], ["paren.lparen","("], ["variable.parameter.function.ts","message"], ["text",": "], ["variable.parameter.function.ts","string"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["storage.type.variable.ts","this."], ["identifier","greeting"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","message"], ["punctuation.operator",";"] ],[ "no_regex", ["text","\t"], ["paren.rparen","}"] ],[ "start", ["text","\t"], ["identifier","greet"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text","\t\t"], ["keyword","return"], ["text"," "], ["string","\"Hello, \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["storage.type.variable.ts","this."], ["identifier","greeting"], ["punctuation.operator",";"] ],[ "no_regex", ["text","\t"], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"], ["text"," "] ],[ "no_regex" ],[ "start", ["storage.type","var"], ["text"," "], ["identifier","greeter"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword","new"], ["text"," "], ["identifier","Greeter"], ["paren.lparen","("], ["string","\"world\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start" ],[ "no_regex", ["storage.type","var"], ["text"," "], ["identifier","button"], ["text"," "], ["keyword.operator","="], ["text"," "], ["variable.language","document"], ["punctuation.operator","."], ["support.function.dom","createElement"], ["paren.lparen","("], ["string","'button'"], ["paren.rparen",")"] ],[ "start", ["identifier","button"], ["punctuation.operator","."], ["identifier","innerText"], ["text"," "], ["keyword.operator","="], ["text"," "], ["keyword.operator","<"], ["storage.type.variable.ts","string"], ["keyword.operator",">"], ["string","\"Say Hello\""], ["punctuation.operator",";"] ],[ "start", ["storage.type","button"], ["punctuation.operator","."], ["entity.name.function","onclick"], ["text"," "], ["keyword.operator","="], ["text"," "], ["storage.type","function"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "no_regex", ["text","\t"], ["support.function","alert"], ["paren.lparen","("], ["entity.name.function.ts","greeter.greet"], ["paren.lparen","("], ["paren.rparen",")"], ["paren.rparen",")"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "no_regex", ["variable.language","document"], ["punctuation.operator","."], ["identifier","body"], ["punctuation.operator","."], ["support.function.dom","appendChild"], ["paren.lparen","("], ["identifier","button"], ["paren.rparen",")"] ],[ "no_regex" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Snake"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","Animal"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["entity.name.function.ts","move"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["string","\"Slithering...\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["storage.type.variable.ts","super"], ["text","("], ["keyword.other.ts","5"], ["text",")"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","Horse"], ["text"," "], ["keyword","extends"], ["text"," "], ["identifier","Animal"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["entity.name.function.ts","move"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["string","\"Galloping...\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.operator.ts","super"], ["punctuation.operator","."], ["identifier","move"], ["paren.lparen","("], ["constant.numeric","45"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"] ],[ "no_regex" ],[ "start", ["identifier","module"], ["text"," "], ["identifier","Sayings"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.operator.ts","export"], ["text"," "], ["keyword.operator.ts","class"], ["text"," "], ["identifier","Greeter"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["variable.parameter.function.ts","greeting"], ["text",": "], ["variable.parameter.function.ts","string"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.operator.ts","constructor"], ["text"," "], ["paren.lparen","("], ["variable.parameter.function.ts","message"], ["text",": "], ["variable.parameter.function.ts","string"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type.variable.ts","this."], ["identifier","greeting"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","message"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["identifier","greet"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["string","\"Hello, \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["storage.type.variable.ts","this."], ["identifier","greeting"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"] ],[ "start", ["identifier","module"], ["text"," "], ["identifier","Mankala"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.operator.ts","export"], ["text"," "], ["keyword.operator.ts","class"], ["text"," "], ["identifier","Features"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["keyword.operator.ts","public"], ["text"," "], ["identifier","turnContinues"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.language.boolean","false"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.operator.ts","public"], ["text"," "], ["identifier","seedStoredCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.operator.ts","public"], ["text"," "], ["identifier","capturedCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword.operator.ts","public"], ["text"," "], ["identifier","spaceCaptured"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","NoSpace"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["text"," "], ["keyword.operator.ts","public"], ["text"," "], ["entity.name.function.ts","clear"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type.variable.ts","this."], ["identifier","turnContinues"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.language.boolean","false"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["storage.type.variable.ts","this."], ["identifier","seedStoredCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["storage.type.variable.ts","this."], ["identifier","capturedCount"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["storage.type.variable.ts","this."], ["identifier","spaceCaptured"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","NoSpace"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex" ],[ "start", ["text"," "], ["keyword","public"], ["text"," "], ["identifier","toString"], ["paren.lparen","("], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["storage.type","var"], ["text"," "], ["identifier","stringBuilder"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","\"\""], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["storage.type.variable.ts","this."], ["identifier","turnContinues"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","stringBuilder"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["string","\" turn continues,\""], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["identifier","stringBuilder"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["string","\" stores \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["storage.type.variable.ts","this."], ["identifier","seedStoredCount"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["storage.type.variable.ts","this."], ["identifier","capturedCount"], ["text"," "], ["keyword.operator",">"], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "start", ["text"," "], ["identifier","stringBuilder"], ["text"," "], ["keyword.operator","+="], ["text"," "], ["string","\" captures \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["storage.type.variable.ts","this."], ["identifier","capturedCount"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\" from space \""], ["text"," "], ["keyword.operator","+"], ["text"," "], ["storage.type.variable.ts","this."], ["identifier","spaceCaptured"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "start", ["text"," "], ["keyword","return"], ["text"," "], ["identifier","stringBuilder"], ["punctuation.operator",";"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["text"," "], ["paren.rparen","}"] ],[ "no_regex", ["paren.rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_vala.json ================================================ [[ "start", ["meta.using.vala",""], ["keyword.other.using.vala","using"], ["meta.using.vala"," "], ["storage.modifier.using.vala","Gtk"], ["punctuation.terminator.vala",";"] ],[ "start", ["text"," "] ],[ "text0", ["storage.type.primitive.array.vala","int"], ["text"," main ("], ["storage.type.primitive.array.vala","string"], ["text","[] args) {"] ],[ "text0", ["text"," "], ["storage.type.vala","Gtk"], ["keyword.operator.dereference.vala","."], ["text","init ("], ["storage.modifier.vala","ref"], ["text"," args)"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," "], ["storage.type.primitive.vala","var"], ["text"," foo "], ["keyword.operator.assignment.vala","="], ["text"," "], ["keyword.control.new.vala","new"], ["text"," "], ["storage.type.generic.vala","MyFoo>"], ["text","()"], ["punctuation.terminator.vala",";"] ],[ "text0" ],[ "text0", ["text"," "], ["storage.type.primitive.vala","var"], ["text"," window "], ["keyword.operator.assignment.vala","="], ["text"," "], ["keyword.control.new.vala","new"], ["text"," "], ["storage.type.vala","Window"], ["text","()"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","title "], ["keyword.operator.assignment.vala","="], ["text"," "], ["punctuation.definition.string.begin.vala","\""], ["string.quoted.double.vala","Hello, World!"], ["punctuation.definition.string.end.vala","\""], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","border_width "], ["keyword.operator.assignment.vala","="], ["text"," "], ["constant.numeric.vala","10"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","window_position "], ["keyword.operator.assignment.vala","="], ["text"," "], ["storage.type.vala","WindowPosition"], ["keyword.operator.dereference.vala","."], ["constant.other.vala","CENTER"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","set_default_size("], ["constant.numeric.vala","350"], ["text",", "], ["constant.numeric.vala","70"], ["text",")"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","destroy"], ["keyword.operator.dereference.vala","."], ["text","connect("], ["storage.type.vala","Gtk"], ["keyword.operator.dereference.vala","."], ["text","main_quit)"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," "] ],[ "text0", ["text"," "], ["storage.type.primitive.vala","var"], ["text"," label "], ["keyword.operator.assignment.vala","="], ["text"," "], ["keyword.control.new.vala","new"], ["text"," "], ["storage.type.vala","Label"], ["text","("], ["punctuation.definition.string.begin.vala","\""], ["string.quoted.double.vala","Hello, World!"], ["punctuation.definition.string.end.vala","\""], ["text",")"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," "] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","add(label)"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," window"], ["keyword.operator.dereference.vala","."], ["text","show_all()"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," "] ],[ "text0", ["text"," "], ["storage.type.vala","Gtk"], ["keyword.operator.dereference.vala","."], ["text","main()"], ["punctuation.terminator.vala",";"] ],[ "text0", ["text"," "], ["keyword.control.vala","return"], ["text"," "], ["constant.numeric.vala","0"], ["punctuation.terminator.vala",";"] ],[ "start", ["text","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_vbscript.json ================================================ [[ "start", ["identifier","myfilename"], ["text"," "], ["keyword.operator.asp","="], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","C:\\Wikipedia - VBScript - Example - Hello World.txt\""] ],[ "start", ["identifier","MakeHelloWorldFile"], ["text"," "], ["identifier","myfilename"] ],[ "state_4", ["meta.leading-space"," "] ],[ "start", ["storage.type.function.asp","Sub"], ["text"," "], ["entity.name.function.asp","MakeHelloWorldFile"], ["text"," "], ["punctuation.definition.parameters.asp","("], ["variable.parameter.function.asp","FileName"], ["punctuation.definition.parameters.asp",")"] ],[ "start", ["punctuation.definition.comment.asp","'"], ["comment.line.apostrophe.asp","Create a new file in C: drive or overwrite existing file"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["storage.type.asp","Set"], ["text"," "], ["identifier","FSO"], ["text"," "], ["keyword.operator.asp","="], ["text"," "], ["support.function.vb.asp","CreateObject"], ["text","("], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","Scripting.FileSystemObject\""], ["text",")"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["keyword.control.asp","If"], ["text"," "], ["identifier","FSO"], ["text","."], ["identifier","FileExists"], ["text","("], ["identifier","FileName"], ["text",") "], ["keyword.control.asp","Then"], ["text"," "] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["identifier","Answer"], ["text"," "], ["keyword.operator.asp","="], ["text"," "], ["support.function.vb.asp","MsgBox"], ["text"," ("], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","File \""], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["identifier","FileName"], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp"," exists ... OK to overwrite?\""], ["text",", "], ["identifier","vbOKCancel"], ["text",")"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["punctuation.definition.comment.asp","'"], ["comment.line.apostrophe.asp","If button selected is not OK, then quit now"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["punctuation.definition.comment.asp","'"], ["comment.line.apostrophe.asp","vbOK is a language constant"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["keyword.control.asp","If"], ["text"," "], ["identifier","Answer"], ["text"," "], ["keyword.operator.asp","<>"], ["text"," "], ["identifier","vbOK"], ["text"," "], ["keyword.control.asp","Then"], ["text"," "], ["keyword.control.asp","Exit"], ["text"," "], ["keyword.control.asp","Sub"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["keyword.control.asp","Else"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["punctuation.definition.comment.asp","'"], ["comment.line.apostrophe.asp","Confirm OK to create"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["identifier","Answer"], ["text"," "], ["keyword.operator.asp","="], ["text"," "], ["support.function.vb.asp","MsgBox"], ["text"," ("], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","File \""], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["identifier","FileName"], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp"," ... OK to create?\""], ["text",", "], ["identifier","vbOKCancel"], ["text",")"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.even-tab.spaces"," "], ["meta.odd-tab.spaces"," "], ["keyword.control.asp","If"], ["text"," "], ["identifier","Answer"], ["text"," "], ["keyword.operator.asp","<>"], ["text"," "], ["identifier","vbOK"], ["text"," "], ["keyword.control.asp","Then"], ["text"," "], ["keyword.control.asp","Exit"], ["text"," "], ["keyword.control.asp","Sub"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["keyword.control.asp","End"], ["text"," "], ["keyword.control.asp","If"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["punctuation.definition.comment.asp","'"], ["comment.line.apostrophe.asp","Create new file (or replace an existing file)"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["storage.type.asp","Set"], ["text"," "], ["identifier","FileObject"], ["text"," "], ["keyword.operator.asp","="], ["text"," "], ["identifier","FSO"], ["text","."], ["identifier","CreateTextFile"], ["text"," ("], ["identifier","FileName"], ["text",")"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["identifier","FileObject"], ["text","."], ["identifier","WriteLine"], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","Time ... \""], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["support.function.vb.asp","Now"], ["text","()"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["identifier","FileObject"], ["text","."], ["identifier","WriteLine"], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","Hello World\""] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["identifier","FileObject"], ["text","."], ["identifier","Close"], ["text","()"] ],[ "start", ["meta.odd-tab.spaces"," "], ["meta.leading-space"," "], ["support.function.vb.asp","MsgBox"], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp","File \""], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["identifier","FileName"], ["text"," "], ["keyword.operator.asp","&"], ["text"," "], ["punctuation.definition.string.begin.asp","\""], ["string.quoted.double.asp"," ... updated.\""] ],[ "start", ["keyword.control.asp","End"], ["text"," "], ["keyword.control.asp","Sub"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_velocity.json ================================================ [[ "vm_comment", ["comment.block","#*"] ],[ "vm_comment", ["comment"," This is a sample comment block that"] ],[ "vm_comment", ["comment"," spans multiple lines."] ],[ "start", ["comment","*#"] ],[ "start" ],[ "start", ["keyword","#macro"], ["text"," "], ["lparen","("], ["text"," "], ["identifier","outputItem"], ["text"," "], ["variable","$item"], ["text"," "], ["rparen",")"] ],[ "start", ["text"," "], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","li"], ["meta.tag.punctuation.tag-close.xml",">"], ["variable","${"], ["identifier","item"], ["variable","}"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["keyword","#end"] ],[ "start" ],[ "start", ["comment","## Define the items to iterate"] ],[ "start", ["keyword","#set"], ["text"," "], ["lparen","("], ["text"," "], ["variable","$items"], ["text"," "], ["keyword.operator","="], ["text"," "], ["lparen","["], ["constant.numeric","1"], ["text.xml",","], ["text"," "], ["constant.numeric","2"], ["text.xml",","], ["text"," "], ["constant.numeric","3"], ["text.xml",","], ["text"," "], ["constant.numeric","4"], ["rparen","]"], ["text"," "], ["rparen",")"] ],[ "start" ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","ul"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text"," "], ["comment","## Iterate over the items and output the evens."] ],[ "start", ["text"," "], ["keyword","#foreach"], ["text"," "], ["lparen","("], ["text"," "], ["variable","$item"], ["text"," "], ["identifier","in"], ["text"," "], ["variable","$items"], ["text"," "], ["rparen",")"] ],[ "start", ["text"," "], ["keyword","#if"], ["text"," "], ["lparen","("], ["text"," "], ["support.function","$_MathTool"], ["text.xml","."], ["identifier","mod"], ["lparen","("], ["variable","$item"], ["text.xml",","], ["text"," "], ["constant.numeric","2"], ["rparen",")"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["text"," "], ["rparen",")"] ],[ "start", ["text"," "], ["identifier","#outputItem"], ["text"," "], ["lparen","("], ["variable","$item"], ["rparen",")"] ],[ "start", ["text"," "], ["keyword","#end"] ],[ "start", ["text"," "], ["keyword","#end"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "js-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.script.tag-name.xml","script"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "js-comment1", ["text"," "], ["comment","/*"] ],[ "js-comment1", ["comment"," A sample function to decomstrate"] ],[ "js-comment1", ["comment"," JavaScript highlighting and folding."] ],[ "js-start", ["comment"," */"] ],[ "js-start", ["text"," "], ["storage.type","function"], ["text"," "], ["entity.name.function","foo"], ["paren.lparen","("], ["variable.parameter","items"], ["punctuation.operator",", "], ["variable.parameter","nada"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["keyword","for"], ["text"," "], ["paren.lparen","("], ["storage.type","var"], ["text"," "], ["identifier","i"], ["keyword.operator","="], ["constant.numeric","0"], ["punctuation.operator",";"], ["text"," "], ["identifier","i"], ["keyword.operator","<"], ["identifier","items"], ["punctuation.operator","."], ["support.constant","length"], ["punctuation.operator",";"], ["text"," "], ["identifier","i"], ["keyword.operator","++"], ["paren.rparen",")"], ["text"," "], ["paren.lparen","{"] ],[ "js-start", ["text"," "], ["support.function","alert"], ["paren.lparen","("], ["identifier","items"], ["paren.lparen","["], ["identifier","i"], ["paren.rparen","]"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["string","\"juhu"], ["constant.language.escape","\\n"], ["string","\""], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "js-no_regex", ["text"," "], ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start" ],[ "css-start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.style.tag-name.xml","style"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ ["css-comment","css-start"], ["text"," "], ["comment","/*"] ],[ ["css-comment","css-start"], ["comment"," A sample style to decomstrate"] ],[ ["css-comment","css-start"], ["comment"," CSS highlighting and folding."] ],[ "css-start", ["comment"," */"] ],[ "css-ruleset", ["text"," "], ["variable",".class"], ["text"," "], ["paren.lparen","{"] ],[ "css-ruleset", ["text"," "], ["support.type","font-family"], ["text",": Monaco, "], ["string.start","\""], ["string","Courier New"], ["string.end","\""], ["text",", "], ["support.constant.fonts","monospace"], ["text",";"] ],[ "css-ruleset", ["text"," "], ["support.type","font-size"], ["text",": "], ["constant.numeric","12"], ["keyword","px"], ["text",";"] ],[ "css-ruleset", ["text"," "], ["support.type","cursor"], ["text",": "], ["support.constant","text"], ["text",";"] ],[ "css-start", ["text"," "], ["paren.rparen","}"] ],[ "start", ["meta.tag.punctuation.end-tag-open.xml",""] ]] ================================================ FILE: lib/ace/mode/_test/tokens_verilog.json ================================================ [[ "start", ["keyword","always"], ["text"," @"], ["paren.lparen","("], ["keyword","negedge"], ["text"," "], ["identifier","reset"], ["text"," "], ["keyword","or"], ["text"," "], ["keyword","posedge"], ["text"," "], ["identifier","clk"], ["paren.rparen",")"], ["text"," "], ["keyword","begin"] ],[ "start", ["text"," "], ["keyword","if"], ["text"," "], ["paren.lparen","("], ["identifier","reset"], ["text"," "], ["keyword.operator","=="], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"], ["text"," "], ["keyword","begin"] ],[ "start", ["text"," "], ["identifier","d_out"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["constant.numeric","16"], ["text","'"], ["identifier","h0000"], ["text",";"] ],[ "start", ["text"," "], ["identifier","d_out_mem"], ["text","["], ["identifier","resetcount"], ["text","] "], ["keyword.operator","<="], ["text"," "], ["identifier","d_out"], ["text",";"] ],[ "start", ["text"," "], ["identifier","laststoredvalue"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","d_out"], ["text",";"] ],[ "start", ["text"," "], ["keyword","end"], ["text"," "], ["keyword","else"], ["text"," "], ["keyword","begin"] ],[ "start", ["text"," "], ["identifier","d_out"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","d_out"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["text","'"], ["identifier","b1"], ["text","; "] ],[ "start", ["text"," "], ["keyword","end"] ],[ "start", ["keyword","end"] ],[ "start" ],[ "start", ["keyword","always"], ["text"," @"], ["paren.lparen","("], ["identifier","bufreadaddr"], ["paren.rparen",")"] ],[ "start", ["text"," "], ["identifier","bufreadval"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","d_out_mem"], ["text","["], ["identifier","bufreadaddr"], ["text","];"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_vhdl.json ================================================ [[ "start", ["keyword","library"], ["text"," "], ["identifier","IEEE"] ],[ "start", ["identifier","user"], ["text"," "], ["identifier","IEEE"], ["punctuation.operator","."], ["identifier","std_logic_1164"], ["punctuation.operator","."], ["keyword","all"], ["punctuation.operator",";"] ],[ "start", ["keyword","use"], ["text"," "], ["identifier","IEEE"], ["punctuation.operator","."], ["identifier","numeric_std"], ["punctuation.operator","."], ["keyword","all"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","entity"], ["text"," "], ["identifier","COUNT16"], ["text"," "], ["keyword","is"] ],[ "start" ],[ "start", ["text"," "], ["keyword","port"], ["text"," "], ["paren.lparen","("] ],[ "start", ["text"," "], ["identifier","cOut"], ["text"," "], ["punctuation.operator",":"], ["keyword","out"], ["text"," "], ["storage.type","std_logic_vector"], ["paren.lparen","("], ["constant.numeric","15"], ["text"," "], ["keyword","downto"], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"], ["punctuation.operator",";"], ["text"," "], ["comment","-- counter output"] ],[ "start", ["text"," "], ["identifier","clkEn"], ["text"," "], ["punctuation.operator",":"], ["keyword","in"], ["text"," "], ["storage.type","std_logic"], ["punctuation.operator",";"], ["text"," "], ["comment","-- count enable"] ],[ "start", ["text"," "], ["identifier","clk"], ["text"," "], ["punctuation.operator",":"], ["keyword","in"], ["text"," "], ["storage.type","std_logic"], ["punctuation.operator",";"], ["text"," "], ["comment","-- clock input"] ],[ "start", ["text"," "], ["identifier","rst"], ["text"," "], ["punctuation.operator",":"], ["keyword","in"], ["text"," "], ["storage.type","std_logic"], ["text"," "], ["comment","-- reset input"] ],[ "start", ["text"," "], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ],[ "start", ["keyword","end"], ["text"," "], ["keyword","entity"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","architecture"], ["text"," "], ["identifier","count_rtl"], ["text"," "], ["keyword","of"], ["text"," "], ["identifier","COUNT16"], ["text"," "], ["keyword","is"] ],[ "start", ["text"," "], ["storage.type","signal"], ["text"," "], ["identifier","count"], ["text"," "], ["punctuation.operator",":"], ["storage.type","std_logic_vector"], ["text"," "], ["paren.lparen","("], ["constant.numeric","15"], ["text"," "], ["keyword","downto"], ["text"," "], ["constant.numeric","0"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ],[ "start", ["keyword","begin"] ],[ "start", ["text"," "], ["keyword","process"], ["text"," "], ["paren.lparen","("], ["identifier","clk"], ["punctuation.operator",","], ["text"," "], ["identifier","rst"], ["paren.rparen",")"], ["text"," "], ["keyword","begin"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","if"], ["paren.lparen","("], ["identifier","rst"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","'1'"], ["paren.rparen",")"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["identifier","count"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["paren.lparen","("], ["keyword","others"], ["keyword.operator","=>"], ["string","'0'"], ["paren.rparen",")"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","elsif"], ["paren.lparen","("], ["identifier","rising_edge"], ["paren.lparen","("], ["identifier","clk"], ["paren.rparen","))"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["keyword","if"], ["paren.lparen","("], ["identifier","clkEn"], ["text"," "], ["keyword.operator","="], ["text"," "], ["string","'1'"], ["paren.rparen",")"], ["text"," "], ["keyword","then"] ],[ "start", ["text"," "], ["identifier","count"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","count"], ["text"," "], ["keyword.operator","+"], ["text"," "], ["constant.numeric","1"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","end"], ["text"," "], ["keyword","if"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["keyword","end"], ["text"," "], ["keyword","if"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ],[ "start", ["text"," "], ["keyword","end"], ["text"," "], ["keyword","process"], ["punctuation.operator",";"] ],[ "start", ["text"," "], ["identifier","cOut"], ["text"," "], ["keyword.operator","<="], ["text"," "], ["identifier","count"], ["punctuation.operator",";"] ],[ "start" ],[ "start", ["keyword","end"], ["text"," "], ["keyword","architecture"], ["punctuation.operator",";"] ],[ "start", ["text"," "] ]] ================================================ FILE: lib/ace/mode/_test/tokens_wollok.json ================================================ [[ "start", ["keyword","class"], ["text"," "], ["identifier","Actividad"], ["text"," "], ["lparen","{"] ],[ "start", ["text","\t"], ["keyword","method"], ["text"," "], ["identifier","calcularMejora"], ["lparen","("], ["rparen",")"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","EstudiarMateria"], ["text"," "], ["keyword","inherits"], ["text"," "], ["identifier","Actividad"], ["text"," "], ["lparen","{"] ],[ "start", ["text","\t"], ["keyword","var"], ["text"," "], ["identifier","materia"] ],[ "start", ["text","\t"], ["keyword","var"], ["text"," "], ["identifier","puntos"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["keyword","new"], ["lparen","("], ["identifier","m"], ["keyword.operator",","], ["text"," "], ["identifier","p"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text","\t\t"], ["identifier","materia"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","m"] ],[ "start", ["text","\t\t"], ["identifier","puntos"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","p"] ],[ "start", ["text","\t"], ["rparen","}"] ],[ "start", ["text","\t"] ],[ "start", ["text","\t"], ["keyword","override"], ["text"," "], ["keyword","method"], ["text"," "], ["identifier","calcularMejora"], ["lparen","("], ["rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","puntos"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","class"], ["text"," "], ["identifier","EjercitarEnSimulador"], ["text"," "], ["keyword","inherits"], ["text"," "], ["identifier","Actividad"], ["text"," "], ["lparen","{"] ],[ "start", ["text","\t"], ["keyword","var"], ["text"," "], ["identifier","horas"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","0"] ],[ "start", ["text","\t"], ["keyword","new"], ["lparen","("], ["identifier","h"], ["rparen",")"], ["text"," "], ["lparen","{"], ["text"," "], ["identifier","horas"], ["text"," "], ["keyword.operator","="], ["text"," "], ["identifier","h"], ["text"," "], ["rparen","}"] ],[ "start", ["text","\t"], ["keyword","override"], ["text"," "], ["keyword","method"], ["text"," "], ["identifier","calcularMejora"], ["lparen","("], ["rparen",")"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","10"], ["text"," "], ["keyword.operator","*"], ["text"," "], ["identifier","horas"] ],[ "start", ["rparen","}"] ],[ "start" ],[ "start", ["keyword","object"], ["text"," "], ["identifier","pepita"], ["text"," "], ["lparen","{"] ],[ "start", ["text","\t"], ["keyword","var"], ["text"," "], ["identifier","energia"], ["text"," "], ["keyword.operator","="], ["text"," "], ["constant.numeric","100"] ],[ "start", ["text","\t"], ["keyword","method"], ["text"," "], ["identifier","volar"], ["lparen","("], ["identifier","m"], ["rparen",")"], ["text"," "], ["lparen","{"] ],[ "start", ["text","\t\t"], ["identifier","energia"], ["text"," "], ["keyword.operator","-="], ["text"," "], ["identifier","m"] ],[ "start", ["text","\t"], ["rparen","}"] ],[ "start", ["rparen","}"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_xml.json ================================================ [[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","Juhu"], ["meta.tag.punctuation.tag-close.xml",">"], ["text.xml","//Juhu Kinners"], ["meta.tag.punctuation.end-tag-open.xml",""] ],[ "start", ["text.xml","test: two tags in the same lines should be in separate tokens\""] ],[ "start", ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","Juhu"], ["meta.tag.punctuation.tag-close.xml",">"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","Kinners"], ["meta.tag.punctuation.tag-close.xml",">"] ],[ "start", ["text.xml","test: multiline attributes\""] ],[ ["string.attribute-value.xml0","meta.tag.punctuation.tag-open.xml"], ["meta.tag.punctuation.tag-open.xml","<"], ["meta.tag.tag-name.xml","copy"], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","set"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"{"] ],[ ["string.attribute-value.xml0","meta.tag.punctuation.tag-open.xml"], ["string.attribute-value.xml","}\""], ["text.tag-whitespace.xml"," "], ["entity.other.attribute-name.xml","undo"], ["keyword.operator.attribute-equals.xml","="], ["string.attribute-value.xml","\"{"] ],[ "start", ["string.attribute-value.xml","}\""], ["meta.tag.punctuation.tag-close.xml","/>"] ]] ================================================ FILE: lib/ace/mode/_test/tokens_xquery.json ================================================ [[ "[\"start\"]", ["keyword","xquery"], ["text"," "], ["keyword","version"], ["text"," "], ["string","\""], ["string","1.0"], ["string","\""], ["text",";"] ],[ "[\"start\"]" ],[ "[\"start\"]", ["keyword","let"], ["text"," "], ["variable","$message"], ["text"," "], ["keyword.operator",":="], ["text"," "], ["string","\""], ["string","Hello World!"], ["string","\""] ],[ "[\"start\",\"StartTag\",\"TagContent\"]", ["keyword","return"], ["text"," "], ["meta.tag",""] ],[ "[\"start\",\"StartTag\",\"TagContent\"]", ["text"," "], ["meta.tag",""], ["text","{"], ["variable","$message"], ["text","}"], ["meta.tag",""] ],[ "[\"start\"]", ["meta.tag",""] ],[ "[\"start\"]" ]] ================================================ FILE: lib/ace/mode/_test/tokens_yaml.json ================================================ [[ "start", ["comment","# This sample document was taken from wikipedia:"] ],[ "start", ["comment","# http://en.wikipedia.org/wiki/YAML#Sample_document"] ],[ "start", ["list.markup","---"] ],[ "start", ["meta.tag","receipt"], ["keyword",":"], ["text"," Oz-Ware Purchase Invoice"] ],[ "start", ["meta.tag","date"], ["keyword",":"], ["text"," 2007-08-06"] ],[ "start", ["meta.tag","customer"], ["keyword",":"] ],[ "start", ["meta.tag"," given"], ["keyword",":"], ["text"," Dorothy"] ],[ "start", ["meta.tag"," family"], ["keyword",":"], ["text"," Gale"] ],[ "start" ],[ "start", ["meta.tag","items"], ["keyword",":"] ],[ "start", ["list.markup"," - "], ["meta.tag","part_no"], ["keyword",":"], ["text"," "], ["string","'A4786'"] ],[ "start", ["meta.tag"," descrip"], ["keyword",":"], ["text"," Water Bucket "], ["paren.lparen","("], ["text","Filled)"] ],[ "start", ["meta.tag"," price"], ["keyword",":"], ["text"," "], ["constant.numeric","1.47"] ],[ "start", ["meta.tag"," quantity"], ["keyword",":"], ["text"," "], ["constant.numeric","4"] ],[ "start" ],[ "start", ["list.markup"," - "], ["meta.tag","part_no"], ["keyword",":"], ["text"," "], ["string","'E1628'"] ],[ "start", ["meta.tag"," descrip"], ["keyword",":"], ["text"," High Heeled "], ["string","\"Ruby\""], ["text"," Slippers"] ],[ "start", ["meta.tag"," size"], ["keyword",":"], ["text"," "], ["constant.numeric","8"] ],[ "start", ["meta.tag"," price"], ["keyword",":"], ["text"," "], ["constant.numeric","100.27"] ],[ "start", ["meta.tag"," quantity"], ["keyword",":"], ["text"," "], ["constant.numeric","1"] ],[ "start" ],[ "start", ["meta.tag","bill-to"], ["keyword",":"], ["text"," "], ["constant.language","&id001"] ],[ ["mlString",4], ["meta.tag"," street"], ["keyword",":"], ["text"," "], ["string","|"] ],[ ["mlString",4], ["indent"," "], ["string","123 Tornado Alley"] ],[ ["mlString",4], ["indent"," "], ["string","Suite 16"] ],[ "start", ["indent"," "], ["meta.tag","city"], ["keyword",":"], ["text"," East Centerville"] ],[ "start", ["meta.tag"," state"], ["keyword",":"], ["text"," KS"] ],[ "start" ],[ "start", ["meta.tag","ship-to"], ["keyword",":"], ["text"," "], ["constant.language","*id001"] ],[ "start" ],[ ["mlString",0], ["meta.tag","specialDelivery"], ["keyword",":"], ["text"," "], ["string",">"] ],[ ["mlString",0], ["indent"," "], ["string","Follow the Yellow Brick"] ],[ ["mlString",0], ["indent"," "], ["string","Road to the Emerald City."] ],[ ["mlString",0], ["indent"," "], ["string","Pay no attention to the"] ],[ ["mlString",0], ["indent"," "], ["string","man behind the curtain."] ],[ ["mlString",0] ]] ================================================ FILE: lib/ace/mode/abap.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Rules = require("./abap_highlight_rules").AbapHighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Range = require("../range").Range; var TextMode = require("./text").Mode; var oop = require("../lib/oop"); function Mode() { this.HighlightRules = Rules; this.foldingRules = new FoldMode(); } oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = '"'; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); return indent; }; this.$id = "ace/mode/abap"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/abap_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* * based on * " Vim ABAP syntax file * " Language: SAP - ABAP/R4 * " Revision: 2.1 * " Maintainer: Marius Piedallu van Wyk * " Last Change: 2012 Oct 23 */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AbapHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": "ADD ALIAS ALIASES ASCENDING ASSERT ASSIGN ASSIGNING AT BACK" + " CALL CASE CATCH CHECK CLASS CLEAR CLOSE CNT COLLECT COMMIT COMMUNICATION COMPUTE CONCATENATE CONDENSE CONSTANTS CONTINUE CONTROLS CONVERT CREATE CURRENCY" + " DATA DEFINE DEFINITION DEFERRED DELETE DESCENDING DESCRIBE DETAIL DIVIDE DO" + " ELSE ELSEIF ENDAT ENDCASE ENDCLASS ENDDO ENDEXEC ENDFORM ENDFUNCTION ENDIF ENDIFEND ENDINTERFACE ENDLOOP ENDMETHOD ENDMODULE ENDON ENDPROVIDE ENDSELECT ENDTRY ENDWHILE EVENT EVENTS EXEC EXIT EXPORT EXPORTING EXTRACT" + " FETCH FIELDS FORM FORMAT FREE FROM FUNCTION" + " GENERATE GET" + " HIDE" + " IF IMPORT IMPORTING INDEX INFOTYPES INITIALIZATION INTERFACE INTERFACES INPUT INSERT IMPLEMENTATION" + " LEAVE LIKE LINE LOAD LOCAL LOOP" + " MESSAGE METHOD METHODS MODIFY MODULE MOVE MULTIPLY" + " ON OVERLAY OPTIONAL OTHERS" + " PACK PARAMETERS PERFORM POSITION PROGRAM PROVIDE PUT" + " RAISE RANGES READ RECEIVE RECEIVING REDEFINITION REFERENCE REFRESH REJECT REPLACE REPORT RESERVE RESTORE RETURN RETURNING ROLLBACK" + " SCAN SCROLL SEARCH SELECT SET SHIFT SKIP SORT SORTED SPLIT STANDARD STATICS STEP STOP SUBMIT SUBTRACT SUM SUMMARY SUPPRESS" + " TABLES TIMES TRANSFER TRANSLATE TRY TYPE TYPES" + " UNASSIGN ULINE UNPACK UPDATE" + " WHEN WHILE WINDOW WRITE" + " OCCURS STRUCTURE OBJECT PROPERTY" + " CASTING APPEND RAISING VALUE COLOR" + " CHANGING EXCEPTION EXCEPTIONS DEFAULT CHECKBOX COMMENT" + " ID NUMBER FOR TITLE OUTPUT" + " WITH EXIT USING" + " INTO WHERE GROUP BY HAVING ORDER BY SINGLE" + " APPENDING CORRESPONDING FIELDS OF TABLE" + " LEFT RIGHT OUTER INNER JOIN AS CLIENT SPECIFIED BYPASSING BUFFER UP TO ROWS CONNECTING" + " EQ NE LT LE GT GE NOT AND OR XOR IN LIKE BETWEEN", "constant.language": "TRUE FALSE NULL SPACE", "support.type": "c n i p f d t x string xstring decfloat16 decfloat34", "keyword.operator": "abs sign ceil floor trunc frac acos asin atan cos sin tan" + " abapOperator cosh sinh tanh exp log log10 sqrt" + " strlen xstrlen charlen numofchar dbmaxlen lines" }, "text", true, " "); var compoundKeywords = "WITH\\W+(?:HEADER\\W+LINE|FRAME|KEY)|NO\\W+STANDARD\\W+PAGE\\W+HEADING|"+ "EXIT\\W+FROM\\W+STEP\\W+LOOP|BEGIN\\W+OF\\W+(?:BLOCK|LINE)|BEGIN\\W+OF|"+ "END\\W+OF\\W+(?:BLOCK|LINE)|END\\W+OF|NO\\W+INTERVALS|"+ "RESPECTING\\W+BLANKS|SEPARATED\\W+BY|USING\\W+(?:EDIT\\W+MASK)|"+ "WHERE\\W+(?:LINE)|RADIOBUTTON\\W+GROUP|REF\\W+TO|"+ "(?:PUBLIC|PRIVATE|PROTECTED)(?:\\W+SECTION)?|DELETING\\W+(?:TRAILING|LEADING)"+ "(?:ALL\\W+OCCURRENCES)|(?:FIRST|LAST)\\W+OCCURRENCE|INHERITING\\W+FROM|"+ "LINE-COUNT|ADD-CORRESPONDING|AUTHORITY-CHECK|BREAK-POINT|CLASS-DATA|CLASS-METHODS|"+ "CLASS-METHOD|DIVIDE-CORRESPONDING|EDITOR-CALL|END-OF-DEFINITION|END-OF-PAGE|END-OF-SELECTION|"+ "FIELD-GROUPS|FIELD-SYMBOLS|FUNCTION-POOL|MOVE-CORRESPONDING|MULTIPLY-CORRESPONDING|NEW-LINE|"+ "NEW-PAGE|NEW-SECTION|PRINT-CONTROL|RP-PROVIDE-FROM-LAST|SELECT-OPTIONS|SELECTION-SCREEN|"+ "START-OF-SELECTION|SUBTRACT-CORRESPONDING|SYNTAX-CHECK|SYNTAX-TRACE|TOP-OF-PAGE|TYPE-POOL|"+ "TYPE-POOLS|LINE-SIZE|LINE-COUNT|MESSAGE-ID|DISPLAY-MODE|READ(?:-ONLY)?|"+ "IS\\W+(?:NOT\\W+)?(?:ASSIGNED|BOUND|INITIAL|SUPPLIED)"; this.$rules = { "start" : [ {token : "string", regex : "`", next : "string"}, {token : "string", regex : "'", next : "qstring"}, {token : "doc.comment", regex : /^\*.+/}, {token : "comment", regex : /".+$/}, {token : "invalid", regex: "\\.{2,}"}, {token : "keyword.operator", regex: /\W[\-+%=<>*]\W|\*\*|[~:,\.&$]|->*?|=>/}, {token : "paren.lparen", regex : "[\\[({]"}, {token : "paren.rparen", regex : "[\\])}]"}, {token : "constant.numeric", regex: "[+-]?\\d+\\b"}, {token : "variable.parameter", regex : /sy|pa?\d\d\d\d\|t\d\d\d\.|innnn/}, {token : "keyword", regex : compoundKeywords}, {token : "variable.parameter", regex : /\w+-\w+(?:-\w+)*/}, {token : keywordMapper, regex : "\\b\\w+\\b"}, {caseInsensitive: true} ], "qstring" : [ {token : "constant.language.escape", regex : "''"}, {token : "string", regex : "'", next : "start"}, {defaultToken : "string"} ], "string" : [ {token : "constant.language.escape", regex : "``"}, {token : "string", regex : "`", next : "start"}, {defaultToken : "string"} ] }; }; oop.inherits(AbapHighlightRules, TextHighlightRules); exports.AbapHighlightRules = AbapHighlightRules; }); ================================================ FILE: lib/ace/mode/abc.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function (require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ABCHighlightRules = require("./abc_highlight_rules").ABCHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function () { this.HighlightRules = ABCHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function () { // this.lineCommentStart = ""%.*""; // this.blockComment = {start: ""/*"", end: ""*/""}; // Extra logic goes here. this.$id = "ace/mode/abc"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/abc_highlight_rules.js ================================================ /* This file was partially autogenerated from https://github.com/jimhawkridge/SublimeABC Modifications - more classes to express the abc semantic - added syntax highlighting for Zupfnoter conventions (https://github.com/bwl21/zupfnoter) - separate note pitch and note duration - even if it looks the same ***********************************************************************************************/ define(function (require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ABCHighlightRules = function () { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: ['zupfnoter.information.comment.line.percentage', 'information.keyword', 'in formation.keyword.embedded'], regex: '(%%%%)(hn\\.[a-z]*)(.*)', comment: 'Instruction Comment' }, { token: ['information.comment.line.percentage', 'information.keyword.embedded'], regex: '(%%)(.*)', comment: 'Instruction Comment' }, { token: 'comment.line.percentage', regex: '%.*', comment: 'Comments' }, { token: 'barline.keyword.operator', regex: '[\\[:]*[|:][|\\]:]*(?:\\[?[0-9]+)?|\\[[0-9]+', comment: 'Bar lines' }, { token: ['information.keyword.embedded', 'information.argument.string.unquoted'], regex: '(\\[[A-Za-z]:)([^\\]]*\\])', comment: 'embedded Header lines' }, { token: ['information.keyword', 'information.argument.string.unquoted'], regex: '^([A-Za-z]:)([^%\\\\]*)', comment: 'Header lines' }, { token: ['text', 'entity.name.function', 'string.unquoted', 'text'], regex: '(\\[)([A-Z]:)(.*?)(\\])', comment: 'Inline fields' }, { token: ['accent.constant.language', 'pitch.constant.numeric', 'duration.constant.numeric'], regex: '([\\^=_]*)([A-Ga-gz][,\']*)([0-9]*/*[><0-9]*)', comment: 'Notes' }, { token: 'zupfnoter.jumptarget.string.quoted', regex: '[\\"!]\\^\\:.*?[\\"!]', comment: 'Zupfnoter jumptarget' }, { token: 'zupfnoter.goto.string.quoted', regex: '[\\"!]\\^\\@.*?[\\"!]', comment: 'Zupfnoter goto' }, { token: 'zupfnoter.annotation.string.quoted', regex: '[\\"!]\\^\\!.*?[\\"!]', comment: 'Zupfnoter annoation' }, { token: 'zupfnoter.annotationref.string.quoted', regex: '[\\"!]\\^\\#.*?[\\"!]', comment: 'Zupfnoter annotation reference' }, { token: 'chordname.string.quoted', regex: '[\\"!]\\^.*?[\\"!]', comment: 'abc chord' }, { token: 'string.quoted', regex: '[\\"!].*?[\\"!]', comment: 'abc annotation' } ] }; // this.embedRules(JsonHighlightRules, "json-") this.normalizeRules(); }; ABCHighlightRules.metaData = { fileTypes: ['abc'], name: 'ABC', scopeName: 'text.abcnotation' }; oop.inherits(ABCHighlightRules, TextHighlightRules); exports.ABCHighlightRules = ABCHighlightRules; }); ================================================ FILE: lib/ace/mode/actionscript.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ActionScriptHighlightRules = require("./actionscript_highlight_rules").ActionScriptHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ActionScriptHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/actionscript"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/actionscript_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* This file was autogenerated from tm bundles\actionscript.tmbundle\Syntaxes\ActionScript.plist (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ActionScriptHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'support.class.actionscript.2', regex: '\\b(?:R(?:ecordset|DBMSResolver|adioButton(?:Group)?)|X(?:ML(?:Socket|Node|Connector)?|UpdateResolverDataHolder)|M(?:M(?:Save|Execute)|icrophoneMicrophone|o(?:use|vieClip(?:Loader)?)|e(?:nu(?:Bar)?|dia(?:Controller|Display|Playback))|ath)|B(?:yName|inding|utton)|S(?:haredObject|ystem|crollPane|t(?:yleSheet|age|ream)|ound|e(?:ndEvent|rviceObject)|OAPCall|lide)|N(?:umericStepper|et(?:stream|S(?:tream|ervices)|Connection|Debug(?:Config)?))|C(?:heckBox|o(?:ntextMenu(?:Item)?|okie|lor|m(?:ponentMixins|boBox))|ustomActions|lient|amera)|T(?:ypedValue|ext(?:Snapshot|Input|F(?:ield|ormat)|Area)|ree|AB)|Object|D(?:ownload|elta(?:Item|Packet)?|at(?:e(?:Chooser|Field)?|a(?:G(?:lue|rid)|Set|Type)))|U(?:RL|TC|IScrollBar)|P(?:opUpManager|endingCall|r(?:intJob|o(?:duct|gressBar)))|E(?:ndPoint|rror)|Video|Key|F(?:RadioButton|GridColumn|MessageBox|BarChart|S(?:croll(?:Bar|Pane)|tyleFormat|plitView)|orm|C(?:heckbox|omboBox|alendar)|unction|T(?:icker|ooltip(?:Lite)?|ree(?:Node)?)|IconButton|D(?:ataGrid|raggablePane)|P(?:ieChart|ushButton|ro(?:gressBar|mptBox))|L(?:i(?:stBox|neChart)|oadingBox)|AdvancedMessageBox)|W(?:indow|SDLURL|ebService(?:Connector)?)|L(?:ist|o(?:calConnection|ad(?:er|Vars)|g)|a(?:unch|bel))|A(?:sBroadcaster|cc(?:ordion|essibility)|S(?:Set(?:Native|PropFlags)|N(?:ew|ative)|C(?:onstructor|lamp(?:2)?)|InstanceOf)|pplication|lert|rray))\\b' }, { token: 'support.function.actionscript.2', regex: '\\b(?:s(?:h(?:ift|ow(?:GridLines|Menu|Border|Settings|Headers|ColumnHeaders|Today|Preferences)?|ad(?:ow|ePane))|c(?:hema|ale(?:X|Mode|Y|Content)|r(?:oll(?:Track|Drag)?|een(?:Resolution|Color|DPI)))|t(?:yleSheet|op(?:Drag|A(?:nimation|llSounds|gent))?|epSize|a(?:tus|rt(?:Drag|A(?:nimation|gent))?))|i(?:n|ze|lence(?:TimeOut|Level))|o(?:ngname|urce|rt(?:Items(?:By)?|On(?:HeaderRelease)?|able(?:Columns)?)?)|u(?:ppressInvalidCalls|bstr(?:ing)?)|p(?:li(?:ce|t)|aceCol(?:umnsEqually|lumnsEqually))|e(?:nd(?:DefaultPushButtonEvent|AndLoad)?|curity|t(?:R(?:GB|o(?:otNode|w(?:Height|Count))|esizable(?:Columns)?|a(?:nge|te))|G(?:ain|roupName)|X(?:AxisTitle)?|M(?:i(?:n(?:imum|utes)|lliseconds)|o(?:nth(?:Names)?|tionLevel|de)|ultilineMode|e(?:ssage|nu(?:ItemEnabled(?:At)?|EnabledAt)|dia)|a(?:sk|ximum))|B(?:u(?:tton(?:s|Width)|fferTime)|a(?:seTabIndex|ndwidthLimit|ckground))|S(?:howAsDisabled|croll(?:ing|Speed|Content|Target|P(?:osition|roperties)|barState|Location)|t(?:yle(?:Property)?|opOnFocus|at(?:us|e))|i(?:ze|lenceLevel)|ort(?:able(?:Columns)?|Function)|p(?:litterBarPosition|acing)|e(?:conds|lect(?:Multiple|ion(?:Required|Type)?|Style|Color|ed(?:Node(?:s)?|Cell|I(?:nd(?:ices|ex)|tem(?:s)?))?|able))|kin|m(?:oothness|allScroll))|H(?:ighlight(?:s|Color)|Scroll|o(?:urs|rizontal)|eader(?:Symbol|Height|Text|Property|Format|Width|Location)?|as(?:Shader|CloseBox))|Y(?:ear|AxisTitle)?|N(?:ode(?:Properties|ExpansionHandler)|ewTextFormat)|C(?:h(?:ildNodes|a(?:ngeHandler|rt(?:Title|EventHandler)))|o(?:ntent(?:Size)?|okie|lumns)|ell(?:Symbol|Data)|l(?:i(?:ckHandler|pboard)|oseHandler)|redentials)|T(?:ype(?:dVaule)?|i(?:tle(?:barHeight)?|p(?:Target|Offset)?|me(?:out(?:Handler)?)?)|oggle|extFormat|ransform)|I(?:s(?:Branch|Open)|n(?:terval|putProperty)|con(?:SymbolName)?|te(?:rator|m(?:ByKey|Symbol)))|Orientation|D(?:i(?:splay(?:Range|Graphics|Mode|Clip|Text|edMonth)|rection)|uration|e(?:pth(?:Below|To|Above)|fault(?:GatewayURL|Mappings|NodeIconSymbolName)|l(?:iveryMode|ay)|bug(?:ID)?)|a(?:yOfWeekNames|t(?:e(?:Filter)?|a(?:Mapping(?:s)?|Item(?:Text|Property|Format)|Provider|All(?:Height|Property|Format|Width))?))|ra(?:wConnectors|gContent))|U(?:se(?:Shadow|HandCursor|EchoSuppression|rInput|Fade)|TC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear))|P(?:osition|ercentComplete|an(?:e(?:M(?:inimumSize|aximumSize)|Size|Title))?|ro(?:pert(?:y(?:Data)?|iesAt)|gress))|E(?:nabled|dit(?:Handler|able)|xpand(?:NodeTrigger|erSymbolName))|V(?:Scroll|olume|alue(?:Source)?)|KeyFrameInterval|Quality|F(?:i(?:eld|rst(?:DayOfWeek|VisibleNode))|ocus|ullYear|ps|ade(?:InLength|OutLength)|rame(?:Color|Width))|Width|L(?:ine(?:Color|Weight)|o(?:opback|adTarget)|a(?:rgeScroll|bel(?:Source|Placement)?))|A(?:s(?:Boolean|String|Number)|n(?:yTypedValue|imation)|ctiv(?:e(?:State(?:Handler)?|Handler)|ateHandler)|utoH(?:ideScrollBar|eight)))?|paratorBefore|ek|lect(?:ion(?:Disabled|Unfocused)?|ed(?:Node(?:s)?|Child|I(?:nd(?:ices|ex)|tem(?:s)?)|Dat(?:e|a))?|able(?:Ranges)?)|rver(?:String)?)|kip|qrt|wapDepths|lice|aveToSharedObj|moothing)|h(?:scroll(?:Policy)?|tml(?:Text)?|i(?:t(?:Test(?:TextNearPos)?|Area)|de(?:BuiltInItems|Child)?|ghlight(?:2D|3D)?)|orizontal|e(?:ight|ader(?:Re(?:nderer|lease)|Height|Text))|P(?:osition|ageScrollSize)|a(?:s(?:childNodes|MP3|S(?:creen(?:Broadcast|Playback)|treaming(?:Video|Audio)|ort)|Next|OwnProperty|Pr(?:inting|evious)|EmbeddedVideo|VideoEncoder|A(?:ccesibility|udio(?:Encoder)?))|ndlerName)|LineScrollSize)|ye(?:sLabel|ar)|n(?:o(?:t|de(?:Name|Close|Type|Open|Value)|Label)|u(?:llValue|mChild(?:S(?:creens|lides)|ren|Forms))|e(?:w(?:Item|line|Value|LocationDialog)|xt(?:S(?:cene|ibling|lide)|TabIndex|Value|Frame)?)?|ame(?:s)?)|c(?:h(?:ildNodes|eck|a(?:nge(?:sPending)?|r(?:CodeAt|At))|r)|o(?:s|n(?:st(?:ant|ructor)|nect|c(?:urrency|at)|t(?:ent(?:Type|Path)?|ains|rol(?:Placement|lerPolicy))|denseWhite|version)|py|l(?:or|umn(?:Stretch|Name(?:s)?|Count))|m(?:p(?:onent|lete)|ment))|u(?:stomItems|ePoint(?:s)?|r(?:veTo|Value|rent(?:Slide|ChildSlide|Item|F(?:ocused(?:S(?:creen|lide)|Form)|ps))))|e(?:il|ll(?:Renderer|Press|Edit|Focus(?:In|Out)))|l(?:i(?:ck|ents)|o(?:se(?:Button|Pane)?|ne(?:Node)?)|ear(?:S(?:haredObjects|treams)|Timeout|Interval)?)|a(?:ncelLabel|tch|p(?:tion|abilities)|l(?:cFields|l(?:e(?:e|r))?))|reate(?:GatewayConnection|Menu|Se(?:rver|gment)|C(?:hild(?:AtDepth)?|l(?:ient|ass(?:ChildAtDepth|Object(?:AtDepth)?))|all)|Text(?:Node|Field)|Item|Object(?:AtDepth)?|PopUp|E(?:lement|mptyMovieClip)))|t(?:h(?:is|row)|ype(?:of|Name)?|i(?:tle(?:StyleDeclaration)?|me(?:out)?)|o(?:talTime|String|olTipText|p|UpperCase|ggle(?:HighQuality)?|Lo(?:caleString|werCase))|e(?:st|llTarget|xt(?:RightMargin|Bold|S(?:ize|elected)|Height|Color|I(?:ndent|talic)|Disabled|Underline|F(?:ield|ont)|Width|LeftMargin|Align)?)|a(?:n|rget(?:Path)?|b(?:Stops|Children|Index|Enabled|leName))|r(?:y|igger|ac(?:e|k(?:AsMenu)?)))|i(?:s(?:Running|Branch|NaN|Con(?:soleOpen|nected)|Toggled|Installed|Open|D(?:own|ebugger)|P(?:urchased|ro(?:totypeOf|pertyEnumerable))|Empty|F(?:inite|ullyPopulated)|Local|Active)|n(?:s(?:tall|ertBefore)|cludeDeltaPacketInfo|t|it(?:ialize|Component|Pod|A(?:pplication|gent))?|de(?:nt|terminate|x(?:InParent(?:Slide|Form)?|Of)?)|put|validate|finity|LocalInternetCache)?|con(?:F(?:ield|unction))?|t(?:e(?:ratorScrolled|m(?:s|RollO(?:ut|ver)|ClassName))|alic)|d3|p|fFrameLoaded|gnore(?:Case|White))|o(?:s|n(?:R(?:ollO(?:ut|ver)|e(?:s(?:ize|ult)|l(?:ease(?:Outside)?|aseOutside)))|XML|Mouse(?:Move|Down|Up|Wheel)|S(?:ync|croller|tatus|oundComplete|e(?:tFocus|lect(?:edItem)?))|N(?:oticeEvent|etworkChange)|C(?:hanged|onnect|l(?:ipEvent|ose))|ID3|D(?:isconnect|eactivate|ata|ragO(?:ut|ver))|Un(?:install|load)|P(?:aymentResult|ress)|EnterFrame|K(?:illFocus|ey(?:Down|Up))|Fault|Lo(?:ad|g)|A(?:ctiv(?:ity|ate)|ppSt(?:op|art)))?|pe(?:n|ration)|verLayChildren|kLabel|ldValue|r(?:d)?)|d(?:i(?:s(?:connect|play(?:Normal|ed(?:Month|Year)|Full)|able(?:Shader|d(?:Ranges|Days)|CloseBox|Events))|rection)|o(?:cTypeDecl|tall|Decoding|main|LazyDecoding)|u(?:plicateMovieClip|ration)|e(?:stroy(?:ChildAt|Object)|code|fault(?:PushButton(?:Enabled)?|KeydownHandler)?|l(?:ta(?:Packet(?:Changed)?)?|ete(?:PopUp|All)?)|blocking)|a(?:shBoardSave|yNames|ta(?:Provider)?|rkshadow)|r(?:opdown(?:Width)?|a(?:w|gO(?:ut|ver))))|u(?:se(?:Sort|HandCursor|Codepage|EchoSuppression)|n(?:shift|install|derline|escape|format|watch|lo(?:ck|ad(?:Movie(?:Num)?)?))|pdate(?:Results|Mode|I(?:nputProperties|tem(?:ByIndex)?)|P(?:acket|roperties)|View|AfterEvent)|rl)|join|p(?:ixelAspectRatio|o(?:sition|p|w)|u(?:sh|rge|blish)|ercen(?:tComplete|Loaded)|lay(?:head(?:Change|Time)|ing|Hidden|erType)?|a(?:ssword|use|r(?:se(?:XML|CSS|Int|Float)|ent(?:Node|Is(?:S(?:creen|lide)|Form))|ams))|r(?:int(?:Num|AsBitmap(?:Num)?)?|o(?:to(?:type)?|pert(?:y|ies)|gress)|e(?:ss|v(?:ious(?:S(?:ibling|lide)|Value)?|Scene|Frame)|ferred(?:Height|Width))))|e(?:scape|n(?:code(?:r)?|ter(?:Frame)?|dFill|able(?:Shader|d|CloseBox|Events))|dit(?:able|Field|LocationDialog)|v(?:ent|al(?:uate)?)|q|x(?:tended|p|ec(?:ute)?|actSettings)|m(?:phasized(?:StyleDeclaration)?|bedFonts))|v(?:i(?:sible|ewPod)|ScrollPolicy|o(?:id|lume)|ersion|P(?:osition|ageScrollSize)|a(?:l(?:idat(?:ionError|e(?:Property|ActivationKey)?)|ue(?:Of)?)|riable)|LineScrollSize)|k(?:ind|ey(?:Down|Up|Press|FrameInterval))|q(?:sort|uality)|f(?:scommand|i(?:n(?:d(?:Text|First|Last)?|ally)|eldInfo|lter(?:ed|Func)?|rst(?:Slide|Child|DayOfWeek|VisibleNode)?)|o(?:nt|cus(?:In|edCell|Out|Enabled)|r(?:egroundDisabled|mat(?:ter)?))|unctionName|ps|l(?:oor|ush)|ace|romCharCode)|w(?:i(?:th|dth)|ordWrap|atch|riteAccess)|l(?:t|i(?:st(?:Owner)?|ne(?:Style|To))|o(?:c(?:k|a(?:t(?:ion|eByld)|l(?:ToGlobal|FileReadDisable)))|opback|ad(?:Movie(?:Num)?|S(?:crollContent|ound)|ed|Variables(?:Num)?|Application)?|g(?:Changes)?)|e(?:ngth|ft(?:Margin)?|ading)?|a(?:st(?:Slide|Child|Index(?:Of)?)?|nguage|b(?:el(?:Placement|F(?:ield|unction))?|leField)))|a(?:s(?:scociate(?:Controller|Display)|in|pectRatio|function)|nd|c(?:ceptConnection|tiv(?:ityLevel|ePlayControl)|os)|t(?:t(?:ach(?:Movie|Sound|Video|Audio)|ributes)|an(?:2)?)|dd(?:header|RequestHeader|Menu(?:Item(?:At)?|At)?|Sort|Header|No(?:tice|de(?:At)?)|C(?:olumn(?:At)?|uePoint)|T(?:oLocalInternetCache|reeNode(?:At)?)|I(?:con|tem(?:s(?:At)?|At)?)|DeltaItem|P(?:od|age|roperty)|EventListener|View|FieldInfo|Listener|Animation)?|uto(?:Size|Play|KeyNav|Load)|pp(?:endChild|ly(?:Changes|Updates)?)|vHardwareDisable|fterLoaded|l(?:ternateRowColors|ign|l(?:ow(?:InsecureDomain|Domain)|Transitions(?:InDone|OutDone))|bum)|r(?:tist|row|g(?:uments|List))|gent|bs)|r(?:ight(?:Margin)?|o(?:ot(?:S(?:creen|lide)|Form)|und|w(?:Height|Count)|llO(?:ut|ver))|e(?:s(?:yncDepth|t(?:orePane|artAnimation|rict)|iz(?:e|able(?:Columns)?)|olveDelta|ult(?:s)?|ponse)|c(?:o(?:ncile(?:Results|Updates)|rd)|eive(?:Video|Audio))|draw|jectConnection|place(?:Sel|ItemAt|AllItems)?|ve(?:al(?:Child)?|rse)|quest(?:SizeChange|Payment)?|f(?:errer|resh(?:ScrollContent|Destinations|Pane|FromSources)?)|lease(?:Outside)?|ad(?:Only|Access)|gister(?:SkinElement|C(?:olor(?:Style|Name)|lass)|InheritingStyle|Proxy)|move(?:Range|M(?:ovieClip|enu(?:Item(?:At)?|At))|Background|Sort|No(?:tice|de(?:sAt|At)?)|C(?:olum(?:nAt|At)|uePoints)|T(?:extField|reeNode(?:At)?)|Item(?:At)?|Pod|EventListener|FromLocalInternetCache|Listener|All(?:C(?:olumns|uePoints)|Items)?))|a(?:ndom|te|dioDot))|g(?:t|oto(?:Slide|NextSlide|PreviousSlide|FirstSlide|LastSlide|And(?:Stop|Play))|e(?:nre|t(?:R(?:GB|o(?:otNode|wCount)|e(?:sizable|mote))|X(?:AxisTitle)?|M(?:i(?:n(?:imum(?:Size)?|utes)|lliseconds)|onth(?:Names)?|ultilineMode|e(?:ssage|nu(?:ItemAt|EnabledAt|At))|aximum(?:Size)?)|B(?:ytes(?:Total|Loaded)|ounds|utton(?:s|Width)|eginIndex|a(?:ndwidthLimit|ckground))|S(?:howAsDisabled|croll(?:ing|Speed|Content|Position|barState|Location)|t(?:yle(?:Names)?|opOnFocus|ate)|ize|o(?:urce|rtState)|p(?:litterBarPosition|acing)|e(?:conds|lect(?:Multiple|ion(?:Required|Type)|Style|ed(?:Node(?:s)?|Cell|Text|I(?:nd(?:ices|ex)|tem(?:s)?))?)|rvice)|moothness|WFVersion)|H(?:ighlight(?:s|Color)|ours|e(?:ight|ader(?:Height|Text|Property|Format|Width|Location)?)|as(?:Shader|CloseBox))|Y(?:ear|AxisTitle)?|N(?:o(?:tices|de(?:DisplayedAt|At))|um(?:Children|berAvailable)|e(?:wTextFormat|xtHighestDepth))|C(?:h(?:ild(?:S(?:creen|lide)|Nodes|Form|At)|artTitle)|o(?:n(?:tent|figInfo)|okie|de|unt|lumn(?:Names|Count|Index|At))|uePoint|ellIndex|loseHandler|a(?:ll|retIndex))|T(?:ypedValue|i(?:tle(?:barHeight)?|p(?:Target|Offset)?|me(?:stamp|zoneOffset|out(?:State|Handler)|r)?)|oggle|ext(?:Extent|Format)?|r(?:ee(?:NodeAt|Length)|ans(?:form|actionId)))|I(?:s(?:Branch|Open)|n(?:stanceAtDepth|d(?:icesByKey|exByKey))|con(?:SymbolName)?|te(?:rator|m(?:sByKey|By(?:Name|Key)|id|ID|At))|d)|O(?:utput(?:Parameter(?:s|ByName)?|Value(?:s)?)|peration|ri(?:entation|ginalCellData))|D(?:i(?:s(?:play(?:Range|Mode|Clip|Index|edMonth)|kUsage)|rection)|uration|e(?:pth|faultNodeIconSymbolName|l(?:taPacket|ay)|bug(?:Config|ID)?)|a(?:y(?:OfWeekNames)?|t(?:e|a(?:Mapping(?:s)?|Item(?:Text|Property|Format)|Label|All(?:Height|Property|Format|Width))?))|rawConnectors)|U(?:se(?:Shadow|HandCursor|rInput|Fade)|RL|TC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear))|P(?:o(?:sition|ds)|ercentComplete|a(?:n(?:e(?:M(?:inimums|aximums)|Height|Title|Width))?|rentNode)|r(?:operty(?:Name|Data)?|efer(?:ences|red(?:Height|Width))))|E(?:n(?:dIndex|abled)|ditingData|x(?:panderSymbolName|andNodeTrigger))|V(?:iewed(?:Pods|Applications)|olume|ersion|alue(?:Source)?)|F(?:i(?:eld|rst(?:DayOfWeek|VisibleNode))|o(?:ntList|cus)|ullYear|ade(?:InLength|OutLength)|rame(?:Color|Width))|Width|L(?:ine(?:Color|Weight)|o(?:cal|adTarget)|ength|a(?:stTabIndex|bel(?:Source)?))|A(?:s(?:cii|Boolean|String|Number)|n(?:yTypedValue|imation)|ctiv(?:eState(?:Handler)?|ateHandler)|utoH(?:ideScrollBar|eight)|llItems|gent))?)?|lobal(?:StyleFormat|ToLocal)?|ain|roupName)|x(?:updatePackety|mlDecl)?|m(?:y(?:MethodName|Call)|in(?:imum)?|o(?:nthNames|tion(?:TimeOut|Level)|de(?:lChanged)?|use(?:Move|O(?:ut|ver)|Down(?:Somewhere|Outside)?|Up(?:Somewhere)?|WheelEnabled)|ve(?:To)?)|u(?:ted|lti(?:pleS(?:imultaneousAllowed|elections)|line))|e(?:ssage|nu(?:Show|Hide)?|th(?:od)?|diaType)|a(?:nufacturer|tch|x(?:scroll|hscroll|imum|HPosition|Chars|VPosition)?)|b(?:substring|chr|ord|length))|b(?:ytes(?:Total|Loaded)|indFormat(?:Strings|Function)|o(?:ttom(?:Scroll)?|ld|rder(?:Color)?)|u(?:tton(?:Height|Width)|iltInItems|ffer(?:Time|Length)|llet)|e(?:foreApplyUpdates|gin(?:GradientFill|Fill))|lockIndent|a(?:ndwidth|ckground(?:Style|Color|Disabled)?)|roadcastMessage)|onHTTPStatus)\\b' }, { token: 'support.constant.actionscript.2', regex: '\\b(?:__proto__|__resolve|_accProps|_alpha|_changed|_currentframe|_droptarget|_flash|_focusrect|_framesloaded|_global|_height|_highquality|_level|_listeners|_lockroot|_name|_parent|_quality|_root|_rotation|_soundbuftime|_target|_totalframes|_url|_visible|_width|_x|_xmouse|_xscale|_y|_ymouse|_yscale)\\b' }, { token: 'keyword.control.actionscript.2', regex: '\\b(?:dynamic|extends|import|implements|interface|public|private|new|static|super|var|for|in|break|continue|while|do|return|if|else|case|switch)\\b' }, { token: 'storage.type.actionscript.2', regex: '\\b(?:Boolean|Number|String|Void)\\b' }, { token: 'constant.language.actionscript.2', regex: '\\b(?:null|undefined|true|false)\\b' }, { token: 'constant.numeric.actionscript.2', regex: '\\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\\.?[0-9]*|\\.[0-9]+)(?:(?:e|E)(?:\\+|-)?[0-9]+)?)(?:L|l|UL|ul|u|U|F|f)?\\b' }, { token: 'punctuation.definition.string.begin.actionscript.2', regex: '"', push: [ { token: 'punctuation.definition.string.end.actionscript.2', regex: '"', next: 'pop' }, { token: 'constant.character.escape.actionscript.2', regex: '\\\\.' }, { defaultToken: 'string.quoted.double.actionscript.2' } ] }, { token: 'punctuation.definition.string.begin.actionscript.2', regex: '\'', push: [ { token: 'punctuation.definition.string.end.actionscript.2', regex: '\'', next: 'pop' }, { token: 'constant.character.escape.actionscript.2', regex: '\\\\.' }, { defaultToken: 'string.quoted.single.actionscript.2' } ] }, { token: 'support.constant.actionscript.2', regex: '\\b(?:BACKSPACE|CAPSLOCK|CONTROL|DELETEKEY|DOWN|END|ENTER|HOME|INSERT|LEFT|LN10|LN2|LOG10E|LOG2E|MAX_VALUE|MIN_VALUE|NEGATIVE_INFINITY|NaN|PGDN|PGUP|PI|POSITIVE_INFINITY|RIGHT|SPACE|SQRT1_2|SQRT2|UP)\\b' }, { token: 'punctuation.definition.comment.actionscript.2', regex: '/\\*', push: [ { token: 'punctuation.definition.comment.actionscript.2', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.actionscript.2' } ] }, { token: 'punctuation.definition.comment.actionscript.2', regex: '//.*$', push_: [ { token: 'comment.line.double-slash.actionscript.2', regex: '$', next: 'pop' }, { defaultToken: 'comment.line.double-slash.actionscript.2' } ] }, { token: 'keyword.operator.actionscript.2', regex: '\\binstanceof\\b' }, { token: 'keyword.operator.symbolic.actionscript.2', regex: '[-!%&*+=/?:]' }, { token: [ 'meta.preprocessor.actionscript.2', 'punctuation.definition.preprocessor.actionscript.2', 'meta.preprocessor.actionscript.2' ], regex: '^([ \\t]*)(#)([a-zA-Z]+)' }, { token: [ 'storage.type.function.actionscript.2', 'meta.function.actionscript.2', 'entity.name.function.actionscript.2', 'meta.function.actionscript.2', 'punctuation.definition.parameters.begin.actionscript.2' ], regex: '\\b(function)(\\s+)([a-zA-Z_]\\w*)(\\s*)(\\()', push: [ { token: 'punctuation.definition.parameters.end.actionscript.2', regex: '\\)', next: 'pop' }, { token: 'variable.parameter.function.actionscript.2', regex: '[^,)$]+' }, { defaultToken: 'meta.function.actionscript.2' } ] }, { token: [ 'storage.type.class.actionscript.2', 'meta.class.actionscript.2', 'entity.name.type.class.actionscript.2', 'meta.class.actionscript.2', 'storage.modifier.extends.actionscript.2', 'meta.class.actionscript.2', 'entity.other.inherited-class.actionscript.2' ], regex: '\\b(class)(\\s+)([a-zA-Z_](?:\\w|\\.)*)(?:(\\s+)(extends)(\\s+)([a-zA-Z_](?:\\w|\\.)*))?' } ] }; this.normalizeRules(); }; ActionScriptHighlightRules.metaData = { fileTypes: [ 'as' ], keyEquivalent: '^~A', name: 'ActionScript', scopeName: 'source.actionscript.2' }; oop.inherits(ActionScriptHighlightRules, TextHighlightRules); exports.ActionScriptHighlightRules = ActionScriptHighlightRules; }); ================================================ FILE: lib/ace/mode/ada.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AdaHighlightRules = require("./ada_highlight_rules").AdaHighlightRules; var Mode = function() { this.HighlightRules = AdaHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.$id = "ace/mode/ada"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/ada_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AdaHighlightRules = function() { var keywords = "abort|else|new|return|abs|elsif|not|reverse|abstract|end|null|accept|entry|select|" + "access|exception|of|separate|aliased|exit|or|some|all|others|subtype|and|for|out|synchronized|" + "array|function|overriding|at|tagged|generic|package|task|begin|goto|pragma|terminate|" + "body|private|then|if|procedure|type|case|in|protected|constant|interface|until|" + "|is|raise|use|declare|range|delay|limited|record|when|delta|loop|rem|while|digits|renames|with|do|mod|requeue|xor"; var builtinConstants = ( "true|false|null" ); var builtinFunctions = ( "count|min|max|avg|sum|rank|now|coalesce|main" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants }, "identifier", true); this.$rules = { "start" : [ { token : "comment", regex : "--.*$" }, { token : "string", // " string regex : '".*?"' }, { token : "string", // ' string regex : "'.*?'" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" }, { token : "paren.lparen", regex : "[\\(]" }, { token : "paren.rparen", regex : "[\\)]" }, { token : "text", regex : "\\s+" } ] }; }; oop.inherits(AdaHighlightRules, TextHighlightRules); exports.AdaHighlightRules = AdaHighlightRules; }); ================================================ FILE: lib/ace/mode/apache_conf.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Contributor(s): * * * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ApacheConfHighlightRules = require("./apache_conf_highlight_rules").ApacheConfHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = ApacheConfHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "#"; this.$id = "ace/mode/apache_conf"; // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/apache_conf_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* This file was autogenerated from https://raw.github.com/colinta/ApacheConf.tmLanguage/master/ApacheConf.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ApacheConfHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: [ 'punctuation.definition.comment.apacheconf', 'comment.line.hash.ini', 'comment.line.hash.ini' ], regex: '^((?:\\s)*)(#)(.*$)' }, { token: [ 'punctuation.definition.tag.apacheconf', 'entity.tag.apacheconf', 'text', 'string.value.apacheconf', 'punctuation.definition.tag.apacheconf' ], regex: '(<)(Proxy|ProxyMatch|IfVersion|Directory|DirectoryMatch|Files|FilesMatch|IfDefine|IfModule|Limit|LimitExcept|Location|LocationMatch|VirtualHost)(?:(\\s)(.+?))?(>)' }, { token: [ 'punctuation.definition.tag.apacheconf', 'entity.tag.apacheconf', 'punctuation.definition.tag.apacheconf' ], regex: '()' }, { token: [ 'keyword.alias.apacheconf', 'text', 'string.regexp.apacheconf', 'text', 'string.replacement.apacheconf', 'text' ], regex: '(Rewrite(?:Rule|Cond))(\\s+)(.+?)(\\s+)(.+?)($|\\s)' }, { token: [ 'keyword.alias.apacheconf', 'text', 'entity.status.apacheconf', 'text', 'string.regexp.apacheconf', 'text', 'string.path.apacheconf', 'text' ], regex: '(RedirectMatch)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' }, { token: [ 'keyword.alias.apacheconf', 'text', 'entity.status.apacheconf', 'text', 'string.path.apacheconf', 'text', 'string.path.apacheconf', 'text' ], regex: '(Redirect)(?:(\\s+)(\\d\\d\\d|permanent|temp|seeother|gone))?(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' }, { token: [ 'keyword.alias.apacheconf', 'text', 'string.regexp.apacheconf', 'text', 'string.path.apacheconf', 'text' ], regex: '(ScriptAliasMatch|AliasMatch)(\\s+)(.+?)(\\s+)(?:(.+?)(\\s))?' }, { token: [ 'keyword.alias.apacheconf', 'text', 'string.path.apacheconf', 'text', 'string.path.apacheconf', 'text' ], regex: '(RedirectPermanent|RedirectTemp|ScriptAlias|Alias)(\\s+)(.+?)(\\s+)(?:(.+?)($|\\s))?' }, { token: 'keyword.core.apacheconf', regex: '\\b(?:AcceptPathInfo|AccessFileName|AddDefaultCharset|AddOutputFilterByType|AllowEncodedSlashes|AllowOverride|AuthName|AuthType|CGIMapExtension|ContentDigest|DefaultType|DocumentRoot|EnableMMAP|EnableSendfile|ErrorDocument|ErrorLog|FileETag|ForceType|HostnameLookups|IdentityCheck|Include|KeepAlive|KeepAliveTimeout|LimitInternalRecursion|LimitRequestBody|LimitRequestFields|LimitRequestFieldSize|LimitRequestLine|LimitXMLRequestBody|LogLevel|MaxKeepAliveRequests|NameVirtualHost|Options|Require|RLimitCPU|RLimitMEM|RLimitNPROC|Satisfy|ScriptInterpreterSource|ServerAdmin|ServerAlias|ServerName|ServerPath|ServerRoot|ServerSignature|ServerTokens|SetHandler|SetInputFilter|SetOutputFilter|TimeOut|TraceEnable|UseCanonicalName)\\b' }, { token: 'keyword.mpm.apacheconf', regex: '\\b(?:AcceptMutex|AssignUserID|BS2000Account|ChildPerUserID|CoreDumpDirectory|EnableExceptionHook|Group|Listen|ListenBacklog|LockFile|MaxClients|MaxMemFree|MaxRequestsPerChild|MaxRequestsPerThread|MaxSpareServers|MaxSpareThreads|MaxThreads|MaxThreadsPerChild|MinSpareServers|MinSpareThreads|NumServers|PidFile|ReceiveBufferSize|ScoreBoardFile|SendBufferSize|ServerLimit|StartServers|StartThreads|ThreadLimit|ThreadsPerChild|ThreadStackSize|User|Win32DisableAcceptEx)\\b' }, { token: 'keyword.access.apacheconf', regex: '\\b(?:Allow|Deny|Order)\\b' }, { token: 'keyword.actions.apacheconf', regex: '\\b(?:Action|Script)\\b' }, { token: 'keyword.alias.apacheconf', regex: '\\b(?:Alias|AliasMatch|Redirect|RedirectMatch|RedirectPermanent|RedirectTemp|ScriptAlias|ScriptAliasMatch)\\b' }, { token: 'keyword.auth.apacheconf', regex: '\\b(?:AuthAuthoritative|AuthGroupFile|AuthUserFile)\\b' }, { token: 'keyword.auth_anon.apacheconf', regex: '\\b(?:Anonymous|Anonymous_Authoritative|Anonymous_LogEmail|Anonymous_MustGiveEmail|Anonymous_NoUserID|Anonymous_VerifyEmail)\\b' }, { token: 'keyword.auth_dbm.apacheconf', regex: '\\b(?:AuthDBMAuthoritative|AuthDBMGroupFile|AuthDBMType|AuthDBMUserFile)\\b' }, { token: 'keyword.auth_digest.apacheconf', regex: '\\b(?:AuthDigestAlgorithm|AuthDigestDomain|AuthDigestFile|AuthDigestGroupFile|AuthDigestNcCheck|AuthDigestNonceFormat|AuthDigestNonceLifetime|AuthDigestQop|AuthDigestShmemSize)\\b' }, { token: 'keyword.auth_ldap.apacheconf', regex: '\\b(?:AuthLDAPAuthoritative|AuthLDAPBindDN|AuthLDAPBindPassword|AuthLDAPCharsetConfig|AuthLDAPCompareDNOnServer|AuthLDAPDereferenceAliases|AuthLDAPEnabled|AuthLDAPFrontPageHack|AuthLDAPGroupAttribute|AuthLDAPGroupAttributeIsDN|AuthLDAPRemoteUserIsDN|AuthLDAPUrl)\\b' }, { token: 'keyword.autoindex.apacheconf', regex: '\\b(?:AddAlt|AddAltByEncoding|AddAltByType|AddDescription|AddIcon|AddIconByEncoding|AddIconByType|DefaultIcon|HeaderName|IndexIgnore|IndexOptions|IndexOrderDefault|ReadmeName)\\b' }, { token: 'keyword.cache.apacheconf', regex: '\\b(?:CacheDefaultExpire|CacheDisable|CacheEnable|CacheForceCompletion|CacheIgnoreCacheControl|CacheIgnoreHeaders|CacheIgnoreNoLastMod|CacheLastModifiedFactor|CacheMaxExpire)\\b' }, { token: 'keyword.cern_meta.apacheconf', regex: '\\b(?:MetaDir|MetaFiles|MetaSuffix)\\b' }, { token: 'keyword.cgi.apacheconf', regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength)\\b' }, { token: 'keyword.cgid.apacheconf', regex: '\\b(?:ScriptLog|ScriptLogBuffer|ScriptLogLength|ScriptSock)\\b' }, { token: 'keyword.charset_lite.apacheconf', regex: '\\b(?:CharsetDefault|CharsetOptions|CharsetSourceEnc)\\b' }, { token: 'keyword.dav.apacheconf', regex: '\\b(?:Dav|DavDepthInfinity|DavMinTimeout|DavLockDB)\\b' }, { token: 'keyword.deflate.apacheconf', regex: '\\b(?:DeflateBufferSize|DeflateCompressionLevel|DeflateFilterNote|DeflateMemLevel|DeflateWindowSize)\\b' }, { token: 'keyword.dir.apacheconf', regex: '\\b(?:DirectoryIndex|DirectorySlash)\\b' }, { token: 'keyword.disk_cache.apacheconf', regex: '\\b(?:CacheDirLength|CacheDirLevels|CacheExpiryCheck|CacheGcClean|CacheGcDaily|CacheGcInterval|CacheGcMemUsage|CacheGcUnused|CacheMaxFileSize|CacheMinFileSize|CacheRoot|CacheSize|CacheTimeMargin)\\b' }, { token: 'keyword.dumpio.apacheconf', regex: '\\b(?:DumpIOInput|DumpIOOutput)\\b' }, { token: 'keyword.env.apacheconf', regex: '\\b(?:PassEnv|SetEnv|UnsetEnv)\\b' }, { token: 'keyword.expires.apacheconf', regex: '\\b(?:ExpiresActive|ExpiresByType|ExpiresDefault)\\b' }, { token: 'keyword.ext_filter.apacheconf', regex: '\\b(?:ExtFilterDefine|ExtFilterOptions)\\b' }, { token: 'keyword.file_cache.apacheconf', regex: '\\b(?:CacheFile|MMapFile)\\b' }, { token: 'keyword.headers.apacheconf', regex: '\\b(?:Header|RequestHeader)\\b' }, { token: 'keyword.imap.apacheconf', regex: '\\b(?:ImapBase|ImapDefault|ImapMenu)\\b' }, { token: 'keyword.include.apacheconf', regex: '\\b(?:SSIEndTag|SSIErrorMsg|SSIStartTag|SSITimeFormat|SSIUndefinedEcho|XBitHack)\\b' }, { token: 'keyword.isapi.apacheconf', regex: '\\b(?:ISAPIAppendLogToErrors|ISAPIAppendLogToQuery|ISAPICacheFile|ISAPIFakeAsync|ISAPILogNotSupported|ISAPIReadAheadBuffer)\\b' }, { token: 'keyword.ldap.apacheconf', regex: '\\b(?:LDAPCacheEntries|LDAPCacheTTL|LDAPConnectionTimeout|LDAPOpCacheEntries|LDAPOpCacheTTL|LDAPSharedCacheFile|LDAPSharedCacheSize|LDAPTrustedCA|LDAPTrustedCAType)\\b' }, { token: 'keyword.log.apacheconf', regex: '\\b(?:BufferedLogs|CookieLog|CustomLog|LogFormat|TransferLog|ForensicLog)\\b' }, { token: 'keyword.mem_cache.apacheconf', regex: '\\b(?:MCacheMaxObjectCount|MCacheMaxObjectSize|MCacheMaxStreamingBuffer|MCacheMinObjectSize|MCacheRemovalAlgorithm|MCacheSize)\\b' }, { token: 'keyword.mime.apacheconf', regex: '\\b(?:AddCharset|AddEncoding|AddHandler|AddInputFilter|AddLanguage|AddOutputFilter|AddType|DefaultLanguage|ModMimeUsePathInfo|MultiviewsMatch|RemoveCharset|RemoveEncoding|RemoveHandler|RemoveInputFilter|RemoveLanguage|RemoveOutputFilter|RemoveType|TypesConfig)\\b' }, { token: 'keyword.misc.apacheconf', regex: '\\b(?:ProtocolEcho|Example|AddModuleInfo|MimeMagicFile|CheckSpelling|ExtendedStatus|SuexecUserGroup|UserDir)\\b' }, { token: 'keyword.negotiation.apacheconf', regex: '\\b(?:CacheNegotiatedDocs|ForceLanguagePriority|LanguagePriority)\\b' }, { token: 'keyword.nw_ssl.apacheconf', regex: '\\b(?:NWSSLTrustedCerts|NWSSLUpgradeable|SecureListen)\\b' }, { token: 'keyword.proxy.apacheconf', regex: '\\b(?:AllowCONNECT|NoProxy|ProxyBadHeader|ProxyBlock|ProxyDomain|ProxyErrorOverride|ProxyFtpDirCharset|ProxyIOBufferSize|ProxyMaxForwards|ProxyPass|ProxyPassReverse|ProxyPreserveHost|ProxyReceiveBufferSize|ProxyRemote|ProxyRemoteMatch|ProxyRequests|ProxyTimeout|ProxyVia)\\b' }, { token: 'keyword.rewrite.apacheconf', regex: '\\b(?:RewriteBase|RewriteCond|RewriteEngine|RewriteLock|RewriteLog|RewriteLogLevel|RewriteMap|RewriteOptions|RewriteRule)\\b' }, { token: 'keyword.setenvif.apacheconf', regex: '\\b(?:BrowserMatch|BrowserMatchNoCase|SetEnvIf|SetEnvIfNoCase)\\b' }, { token: 'keyword.so.apacheconf', regex: '\\b(?:LoadFile|LoadModule)\\b' }, { token: 'keyword.ssl.apacheconf', regex: '\\b(?:SSLCACertificateFile|SSLCACertificatePath|SSLCARevocationFile|SSLCARevocationPath|SSLCertificateChainFile|SSLCertificateFile|SSLCertificateKeyFile|SSLCipherSuite|SSLEngine|SSLMutex|SSLOptions|SSLPassPhraseDialog|SSLProtocol|SSLProxyCACertificateFile|SSLProxyCACertificatePath|SSLProxyCARevocationFile|SSLProxyCARevocationPath|SSLProxyCipherSuite|SSLProxyEngine|SSLProxyMachineCertificateFile|SSLProxyMachineCertificatePath|SSLProxyProtocol|SSLProxyVerify|SSLProxyVerifyDepth|SSLRandomSeed|SSLRequire|SSLRequireSSL|SSLSessionCache|SSLSessionCacheTimeout|SSLUserName|SSLVerifyClient|SSLVerifyDepth)\\b' }, { token: 'keyword.usertrack.apacheconf', regex: '\\b(?:CookieDomain|CookieExpires|CookieName|CookieStyle|CookieTracking)\\b' }, { token: 'keyword.vhost_alias.apacheconf', regex: '\\b(?:VirtualDocumentRoot|VirtualDocumentRootIP|VirtualScriptAlias|VirtualScriptAliasIP)\\b' }, { token: [ 'keyword.php.apacheconf', 'text', 'entity.property.apacheconf', 'text', 'string.value.apacheconf', 'text' ], regex: '\\b(php_value|php_flag)\\b(?:(\\s+)(.+?)(?:(\\s+)(.+?))?)?(\\s)' }, { token: [ 'punctuation.variable.apacheconf', 'variable.env.apacheconf', 'variable.misc.apacheconf', 'punctuation.variable.apacheconf' ], regex: '(%\\{)(?:(HTTP_USER_AGENT|HTTP_REFERER|HTTP_COOKIE|HTTP_FORWARDED|HTTP_HOST|HTTP_PROXY_CONNECTION|HTTP_ACCEPT|REMOTE_ADDR|REMOTE_HOST|REMOTE_PORT|REMOTE_USER|REMOTE_IDENT|REQUEST_METHOD|SCRIPT_FILENAME|PATH_INFO|QUERY_STRING|AUTH_TYPE|DOCUMENT_ROOT|SERVER_ADMIN|SERVER_NAME|SERVER_ADDR|SERVER_PORT|SERVER_PROTOCOL|SERVER_SOFTWARE|TIME_YEAR|TIME_MON|TIME_DAY|TIME_HOUR|TIME_MIN|TIME_SEC|TIME_WDAY|TIME|API_VERSION|THE_REQUEST|REQUEST_URI|REQUEST_FILENAME|IS_SUBREQ|HTTPS)|(.*?))(\\})' }, { token: [ 'entity.mime-type.apacheconf', 'text' ], regex: '\\b((?:text|image|application|video|audio)/.+?)(\\s)' }, { token: 'entity.helper.apacheconf', regex: '\\b(?:from|unset|set|on|off)\\b', caseInsensitive: true }, { token: 'constant.integer.apacheconf', regex: '\\b\\d+\\b' }, { token: [ 'text', 'punctuation.definition.flag.apacheconf', 'string.flag.apacheconf', 'punctuation.definition.flag.apacheconf', 'text' ], regex: '(\\s)(\\[)(.*?)(\\])(\\s)' } ] }; this.normalizeRules(); }; ApacheConfHighlightRules.metaData = { fileTypes: [ 'conf', 'CONF', 'htaccess', 'HTACCESS', 'htgroups', 'HTGROUPS', 'htpasswd', 'HTPASSWD', '.htaccess', '.HTACCESS', '.htgroups', '.HTGROUPS', '.htpasswd', '.HTPASSWD' ], name: 'Apache Conf', scopeName: 'source.apacheconf' }; oop.inherits(ApacheConfHighlightRules, TextHighlightRules); exports.ApacheConfHighlightRules = ApacheConfHighlightRules; }); ================================================ FILE: lib/ace/mode/applescript.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AppleScriptHighlightRules = require("./applescript_highlight_rules").AppleScriptHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = AppleScriptHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.blockComment = {start: "(*", end: "*)"}; this.$id = "ace/mode/applescript"; // Extra logic goes here. }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/applescript_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AppleScriptHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used var keywords = ( "about|above|after|against|and|around|as|at|back|before|beginning|" + "behind|below|beneath|beside|between|but|by|considering|" + "contain|contains|continue|copy|div|does|eighth|else|end|equal|" + "equals|error|every|exit|fifth|first|for|fourth|from|front|" + "get|given|global|if|ignoring|in|into|is|it|its|last|local|me|" + "middle|mod|my|ninth|not|of|on|onto|or|over|prop|property|put|ref|" + "reference|repeat|returning|script|second|set|seventh|since|" + "sixth|some|tell|tenth|that|the|then|third|through|thru|" + "timeout|times|to|transaction|try|until|where|while|whose|with|without" ); var builtinConstants = ( "AppleScript|false|linefeed|return|pi|quote|result|space|tab|true" ); var builtinFunctions = ( "activate|beep|count|delay|launch|log|offset|read|round|run|say|" + "summarize|write" ); var builtinTypes = ( "alias|application|boolean|class|constant|date|file|integer|list|" + "number|real|record|string|text|character|characters|contents|day|" + "frontmost|id|item|length|month|name|paragraph|paragraphs|rest|" + "reverse|running|time|version|weekday|word|words|year" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "constant.language": builtinConstants, "support.type": builtinTypes, "keyword": keywords }, "identifier"); this.$rules = { "start": [ { token: "comment", regex: "--.*$" }, { token : "comment", // multi line comment regex : "\\(\\*", next : "comment" }, { token: "string", // " string regex: '".*?"' }, { token: "support.type", regex: '\\b(POSIX file|POSIX path|(date|time) string|quoted form)\\b' }, { token: "support.function", regex: '\\b(clipboard info|the clipboard|info for|list (disks|folder)|' + 'mount volume|path to|(close|open for) access|(get|set) eof|' + 'current date|do shell script|get volume settings|random number|' + 'set volume|system attribute|system info|time to GMT|' + '(load|run|store) script|scripting components|' + 'ASCII (character|number)|localized string|' + 'choose (application|color|file|file name|' + 'folder|from list|remote application|URL)|' + 'display (alert|dialog))\\b|^\\s*return\\b' }, { token: "constant.language", regex: '\\b(text item delimiters|current application|missing value)\\b' }, { token: "keyword", regex: '\\b(apart from|aside from|instead of|out of|greater than|' + "isn't|(doesn't|does not) (equal|come before|come after|contain)|" + '(greater|less) than( or equal)?|(starts?|ends|begins?) with|' + 'contained by|comes (before|after)|a (ref|reference))\\b' }, { token: keywordMapper, regex: "[a-zA-Z][a-zA-Z0-9_]*\\b" } ], "comment": [ { token: "comment", // closing comment regex: "\\*\\)", next: "start" }, { defaultToken: "comment" } ] }; this.normalizeRules(); }; oop.inherits(AppleScriptHighlightRules, TextHighlightRules); exports.AppleScriptHighlightRules = AppleScriptHighlightRules; }); ================================================ FILE: lib/ace/mode/asciidoc.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AsciidocHighlightRules = require("./asciidoc_highlight_rules").AsciidocHighlightRules; var AsciidocFoldMode = require("./folding/asciidoc").FoldMode; var Mode = function() { this.HighlightRules = AsciidocHighlightRules; this.foldingRules = new AsciidocFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.type = "text"; this.getNextLineIndent = function(state, line, tab) { if (state == "listblock") { var match = /^((?:.+)?)([-+*][ ]+)/.exec(line); if (match) { return new Array(match[1].length + 1).join(" ") + match[2]; } else { return ""; } } else { return this.$getIndent(line); } }; this.$id = "ace/mode/asciidoc"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/asciidoc_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AsciidocHighlightRules = function() { var identifierRe = "[a-zA-Z\u00a1-\uffff]+\\b"; this.$rules = { "start": [ {token: "empty", regex: /$/}, {token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"}, {token: "literal", regex: /^-{4,}\s*$/, next: "literalBlock"}, {token: "string", regex: /^\+{4,}\s*$/, next: "passthroughBlock"}, {token: "keyword", regex: /^={4,}\s*$/}, {token: "text", regex: /^\s*$/}, // immediately return to the start mode without matching anything {token: "empty", regex: "", next: "dissallowDelimitedBlock"} ], "dissallowDelimitedBlock": [ {include: "paragraphEnd"}, {token: "comment", regex: '^//.+$'}, {token: "keyword", regex: "^(?:NOTE|TIP|IMPORTANT|WARNING|CAUTION):"}, {include: "listStart"}, {token: "literal", regex: /^\s+.+$/, next: "indentedBlock"}, {token: "empty", regex: "", next: "text"} ], "paragraphEnd": [ {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "commentBlock"}, {token: "tableBlock", regex: /^\s*[|!]=+\s*$/, next: "tableBlock"}, // open block, ruller {token: "keyword", regex: /^(?:--|''')\s*$/, next: "start"}, {token: "option", regex: /^\[.*\]\s*$/, next: "start"}, {token: "pageBreak", regex: /^>{3,}$/, next: "start"}, {token: "literal", regex: /^\.{4,}\s*$/, next: "listingBlock"}, {token: "titleUnderline", regex: /^(?:={2,}|-{2,}|~{2,}|\^{2,}|\+{2,})\s*$/, next: "start"}, {token: "singleLineTitle", regex: /^={1,5}\s+\S.*$/, next: "start"}, {token: "otherBlock", regex: /^(?:\*{2,}|_{2,})\s*$/, next: "start"}, // .optional title {token: "optionalTitle", regex: /^\.[^.\s].+$/, next: "start"} ], "listStart": [ {token: "keyword", regex: /^\s*(?:\d+\.|[a-zA-Z]\.|[ixvmIXVM]+\)|\*{1,5}|-|\.{1,5})\s/, next: "listText"}, {token: "meta.tag", regex: /^.+(?::{2,4}|;;)(?: |$)/, next: "listText"}, {token: "support.function.list.callout", regex: /^(?:<\d+>|\d+>|>) /, next: "text"}, // continuation {token: "keyword", regex: /^\+\s*$/, next: "start"} ], "text": [ {token: ["link", "variable.language"], regex: /((?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+)(\[.*?\])/}, {token: "link", regex: /(?:https?:\/\/|ftp:\/\/|file:\/\/|mailto:|callto:)[^\s\[]+/}, {token: "link", regex: /\b[\w\.\/\-]+@[\w\.\/\-]+\b/}, {include: "macros"}, {include: "paragraphEnd"}, {token: "literal", regex:/\+{3,}/, next:"smallPassthrough"}, {token: "escape", regex: /\((?:C|TM|R)\)|\.{3}|->|<-|=>|<=|&#(?:\d+|x[a-fA-F\d]+);|(?: |^)--(?=\s+\S)/}, {token: "escape", regex: /\\[_*'`+#]|\\{2}[_*'`+#]{2}/}, {token: "keyword", regex: /\s\+$/}, // any word {token: "text", regex: identifierRe}, {token: ["keyword", "string", "keyword"], regex: /(<<[\w\d\-$]+,)(.*?)(>>|$)/}, {token: "keyword", regex: /<<[\w\d\-$]+,?|>>/}, {token: "constant.character", regex: /\({2,3}.*?\){2,3}/}, // Anchor {token: "keyword", regex: /\[\[.+?\]\]/}, // bibliography {token: "support", regex: /^\[{3}[\w\d =\-]+\]{3}/}, {include: "quotes"}, // text block end {token: "empty", regex: /^\s*$/, next: "start"} ], "listText": [ {include: "listStart"}, {include: "text"} ], "indentedBlock": [ {token: "literal", regex: /^[\s\w].+$/, next: "indentedBlock"}, {token: "literal", regex: "", next: "start"} ], "listingBlock": [ {token: "literal", regex: /^\.{4,}\s*$/, next: "dissallowDelimitedBlock"}, {token: "constant.numeric", regex: '<\\d+>'}, {token: "literal", regex: '[^<]+'}, {token: "literal", regex: '<'} ], "literalBlock": [ {token: "literal", regex: /^-{4,}\s*$/, next: "dissallowDelimitedBlock"}, {token: "constant.numeric", regex: '<\\d+>'}, {token: "literal", regex: '[^<]+'}, {token: "literal", regex: '<'} ], "passthroughBlock": [ {token: "literal", regex: /^\+{4,}\s*$/, next: "dissallowDelimitedBlock"}, {token: "literal", regex: identifierRe + "|\\d+"}, {include: "macros"}, {token: "literal", regex: "."} ], "smallPassthrough": [ {token: "literal", regex: /[+]{3,}/, next: "dissallowDelimitedBlock"}, {token: "literal", regex: /^\s*$/, next: "dissallowDelimitedBlock"}, {token: "literal", regex: identifierRe + "|\\d+"}, {include: "macros"} ], "commentBlock": [ {token: "doc.comment", regex: /^\/{4,}\s*$/, next: "dissallowDelimitedBlock"}, {token: "doc.comment", regex: '^.*$'} ], "tableBlock": [ {token: "tableBlock", regex: /^\s*\|={3,}\s*$/, next: "dissallowDelimitedBlock"}, {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "innerTableBlock"}, {token: "tableBlock", regex: /\|/}, {include: "text", noEscape: true} ], "innerTableBlock": [ {token: "tableBlock", regex: /^\s*!={3,}\s*$/, next: "tableBlock"}, {token: "tableBlock", regex: /^\s*|={3,}\s*$/, next: "dissallowDelimitedBlock"}, {token: "tableBlock", regex: /!/} ], "macros": [ {token: "macro", regex: /{[\w\-$]+}/}, {token: ["text", "string", "text", "constant.character", "text"], regex: /({)([\w\-$]+)(:)?(.+)?(})/}, {token: ["text", "markup.list.macro", "keyword", "string"], regex: /(\w+)(footnote(?:ref)?::?)([^\s\[]+)?(\[.*?\])?/}, {token: ["markup.list.macro", "keyword", "string"], regex: /([a-zA-Z\-][\w\.\/\-]*::?)([^\s\[]+)(\[.*?\])?/}, {token: ["markup.list.macro", "keyword"], regex: /([a-zA-Z\-][\w\.\/\-]+::?)(\[.*?\])/}, {token: "keyword", regex: /^:.+?:(?= |$)/} ], "quotes": [ {token: "string.italic", regex: /__[^_\s].*?__/}, {token: "string.italic", regex: quoteRule("_")}, {token: "keyword.bold", regex: /\*\*[^*\s].*?\*\*/}, {token: "keyword.bold", regex: quoteRule("\\*")}, {token: "literal", regex: quoteRule("\\+")}, {token: "literal", regex: /\+\+[^+\s].*?\+\+/}, {token: "literal", regex: /\$\$.+?\$\$/}, {token: "literal", regex: quoteRule("`")}, {token: "keyword", regex: quoteRule("^")}, {token: "keyword", regex: quoteRule("~")}, {token: "keyword", regex: /##?/}, {token: "keyword", regex: /(?:\B|^)``|\b''/} ] }; function quoteRule(ch) { var prefix = /\w/.test(ch) ? "\\b" : "(?:\\B|^)"; return prefix + ch + "[^" + ch + "].*?" + ch + "(?![\\w*])"; } //addQuoteBlock("text") var tokenMap = { macro: "constant.character", tableBlock: "doc.comment", titleUnderline: "markup.heading", singleLineTitle: "markup.heading", pageBreak: "string", option: "string.regexp", otherBlock: "markup.list", literal: "support.function", optionalTitle: "constant.numeric", escape: "constant.language.escape", link: "markup.underline.list" }; for (var state in this.$rules) { var stateRules = this.$rules[state]; for (var i = stateRules.length; i--; ) { var rule = stateRules[i]; if (rule.include || typeof rule == "string") { var args = [i, 1].concat(this.$rules[rule.include || rule]); if (rule.noEscape) { args = args.filter(function(x) { return !x.next; }); } stateRules.splice.apply(stateRules, args); } else if (rule.token in tokenMap) { rule.token = tokenMap[rule.token]; } } } }; oop.inherits(AsciidocHighlightRules, TextHighlightRules); exports.AsciidocHighlightRules = AsciidocHighlightRules; }); ================================================ FILE: lib/ace/mode/assembly_x86.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AssemblyX86HighlightRules = require("./assembly_x86_highlight_rules").AssemblyX86HighlightRules; var FoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = AssemblyX86HighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.$id = "ace/mode/assembly_x86"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/assembly_x86_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* This file was autogenerated from Assembly x86.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AssemblyX86HighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'keyword.control.assembly', regex: '\\b(?:aaa|aad|aam|aas|adc|add|addpd|addps|addsd|addss|addsubpd|addsubps|aesdec|aesdeclast|aesenc|aesenclast|aesimc|aeskeygenassist|and|andpd|andps|andnpd|andnps|arpl|blendpd|blendps|blendvpd|blendvps|bound|bsf|bsr|bswap|bt|btc|btr|bts|cbw|cwde|cdqe|clc|cld|cflush|clts|cmc|cmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|cmp|cmppd|cmpps|cmps|cnpsb|cmpsw|cmpsd|cmpsq|cmpss|cmpxchg|cmpxchg8b|cmpxchg16b|comisd|comiss|cpuid|crc32|cvtdq2pd|cvtdq2ps|cvtpd2dq|cvtpd2pi|cvtpd2ps|cvtpi2pd|cvtpi2ps|cvtps2dq|cvtps2pd|cvtps2pi|cvtsd2si|cvtsd2ss|cvts2sd|cvtsi2ss|cvtss2sd|cvtss2si|cvttpd2dq|cvtpd2pi|cvttps2dq|cvttps2pi|cvttps2dq|cvttps2pi|cvttsd2si|cvttss2si|cwd|cdq|cqo|daa|das|dec|div|divpd|divps|divsd|divss|dppd|dpps|emms|enter|extractps|f2xm1|fabs|fadd|faddp|fiadd|fbld|fbstp|fchs|fclex|fnclex|fcmov(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|fcom|fcmop|fcompp|fcomi|fcomip|fucomi|fucomip|fcos|fdecstp|fdiv|fdivp|fidiv|fdivr|fdivrp|fidivr|ffree|ficom|ficomp|fild|fincstp|finit|fnint|fist|fistp|fisttp|fld|fld1|fldl2t|fldl2e|fldpi|fldlg2|fldln2|fldz|fldcw|fldenv|fmul|fmulp|fimul|fnop|fpatan|fprem|fprem1|fptan|frndint|frstor|fsave|fnsave|fscale|fsin|fsincos|fsqrt|fst|fstp|fstcw|fnstcw|fstenv|fnstenv|fsts|fnstsw|fsub|fsubp|fisub|fsubr|fsubrp|fisubr|ftst|fucom|fucomp|fucompp|fxam|fxch|fxrstor|fxsave|fxtract|fyl2x|fyl2xp1|haddpd|haddps|husbpd|hsubps|idiv|imul|in|inc|ins|insb|insw|insd|insertps|int|into|invd|invplg|invpcid|iret|iretd|iretq|lahf|lar|lddqu|ldmxcsr|lds|les|lfs|lgs|lss|lea|leave|lfence|lgdt|lidt|llgdt|lmsw|lock|lods|lodsb|lodsw|lodsd|lodsq|lsl|ltr|maskmovdqu|maskmovq|maxpd|maxps|maxsd|maxss|mfence|minpd|minps|minsd|minss|monitor|mov|movapd|movaps|movbe|movd|movq|movddup|movdqa|movdqu|movq2q|movhlps|movhpd|movhps|movlhps|movlpd|movlps|movmskpd|movmskps|movntdqa|movntdq|movnti|movntpd|movntps|movntq|movq|movq2dq|movs|movsb|movsw|movsd|movsq|movsd|movshdup|movsldup|movss|movsx|movsxd|movupd|movups|movzx|mpsadbw|mul|mulpd|mulps|mulsd|mulss|mwait|neg|not|or|orpd|orps|out|outs|outsb|outsw|outsd|pabsb|pabsw|pabsd|packsswb|packssdw|packusdw|packuswbpaddb|paddw|paddd|paddq|paddsb|paddsw|paddusb|paddusw|palignr|pand|pandn|pause|pavgb|pavgw|pblendvb|pblendw|pclmulqdq|pcmpeqb|pcmpeqw|pcmpeqd|pcmpeqq|pcmpestri|pcmpestrm|pcmptb|pcmptgw|pcmpgtd|pcmpgtq|pcmpistri|pcmpisrm|pextrb|pextrd|pextrq|pextrw|phaddw|phaddd|phaddsw|phinposuw|phsubw|phsubd|phsubsw|pinsrb|pinsrd|pinsrq|pinsrw|pmaddubsw|pmadddwd|pmaxsb|pmaxsd|pmaxsw|pmaxsw|pmaxub|pmaxud|pmaxuw|pminsb|pminsd|pminsw|pminub|pminud|pminuw|pmovmskb|pmovsx|pmovzx|pmuldq|pmulhrsw|pmulhuw|pmulhw|pmulld|pmullw|pmuludw|pop|popa|popad|popcnt|popf|popfd|popfq|por|prefetch|psadbw|pshufb|pshufd|pshufhw|pshuflw|pshufw|psignb|psignw|psignd|pslldq|psllw|pslld|psllq|psraw|psrad|psrldq|psrlw|psrld|psrlq|psubb|psubw|psubd|psubq|psubsb|psubsw|psubusb|psubusw|test|ptest|punpckhbw|punpckhwd|punpckhdq|punpckhddq|punpcklbw|punpcklwd|punpckldq|punpckldqd|push|pusha|pushad|pushf|pushfd|pxor|prcl|rcr|rol|ror|rcpps|rcpss|rdfsbase|rdgsbase|rdmsr|rdpmc|rdrand|rdtsc|rdtscp|rep|repe|repz|repne|repnz|roundpd|roundps|roundsd|roundss|rsm|rsqrps|rsqrtss|sahf|sal|sar|shl|shr|sbb|scas|scasb|scasw|scasd|set(?:n?e|ge?|ae?|le?|be?|n?o|n?z)|sfence|sgdt|shld|shrd|shufpd|shufps|sidt|sldt|smsw|sqrtpd|sqrtps|sqrtsd|sqrtss|stc|std|stmxcsr|stos|stosb|stosw|stosd|stosq|str|sub|subpd|subps|subsd|subss|swapgs|syscall|sysenter|sysexit|sysret|teset|ucomisd|ucomiss|ud2|unpckhpd|unpckhps|unpcklpd|unpcklps|vbroadcast|vcvtph2ps|vcvtp2sph|verr|verw|vextractf128|vinsertf128|vmaskmov|vpermilpd|vpermilps|vperm2f128|vtestpd|vtestps|vzeroall|vzeroupper|wait|fwait|wbinvd|wrfsbase|wrgsbase|wrmsr|xadd|xchg|xgetbv|xlat|xlatb|xor|xorpd|xorps|xrstor|xsave|xsaveopt|xsetbv|lzcnt|extrq|insertq|movntsd|movntss|vfmaddpd|vfmaddps|vfmaddsd|vfmaddss|vfmaddsubbpd|vfmaddsubps|vfmsubaddpd|vfmsubaddps|vfmsubpd|vfmsubps|vfmsubsd|vfnmaddpd|vfnmaddps|vfnmaddsd|vfnmaddss|vfnmsubpd|vfnmusbps|vfnmusbsd|vfnmusbss|cvt|xor|cli|sti|hlt|nop|lock|wait|enter|leave|ret|loop(?:n?e|n?z)?|call|j(?:mp|n?e|ge?|ae?|le?|be?|n?o|n?z))\\b', caseInsensitive: true }, { token: 'variable.parameter.register.assembly', regex: '\\b(?:CS|DS|ES|FS|GS|SS|RAX|EAX|RBX|EBX|RCX|ECX|RDX|EDX|RCX|RIP|EIP|IP|RSP|ESP|SP|RSI|ESI|SI|RDI|EDI|DI|RFLAGS|EFLAGS|FLAGS|R8-15|(?:Y|X)MM(?:[0-9]|10|11|12|13|14|15)|(?:A|B|C|D)(?:X|H|L)|CR(?:[0-4]|DR(?:[0-7]|TR6|TR7|EFER)))\\b', caseInsensitive: true }, { token: 'constant.character.decimal.assembly', regex: '\\b[0-9]+\\b' }, { token: 'constant.character.hexadecimal.assembly', regex: '\\b0x[A-F0-9]+\\b', caseInsensitive: true }, { token: 'constant.character.hexadecimal.assembly', regex: '\\b[A-F0-9]+h\\b', caseInsensitive: true }, { token: 'string.assembly', regex: /'([^\\']|\\.)*'/ }, { token: 'string.assembly', regex: /"([^\\"]|\\.)*"/ }, { token: 'support.function.directive.assembly', regex: '^\\[', push: [ { token: 'support.function.directive.assembly', regex: '\\]$', next: 'pop' }, { defaultToken: 'support.function.directive.assembly' } ] }, { token: [ 'support.function.directive.assembly', 'support.function.directive.assembly', 'entity.name.function.assembly' ], regex: '(^struc)( )([_a-zA-Z][_a-zA-Z0-9]*)' }, { token: 'support.function.directive.assembly', regex: '^endstruc\\b' }, { token: [ 'support.function.directive.assembly', 'entity.name.function.assembly', 'support.function.directive.assembly', 'constant.character.assembly' ], regex: '^(%macro )([_a-zA-Z][_a-zA-Z0-9]*)( )([0-9]+)' }, { token: 'support.function.directive.assembly', regex: '^%endmacro' }, { token: [ 'text', 'support.function.directive.assembly', 'text', 'entity.name.function.assembly' ], regex: '(\\s*)(%define|%xdefine|%idefine|%undef|%assign|%defstr|%strcat|%strlen|%substr|%00|%0|%rotate|%rep|%endrep|%include|\\$\\$|\\$|%unmacro|%if|%elif|%else|%endif|%(?:el)?ifdef|%(?:el)?ifmacro|%(?:el)?ifctx|%(?:el)?ifidn|%(?:el)?ifidni|%(?:el)?ifid|%(?:el)?ifnum|%(?:el)?ifstr|%(?:el)?iftoken|%(?:el)?ifempty|%(?:el)?ifenv|%pathsearch|%depend|%use|%push|%pop|%repl|%arg|%stacksize|%local|%error|%warning|%fatal|%line|%!|%comment|%endcomment|__NASM_VERSION_ID__|__NASM_VER__|__FILE__|__LINE__|__BITS__|__OUTPUT_FORMAT__|__DATE__|__TIME__|__DATE_NUM__|_TIME__NUM__|__UTC_DATE__|__UTC_TIME__|__UTC_DATE_NUM__|__UTC_TIME_NUM__|__POSIX_TIME__|__PASS__|ISTRUC|AT|IEND|BITS 16|BITS 32|BITS 64|USE16|USE32|__SECT__|ABSOLUTE|EXTERN|GLOBAL|COMMON|CPU|FLOAT)\\b( ?)((?:[_a-zA-Z][_a-zA-Z0-9]*)?)', caseInsensitive: true }, { token: 'support.function.directive.assembly', regex: '\\b(?:d[bwdqtoy]|res[bwdqto]|equ|times|align|alignb|sectalign|section|ptr|byte|word|dword|qword|incbin)\\b', caseInsensitive: true }, { token: 'entity.name.function.assembly', regex: '^\\s*%%[\\w.]+?:$' }, { token: 'entity.name.function.assembly', regex: '^\\s*%\\$[\\w.]+?:$' }, { token: 'entity.name.function.assembly', regex: '^[\\w.]+?:' }, { token: 'entity.name.function.assembly', regex: '^[\\w.]+?\\b' }, { token: 'comment.assembly', regex: ';.*$' } ] }; this.normalizeRules(); }; AssemblyX86HighlightRules.metaData = { fileTypes: [ 'asm' ], name: 'Assembly x86', scopeName: 'source.assembly' }; oop.inherits(AssemblyX86HighlightRules, TextHighlightRules); exports.AssemblyX86HighlightRules = AssemblyX86HighlightRules; }); ================================================ FILE: lib/ace/mode/autohotkey.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var AutoHotKeyHighlightRules = require("./autohotkey_highlight_rules").AutoHotKeyHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = AutoHotKeyHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; this.$id = "ace/mode/autohotkey"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/autohotkey_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* This file was autogenerated from C:\Users\LED\Desktop\AutoHotKey.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var AutoHotKeyHighlightRules = function() { var autoItKeywords = 'And|ByRef|Case|Const|ContinueCase|ContinueLoop|Default|Dim|Do|Else|ElseIf|EndFunc|EndIf|EndSelect|EndSwitch|EndWith|Enum|Exit|ExitLoop|False|For|Func|Global|If|In|Local|Next|Not|Or|ReDim|Return|Select|Step|Switch|Then|To|True|Until|WEnd|While|With|' + 'Abs|ACos|AdlibDisable|AdlibEnable|Asc|AscW|ASin|Assign|ATan|AutoItSetOption|AutoItWinGetTitle|AutoItWinSetTitle|Beep|Binary|BinaryLen|BinaryMid|BinaryToString|BitAND|BitNOT|BitOR|BitRotate|BitShift|BitXOR|BlockInput|Break|Call|CDTray|Ceiling|Chr|ChrW|ClipGet|ClipPut|ConsoleRead|ConsoleWrite|ConsoleWriteError|ControlClick|ControlCommand|ControlDisable|ControlEnable|ControlFocus|ControlGetFocus|ControlGetHandle|ControlGetPos|ControlGetText|ControlHide|ControlListView|ControlMove|ControlSend|ControlSetText|ControlShow|ControlTreeView|Cos|Dec|DirCopy|DirCreate|DirGetSize|DirMove|DirRemove|DllCall|DllCallbackFree|DllCallbackGetPtr|DllCallbackRegister|DllClose|DllOpen|DllStructCreate|DllStructGetData|DllStructGetPtr|DllStructGetSize|DllStructSetData|DriveGetDrive|DriveGetFileSystem|DriveGetLabel|DriveGetSerial|DriveGetType|DriveMapAdd|DriveMapDel|DriveMapGet|DriveSetLabel|DriveSpaceFree|DriveSpaceTotal|DriveStatus|EnvGet|EnvSet|EnvUpdate|Eval|Execute|Exp|FileChangeDir|FileClose|FileCopy|FileCreateNTFSLink|FileCreateShortcut|FileDelete|FileExists|FileFindFirstFile|FileFindNextFile|FileGetAttrib|FileGetLongName|FileGetShortcut|FileGetShortName|FileGetSize|FileGetTime|FileGetVersion|FileInstall|FileMove|FileOpen|FileOpenDialog|FileRead|FileReadLine|FileRecycle|FileRecycleEmpty|FileSaveDialog|FileSelectFolder|FileSetAttrib|FileSetTime|FileWrite|FileWriteLine|Floor|FtpSetProxy|GUICreate|GUICtrlCreateAvi|GUICtrlCreateButton|GUICtrlCreateCheckbox|GUICtrlCreateCombo|GUICtrlCreateContextMenu|GUICtrlCreateDate|GUICtrlCreateDummy|GUICtrlCreateEdit|GUICtrlCreateGraphic|GUICtrlCreateGroup|GUICtrlCreateIcon|GUICtrlCreateInput|GUICtrlCreateLabel|GUICtrlCreateList|GUICtrlCreateListView|GUICtrlCreateListViewItem|GUICtrlCreateMenu|GUICtrlCreateMenuItem|GUICtrlCreateMonthCal|GUICtrlCreateObj|GUICtrlCreatePic|GUICtrlCreateProgress|GUICtrlCreateRadio|GUICtrlCreateSlider|GUICtrlCreateTab|GUICtrlCreateTabItem|GUICtrlCreateTreeView|GUICtrlCreateTreeViewItem|GUICtrlCreateUpdown|GUICtrlDelete|GUICtrlGetHandle|GUICtrlGetState|GUICtrlRead|GUICtrlRecvMsg|GUICtrlRegisterListViewSort|GUICtrlSendMsg|GUICtrlSendToDummy|GUICtrlSetBkColor|GUICtrlSetColor|GUICtrlSetCursor|GUICtrlSetData|GUICtrlSetFont|GUICtrlSetDefColor|GUICtrlSetDefBkColor|GUICtrlSetGraphic|GUICtrlSetImage|GUICtrlSetLimit|GUICtrlSetOnEvent|GUICtrlSetPos|GUICtrlSetResizing|GUICtrlSetState|GUICtrlSetStyle|GUICtrlSetTip|GUIDelete|GUIGetCursorInfo|GUIGetMsg|GUIGetStyle|GUIRegisterMsg|GUISetAccelerators()|GUISetBkColor|GUISetCoord|GUISetCursor|GUISetFont|GUISetHelp|GUISetIcon|GUISetOnEvent|GUISetState|GUISetStyle|GUIStartGroup|GUISwitch|Hex|HotKeySet|HttpSetProxy|HWnd|InetGet|InetGetSize|IniDelete|IniRead|IniReadSection|IniReadSectionNames|IniRenameSection|IniWrite|IniWriteSection|InputBox|Int|IsAdmin|IsArray|IsBinary|IsBool|IsDeclared|IsDllStruct|IsFloat|IsHWnd|IsInt|IsKeyword|IsNumber|IsObj|IsPtr|IsString|Log|MemGetStats|Mod|MouseClick|MouseClickDrag|MouseDown|MouseGetCursor|MouseGetPos|MouseMove|MouseUp|MouseWheel|MsgBox|Number|ObjCreate|ObjEvent|ObjGet|ObjName|Opt|Ping|PixelChecksum|PixelGetColor|PixelSearch|PluginClose|PluginOpen|ProcessClose|ProcessExists|ProcessGetStats|ProcessList|ProcessSetPriority|ProcessWait|ProcessWaitClose|ProgressOff|ProgressOn|ProgressSet|Ptr|Random|RegDelete|RegEnumKey|RegEnumVal|RegRead|RegWrite|Round|Run|RunAs|RunAsWait|RunWait|Send|SendKeepActive|SetError|SetExtended|ShellExecute|ShellExecuteWait|Shutdown|Sin|Sleep|SoundPlay|SoundSetWaveVolume|SplashImageOn|SplashOff|SplashTextOn|Sqrt|SRandom|StatusbarGetText|StderrRead|StdinWrite|StdioClose|StdoutRead|String|StringAddCR|StringCompare|StringFormat|StringInStr|StringIsAlNum|StringIsAlpha|StringIsASCII|StringIsDigit|StringIsFloat|StringIsInt|StringIsLower|StringIsSpace|StringIsUpper|StringIsXDigit|StringLeft|StringLen|StringLower|StringMid|StringRegExp|StringRegExpReplace|StringReplace|StringRight|StringSplit|StringStripCR|StringStripWS|StringToBinary|StringTrimLeft|StringTrimRight|StringUpper|Tan|TCPAccept|TCPCloseSocket|TCPConnect|TCPListen|TCPNameToIP|TCPRecv|TCPSend|TCPShutdown|TCPStartup|TimerDiff|TimerInit|ToolTip|TrayCreateItem|TrayCreateMenu|TrayGetMsg|TrayItemDelete|TrayItemGetHandle|TrayItemGetState|TrayItemGetText|TrayItemSetOnEvent|TrayItemSetState|TrayItemSetText|TraySetClick|TraySetIcon|TraySetOnEvent|TraySetPauseIcon|TraySetState|TraySetToolTip|TrayTip|UBound|UDPBind|UDPCloseSocket|UDPOpen|UDPRecv|UDPSend|UDPShutdown|UDPStartup|VarGetType|WinActivate|WinActive|WinClose|WinExists|WinFlash|WinGetCaretPos|WinGetClassList|WinGetClientSize|WinGetHandle|WinGetPos|WinGetProcess|WinGetState|WinGetText|WinGetTitle|WinKill|WinList|WinMenuSelectItem|WinMinimizeAll|WinMinimizeAllUndo|WinMove|WinSetOnTop|WinSetState|WinSetTitle|WinSetTrans|WinWait|WinWaitActive|WinWaitClose|WinWaitNotActive|' + 'ArrayAdd|ArrayBinarySearch|ArrayConcatenate|ArrayDelete|ArrayDisplay|ArrayFindAll|ArrayInsert|ArrayMax|ArrayMaxIndex|ArrayMin|ArrayMinIndex|ArrayPop|ArrayPush|ArrayReverse|ArraySearch|ArraySort|ArraySwap|ArrayToClip|ArrayToString|ArrayTrim|ChooseColor|ChooseFont|ClipBoard_ChangeChain|ClipBoard_Close|ClipBoard_CountFormats|ClipBoard_Empty|ClipBoard_EnumFormats|ClipBoard_FormatStr|ClipBoard_GetData|ClipBoard_GetDataEx|ClipBoard_GetFormatName|ClipBoard_GetOpenWindow|ClipBoard_GetOwner|ClipBoard_GetPriorityFormat|ClipBoard_GetSequenceNumber|ClipBoard_GetViewer|ClipBoard_IsFormatAvailable|ClipBoard_Open|ClipBoard_RegisterFormat|ClipBoard_SetData|ClipBoard_SetDataEx|ClipBoard_SetViewer|ClipPutFile|ColorConvertHSLtoRGB|ColorConvertRGBtoHSL|ColorGetBlue|ColorGetGreen|ColorGetRed|Date_Time_CompareFileTime|Date_Time_DOSDateTimeToArray|Date_Time_DOSDateTimeToFileTime|Date_Time_DOSDateTimeToStr|Date_Time_DOSDateToArray|Date_Time_DOSDateToStr|Date_Time_DOSTimeToArray|Date_Time_DOSTimeToStr|Date_Time_EncodeFileTime|Date_Time_EncodeSystemTime|Date_Time_FileTimeToArray|Date_Time_FileTimeToDOSDateTime|Date_Time_FileTimeToLocalFileTime|Date_Time_FileTimeToStr|Date_Time_FileTimeToSystemTime|Date_Time_GetFileTime|Date_Time_GetLocalTime|Date_Time_GetSystemTime|Date_Time_GetSystemTimeAdjustment|Date_Time_GetSystemTimeAsFileTime|Date_Time_GetSystemTimes|Date_Time_GetTickCount|Date_Time_GetTimeZoneInformation|Date_Time_LocalFileTimeToFileTime|Date_Time_SetFileTime|Date_Time_SetLocalTime|Date_Time_SetSystemTime|Date_Time_SetSystemTimeAdjustment|Date_Time_SetTimeZoneInformation|Date_Time_SystemTimeToArray|Date_Time_SystemTimeToDateStr|Date_Time_SystemTimeToDateTimeStr|Date_Time_SystemTimeToFileTime|Date_Time_SystemTimeToTimeStr|Date_Time_SystemTimeToTzSpecificLocalTime|Date_Time_TzSpecificLocalTimeToSystemTime|DateAdd|DateDayOfWeek|DateDaysInMonth|DateDiff|DateIsLeapYear|DateIsValid|DateTimeFormat|DateTimeSplit|DateToDayOfWeek|DateToDayOfWeekISO|DateToDayValue|DateToMonth|DayValueToDate|DebugBugReportEnv|DebugOut|DebugSetup|Degree|EventLog__Backup|EventLog__Clear|EventLog__Close|EventLog__Count|EventLog__DeregisterSource|EventLog__Full|EventLog__Notify|EventLog__Oldest|EventLog__Open|EventLog__OpenBackup|EventLog__Read|EventLog__RegisterSource|EventLog__Report|FileCountLines|FileCreate|FileListToArray|FilePrint|FileReadToArray|FileWriteFromArray|FileWriteLog|FileWriteToLine|GDIPlus_ArrowCapCreate|GDIPlus_ArrowCapDispose|GDIPlus_ArrowCapGetFillState|GDIPlus_ArrowCapGetHeight|GDIPlus_ArrowCapGetMiddleInset|GDIPlus_ArrowCapGetWidth|GDIPlus_ArrowCapSetFillState|GDIPlus_ArrowCapSetHeight|GDIPlus_ArrowCapSetMiddleInset|GDIPlus_ArrowCapSetWidth|GDIPlus_BitmapCloneArea|GDIPlus_BitmapCreateFromFile|GDIPlus_BitmapCreateFromGraphics|GDIPlus_BitmapCreateFromHBITMAP|GDIPlus_BitmapCreateHBITMAPFromBitmap|GDIPlus_BitmapDispose|GDIPlus_BitmapLockBits|GDIPlus_BitmapUnlockBits|GDIPlus_BrushClone|GDIPlus_BrushCreateSolid|GDIPlus_BrushDispose|GDIPlus_BrushGetType|GDIPlus_CustomLineCapDispose|GDIPlus_Decoders|GDIPlus_DecodersGetCount|GDIPlus_DecodersGetSize|GDIPlus_Encoders|GDIPlus_EncodersGetCLSID|GDIPlus_EncodersGetCount|GDIPlus_EncodersGetParamList|GDIPlus_EncodersGetParamListSize|GDIPlus_EncodersGetSize|GDIPlus_FontCreate|GDIPlus_FontDispose|GDIPlus_FontFamilyCreate|GDIPlus_FontFamilyDispose|GDIPlus_GraphicsClear|GDIPlus_GraphicsCreateFromHDC|GDIPlus_GraphicsCreateFromHWND|GDIPlus_GraphicsDispose|GDIPlus_GraphicsDrawArc|GDIPlus_GraphicsDrawBezier|GDIPlus_GraphicsDrawClosedCurve|GDIPlus_GraphicsDrawCurve|GDIPlus_GraphicsDrawEllipse|GDIPlus_GraphicsDrawImage|GDIPlus_GraphicsDrawImageRect|GDIPlus_GraphicsDrawImageRectRect|GDIPlus_GraphicsDrawLine|GDIPlus_GraphicsDrawPie|GDIPlus_GraphicsDrawPolygon|GDIPlus_GraphicsDrawRect|GDIPlus_GraphicsDrawString|GDIPlus_GraphicsDrawStringEx|GDIPlus_GraphicsFillClosedCurve|GDIPlus_GraphicsFillEllipse|GDIPlus_GraphicsFillPie|GDIPlus_GraphicsFillRect|GDIPlus_GraphicsGetDC|GDIPlus_GraphicsGetSmoothingMode|GDIPlus_GraphicsMeasureString|GDIPlus_GraphicsReleaseDC|GDIPlus_GraphicsSetSmoothingMode|GDIPlus_GraphicsSetTransform|GDIPlus_ImageDispose|GDIPlus_ImageGetGraphicsContext|GDIPlus_ImageGetHeight|GDIPlus_ImageGetWidth|GDIPlus_ImageLoadFromFile|GDIPlus_ImageSaveToFile|GDIPlus_ImageSaveToFileEx|GDIPlus_MatrixCreate|GDIPlus_MatrixDispose|GDIPlus_MatrixRotate|GDIPlus_ParamAdd|GDIPlus_ParamInit|GDIPlus_PenCreate|GDIPlus_PenDispose|GDIPlus_PenGetAlignment|GDIPlus_PenGetColor|GDIPlus_PenGetCustomEndCap|GDIPlus_PenGetDashCap|GDIPlus_PenGetDashStyle|GDIPlus_PenGetEndCap|GDIPlus_PenGetWidth|GDIPlus_PenSetAlignment|GDIPlus_PenSetColor|GDIPlus_PenSetCustomEndCap|GDIPlus_PenSetDashCap|GDIPlus_PenSetDashStyle|GDIPlus_PenSetEndCap|GDIPlus_PenSetWidth|GDIPlus_RectFCreate|GDIPlus_Shutdown|GDIPlus_Startup|GDIPlus_StringFormatCreate|GDIPlus_StringFormatDispose|GetIP|GUICtrlAVI_Close|GUICtrlAVI_Create|GUICtrlAVI_Destroy|GUICtrlAVI_Open|GUICtrlAVI_OpenEx|GUICtrlAVI_Play|GUICtrlAVI_Seek|GUICtrlAVI_Show|GUICtrlAVI_Stop|GUICtrlButton_Click|GUICtrlButton_Create|GUICtrlButton_Destroy|GUICtrlButton_Enable|GUICtrlButton_GetCheck|GUICtrlButton_GetFocus|GUICtrlButton_GetIdealSize|GUICtrlButton_GetImage|GUICtrlButton_GetImageList|GUICtrlButton_GetState|GUICtrlButton_GetText|GUICtrlButton_GetTextMargin|GUICtrlButton_SetCheck|GUICtrlButton_SetFocus|GUICtrlButton_SetImage|GUICtrlButton_SetImageList|GUICtrlButton_SetSize|GUICtrlButton_SetState|GUICtrlButton_SetStyle|GUICtrlButton_SetText|GUICtrlButton_SetTextMargin|GUICtrlButton_Show|GUICtrlComboBox_AddDir|GUICtrlComboBox_AddString|GUICtrlComboBox_AutoComplete|GUICtrlComboBox_BeginUpdate|GUICtrlComboBox_Create|GUICtrlComboBox_DeleteString|GUICtrlComboBox_Destroy|GUICtrlComboBox_EndUpdate|GUICtrlComboBox_FindString|GUICtrlComboBox_FindStringExact|GUICtrlComboBox_GetComboBoxInfo|GUICtrlComboBox_GetCount|GUICtrlComboBox_GetCurSel|GUICtrlComboBox_GetDroppedControlRect|GUICtrlComboBox_GetDroppedControlRectEx|GUICtrlComboBox_GetDroppedState|GUICtrlComboBox_GetDroppedWidth|GUICtrlComboBox_GetEditSel|GUICtrlComboBox_GetEditText|GUICtrlComboBox_GetExtendedUI|GUICtrlComboBox_GetHorizontalExtent|GUICtrlComboBox_GetItemHeight|GUICtrlComboBox_GetLBText|GUICtrlComboBox_GetLBTextLen|GUICtrlComboBox_GetList|GUICtrlComboBox_GetListArray|GUICtrlComboBox_GetLocale|GUICtrlComboBox_GetLocaleCountry|GUICtrlComboBox_GetLocaleLang|GUICtrlComboBox_GetLocalePrimLang|GUICtrlComboBox_GetLocaleSubLang|GUICtrlComboBox_GetMinVisible|GUICtrlComboBox_GetTopIndex|GUICtrlComboBox_InitStorage|GUICtrlComboBox_InsertString|GUICtrlComboBox_LimitText|GUICtrlComboBox_ReplaceEditSel|GUICtrlComboBox_ResetContent|GUICtrlComboBox_SelectString|GUICtrlComboBox_SetCurSel|GUICtrlComboBox_SetDroppedWidth|GUICtrlComboBox_SetEditSel|GUICtrlComboBox_SetEditText|GUICtrlComboBox_SetExtendedUI|GUICtrlComboBox_SetHorizontalExtent|GUICtrlComboBox_SetItemHeight|GUICtrlComboBox_SetMinVisible|GUICtrlComboBox_SetTopIndex|GUICtrlComboBox_ShowDropDown|GUICtrlComboBoxEx_AddDir|GUICtrlComboBoxEx_AddString|GUICtrlComboBoxEx_BeginUpdate|GUICtrlComboBoxEx_Create|GUICtrlComboBoxEx_CreateSolidBitMap|GUICtrlComboBoxEx_DeleteString|GUICtrlComboBoxEx_Destroy|GUICtrlComboBoxEx_EndUpdate|GUICtrlComboBoxEx_FindStringExact|GUICtrlComboBoxEx_GetComboBoxInfo|GUICtrlComboBoxEx_GetComboControl|GUICtrlComboBoxEx_GetCount|GUICtrlComboBoxEx_GetCurSel|GUICtrlComboBoxEx_GetDroppedControlRect|GUICtrlComboBoxEx_GetDroppedControlRectEx|GUICtrlComboBoxEx_GetDroppedState|GUICtrlComboBoxEx_GetDroppedWidth|GUICtrlComboBoxEx_GetEditControl|GUICtrlComboBoxEx_GetEditSel|GUICtrlComboBoxEx_GetEditText|GUICtrlComboBoxEx_GetExtendedStyle|GUICtrlComboBoxEx_GetExtendedUI|GUICtrlComboBoxEx_GetImageList|GUICtrlComboBoxEx_GetItem|GUICtrlComboBoxEx_GetItemEx|GUICtrlComboBoxEx_GetItemHeight|GUICtrlComboBoxEx_GetItemImage|GUICtrlComboBoxEx_GetItemIndent|GUICtrlComboBoxEx_GetItemOverlayImage|GUICtrlComboBoxEx_GetItemParam|GUICtrlComboBoxEx_GetItemSelectedImage|GUICtrlComboBoxEx_GetItemText|GUICtrlComboBoxEx_GetItemTextLen|GUICtrlComboBoxEx_GetList|GUICtrlComboBoxEx_GetListArray|GUICtrlComboBoxEx_GetLocale|GUICtrlComboBoxEx_GetLocaleCountry|GUICtrlComboBoxEx_GetLocaleLang|GUICtrlComboBoxEx_GetLocalePrimLang|GUICtrlComboBoxEx_GetLocaleSubLang|GUICtrlComboBoxEx_GetMinVisible|GUICtrlComboBoxEx_GetTopIndex|GUICtrlComboBoxEx_InitStorage|GUICtrlComboBoxEx_InsertString|GUICtrlComboBoxEx_LimitText|GUICtrlComboBoxEx_ReplaceEditSel|GUICtrlComboBoxEx_ResetContent|GUICtrlComboBoxEx_SetCurSel|GUICtrlComboBoxEx_SetDroppedWidth|GUICtrlComboBoxEx_SetEditSel|GUICtrlComboBoxEx_SetEditText|GUICtrlComboBoxEx_SetExtendedStyle|GUICtrlComboBoxEx_SetExtendedUI|GUICtrlComboBoxEx_SetImageList|GUICtrlComboBoxEx_SetItem|GUICtrlComboBoxEx_SetItemEx|GUICtrlComboBoxEx_SetItemHeight|GUICtrlComboBoxEx_SetItemImage|GUICtrlComboBoxEx_SetItemIndent|GUICtrlComboBoxEx_SetItemOverlayImage|GUICtrlComboBoxEx_SetItemParam|GUICtrlComboBoxEx_SetItemSelectedImage|GUICtrlComboBoxEx_SetMinVisible|GUICtrlComboBoxEx_SetTopIndex|GUICtrlComboBoxEx_ShowDropDown|GUICtrlDTP_Create|GUICtrlDTP_Destroy|GUICtrlDTP_GetMCColor|GUICtrlDTP_GetMCFont|GUICtrlDTP_GetMonthCal|GUICtrlDTP_GetRange|GUICtrlDTP_GetRangeEx|GUICtrlDTP_GetSystemTime|GUICtrlDTP_GetSystemTimeEx|GUICtrlDTP_SetFormat|GUICtrlDTP_SetMCColor|GUICtrlDTP_SetMCFont|GUICtrlDTP_SetRange|GUICtrlDTP_SetRangeEx|GUICtrlDTP_SetSystemTime|GUICtrlDTP_SetSystemTimeEx|GUICtrlEdit_AppendText|GUICtrlEdit_BeginUpdate|GUICtrlEdit_CanUndo|GUICtrlEdit_CharFromPos|GUICtrlEdit_Create|GUICtrlEdit_Destroy|GUICtrlEdit_EmptyUndoBuffer|GUICtrlEdit_EndUpdate|GUICtrlEdit_Find|GUICtrlEdit_FmtLines|GUICtrlEdit_GetFirstVisibleLine|GUICtrlEdit_GetLimitText|GUICtrlEdit_GetLine|GUICtrlEdit_GetLineCount|GUICtrlEdit_GetMargins|GUICtrlEdit_GetModify|GUICtrlEdit_GetPasswordChar|GUICtrlEdit_GetRECT|GUICtrlEdit_GetRECTEx|GUICtrlEdit_GetSel|GUICtrlEdit_GetText|GUICtrlEdit_GetTextLen|GUICtrlEdit_HideBalloonTip|GUICtrlEdit_InsertText|GUICtrlEdit_LineFromChar|GUICtrlEdit_LineIndex|GUICtrlEdit_LineLength|GUICtrlEdit_LineScroll|GUICtrlEdit_PosFromChar|GUICtrlEdit_ReplaceSel|GUICtrlEdit_Scroll|GUICtrlEdit_SetLimitText|GUICtrlEdit_SetMargins|GUICtrlEdit_SetModify|GUICtrlEdit_SetPasswordChar|GUICtrlEdit_SetReadOnly|GUICtrlEdit_SetRECT|GUICtrlEdit_SetRECTEx|GUICtrlEdit_SetRECTNP|GUICtrlEdit_SetRectNPEx|GUICtrlEdit_SetSel|GUICtrlEdit_SetTabStops|GUICtrlEdit_SetText|GUICtrlEdit_ShowBalloonTip|GUICtrlEdit_Undo|GUICtrlHeader_AddItem|GUICtrlHeader_ClearFilter|GUICtrlHeader_ClearFilterAll|GUICtrlHeader_Create|GUICtrlHeader_CreateDragImage|GUICtrlHeader_DeleteItem|GUICtrlHeader_Destroy|GUICtrlHeader_EditFilter|GUICtrlHeader_GetBitmapMargin|GUICtrlHeader_GetImageList|GUICtrlHeader_GetItem|GUICtrlHeader_GetItemAlign|GUICtrlHeader_GetItemBitmap|GUICtrlHeader_GetItemCount|GUICtrlHeader_GetItemDisplay|GUICtrlHeader_GetItemFlags|GUICtrlHeader_GetItemFormat|GUICtrlHeader_GetItemImage|GUICtrlHeader_GetItemOrder|GUICtrlHeader_GetItemParam|GUICtrlHeader_GetItemRect|GUICtrlHeader_GetItemRectEx|GUICtrlHeader_GetItemText|GUICtrlHeader_GetItemWidth|GUICtrlHeader_GetOrderArray|GUICtrlHeader_GetUnicodeFormat|GUICtrlHeader_HitTest|GUICtrlHeader_InsertItem|GUICtrlHeader_Layout|GUICtrlHeader_OrderToIndex|GUICtrlHeader_SetBitmapMargin|GUICtrlHeader_SetFilterChangeTimeout|GUICtrlHeader_SetHotDivider|GUICtrlHeader_SetImageList|GUICtrlHeader_SetItem|GUICtrlHeader_SetItemAlign|GUICtrlHeader_SetItemBitmap|GUICtrlHeader_SetItemDisplay|GUICtrlHeader_SetItemFlags|GUICtrlHeader_SetItemFormat|GUICtrlHeader_SetItemImage|GUICtrlHeader_SetItemOrder|GUICtrlHeader_SetItemParam|GUICtrlHeader_SetItemText|GUICtrlHeader_SetItemWidth|GUICtrlHeader_SetOrderArray|GUICtrlHeader_SetUnicodeFormat|GUICtrlIpAddress_ClearAddress|GUICtrlIpAddress_Create|GUICtrlIpAddress_Destroy|GUICtrlIpAddress_Get|GUICtrlIpAddress_GetArray|GUICtrlIpAddress_GetEx|GUICtrlIpAddress_IsBlank|GUICtrlIpAddress_Set|GUICtrlIpAddress_SetArray|GUICtrlIpAddress_SetEx|GUICtrlIpAddress_SetFocus|GUICtrlIpAddress_SetFont|GUICtrlIpAddress_SetRange|GUICtrlIpAddress_ShowHide|GUICtrlListBox_AddFile|GUICtrlListBox_AddString|GUICtrlListBox_BeginUpdate|GUICtrlListBox_Create|GUICtrlListBox_DeleteString|GUICtrlListBox_Destroy|GUICtrlListBox_Dir|GUICtrlListBox_EndUpdate|GUICtrlListBox_FindInText|GUICtrlListBox_FindString|GUICtrlListBox_GetAnchorIndex|GUICtrlListBox_GetCaretIndex|GUICtrlListBox_GetCount|GUICtrlListBox_GetCurSel|GUICtrlListBox_GetHorizontalExtent|GUICtrlListBox_GetItemData|GUICtrlListBox_GetItemHeight|GUICtrlListBox_GetItemRect|GUICtrlListBox_GetItemRectEx|GUICtrlListBox_GetListBoxInfo|GUICtrlListBox_GetLocale|GUICtrlListBox_GetLocaleCountry|GUICtrlListBox_GetLocaleLang|GUICtrlListBox_GetLocalePrimLang|GUICtrlListBox_GetLocaleSubLang|GUICtrlListBox_GetSel|GUICtrlListBox_GetSelCount|GUICtrlListBox_GetSelItems|GUICtrlListBox_GetSelItemsText|GUICtrlListBox_GetText|GUICtrlListBox_GetTextLen|GUICtrlListBox_GetTopIndex|GUICtrlListBox_InitStorage|GUICtrlListBox_InsertString|GUICtrlListBox_ItemFromPoint|GUICtrlListBox_ReplaceString|GUICtrlListBox_ResetContent|GUICtrlListBox_SelectString|GUICtrlListBox_SelItemRange|GUICtrlListBox_SelItemRangeEx|GUICtrlListBox_SetAnchorIndex|GUICtrlListBox_SetCaretIndex|GUICtrlListBox_SetColumnWidth|GUICtrlListBox_SetCurSel|GUICtrlListBox_SetHorizontalExtent|GUICtrlListBox_SetItemData|GUICtrlListBox_SetItemHeight|GUICtrlListBox_SetLocale|GUICtrlListBox_SetSel|GUICtrlListBox_SetTabStops|GUICtrlListBox_SetTopIndex|GUICtrlListBox_Sort|GUICtrlListBox_SwapString|GUICtrlListBox_UpdateHScroll|GUICtrlListView_AddArray|GUICtrlListView_AddColumn|GUICtrlListView_AddItem|GUICtrlListView_AddSubItem|GUICtrlListView_ApproximateViewHeight|GUICtrlListView_ApproximateViewRect|GUICtrlListView_ApproximateViewWidth|GUICtrlListView_Arrange|GUICtrlListView_BeginUpdate|GUICtrlListView_CancelEditLabel|GUICtrlListView_ClickItem|GUICtrlListView_CopyItems|GUICtrlListView_Create|GUICtrlListView_CreateDragImage|GUICtrlListView_CreateSolidBitMap|GUICtrlListView_DeleteAllItems|GUICtrlListView_DeleteColumn|GUICtrlListView_DeleteItem|GUICtrlListView_DeleteItemsSelected|GUICtrlListView_Destroy|GUICtrlListView_DrawDragImage|GUICtrlListView_EditLabel|GUICtrlListView_EnableGroupView|GUICtrlListView_EndUpdate|GUICtrlListView_EnsureVisible|GUICtrlListView_FindInText|GUICtrlListView_FindItem|GUICtrlListView_FindNearest|GUICtrlListView_FindParam|GUICtrlListView_FindText|GUICtrlListView_GetBkColor|GUICtrlListView_GetBkImage|GUICtrlListView_GetCallbackMask|GUICtrlListView_GetColumn|GUICtrlListView_GetColumnCount|GUICtrlListView_GetColumnOrder|GUICtrlListView_GetColumnOrderArray|GUICtrlListView_GetColumnWidth|GUICtrlListView_GetCounterPage|GUICtrlListView_GetEditControl|GUICtrlListView_GetExtendedListViewStyle|GUICtrlListView_GetGroupInfo|GUICtrlListView_GetGroupViewEnabled|GUICtrlListView_GetHeader|GUICtrlListView_GetHotCursor|GUICtrlListView_GetHotItem|GUICtrlListView_GetHoverTime|GUICtrlListView_GetImageList|GUICtrlListView_GetISearchString|GUICtrlListView_GetItem|GUICtrlListView_GetItemChecked|GUICtrlListView_GetItemCount|GUICtrlListView_GetItemCut|GUICtrlListView_GetItemDropHilited|GUICtrlListView_GetItemEx|GUICtrlListView_GetItemFocused|GUICtrlListView_GetItemGroupID|GUICtrlListView_GetItemImage|GUICtrlListView_GetItemIndent|GUICtrlListView_GetItemParam|GUICtrlListView_GetItemPosition|GUICtrlListView_GetItemPositionX|GUICtrlListView_GetItemPositionY|GUICtrlListView_GetItemRect|GUICtrlListView_GetItemRectEx|GUICtrlListView_GetItemSelected|GUICtrlListView_GetItemSpacing|GUICtrlListView_GetItemSpacingX|GUICtrlListView_GetItemSpacingY|GUICtrlListView_GetItemState|GUICtrlListView_GetItemStateImage|GUICtrlListView_GetItemText|GUICtrlListView_GetItemTextArray|GUICtrlListView_GetItemTextString|GUICtrlListView_GetNextItem|GUICtrlListView_GetNumberOfWorkAreas|GUICtrlListView_GetOrigin|GUICtrlListView_GetOriginX|GUICtrlListView_GetOriginY|GUICtrlListView_GetOutlineColor|GUICtrlListView_GetSelectedColumn|GUICtrlListView_GetSelectedCount|GUICtrlListView_GetSelectedIndices|GUICtrlListView_GetSelectionMark|GUICtrlListView_GetStringWidth|GUICtrlListView_GetSubItemRect|GUICtrlListView_GetTextBkColor|GUICtrlListView_GetTextColor|GUICtrlListView_GetToolTips|GUICtrlListView_GetTopIndex|GUICtrlListView_GetUnicodeFormat|GUICtrlListView_GetView|GUICtrlListView_GetViewDetails|GUICtrlListView_GetViewLarge|GUICtrlListView_GetViewList|GUICtrlListView_GetViewRect|GUICtrlListView_GetViewSmall|GUICtrlListView_GetViewTile|GUICtrlListView_HideColumn|GUICtrlListView_HitTest|GUICtrlListView_InsertColumn|GUICtrlListView_InsertGroup|GUICtrlListView_InsertItem|GUICtrlListView_JustifyColumn|GUICtrlListView_MapIDToIndex|GUICtrlListView_MapIndexToID|GUICtrlListView_RedrawItems|GUICtrlListView_RegisterSortCallBack|GUICtrlListView_RemoveAllGroups|GUICtrlListView_RemoveGroup|GUICtrlListView_Scroll|GUICtrlListView_SetBkColor|GUICtrlListView_SetBkImage|GUICtrlListView_SetCallBackMask|GUICtrlListView_SetColumn|GUICtrlListView_SetColumnOrder|GUICtrlListView_SetColumnOrderArray|GUICtrlListView_SetColumnWidth|GUICtrlListView_SetExtendedListViewStyle|GUICtrlListView_SetGroupInfo|GUICtrlListView_SetHotItem|GUICtrlListView_SetHoverTime|GUICtrlListView_SetIconSpacing|GUICtrlListView_SetImageList|GUICtrlListView_SetItem|GUICtrlListView_SetItemChecked|GUICtrlListView_SetItemCount|GUICtrlListView_SetItemCut|GUICtrlListView_SetItemDropHilited|GUICtrlListView_SetItemEx|GUICtrlListView_SetItemFocused|GUICtrlListView_SetItemGroupID|GUICtrlListView_SetItemImage|GUICtrlListView_SetItemIndent|GUICtrlListView_SetItemParam|GUICtrlListView_SetItemPosition|GUICtrlListView_SetItemPosition32|GUICtrlListView_SetItemSelected|GUICtrlListView_SetItemState|GUICtrlListView_SetItemStateImage|GUICtrlListView_SetItemText|GUICtrlListView_SetOutlineColor|GUICtrlListView_SetSelectedColumn|GUICtrlListView_SetSelectionMark|GUICtrlListView_SetTextBkColor|GUICtrlListView_SetTextColor|GUICtrlListView_SetToolTips|GUICtrlListView_SetUnicodeFormat|GUICtrlListView_SetView|GUICtrlListView_SetWorkAreas|GUICtrlListView_SimpleSort|GUICtrlListView_SortItems|GUICtrlListView_SubItemHitTest|GUICtrlListView_UnRegisterSortCallBack|GUICtrlMenu_AddMenuItem|GUICtrlMenu_AppendMenu|GUICtrlMenu_CheckMenuItem|GUICtrlMenu_CheckRadioItem|GUICtrlMenu_CreateMenu|GUICtrlMenu_CreatePopup|GUICtrlMenu_DeleteMenu|GUICtrlMenu_DestroyMenu|GUICtrlMenu_DrawMenuBar|GUICtrlMenu_EnableMenuItem|GUICtrlMenu_FindItem|GUICtrlMenu_FindParent|GUICtrlMenu_GetItemBmp|GUICtrlMenu_GetItemBmpChecked|GUICtrlMenu_GetItemBmpUnchecked|GUICtrlMenu_GetItemChecked|GUICtrlMenu_GetItemCount|GUICtrlMenu_GetItemData|GUICtrlMenu_GetItemDefault|GUICtrlMenu_GetItemDisabled|GUICtrlMenu_GetItemEnabled|GUICtrlMenu_GetItemGrayed|GUICtrlMenu_GetItemHighlighted|GUICtrlMenu_GetItemID|GUICtrlMenu_GetItemInfo|GUICtrlMenu_GetItemRect|GUICtrlMenu_GetItemRectEx|GUICtrlMenu_GetItemState|GUICtrlMenu_GetItemStateEx|GUICtrlMenu_GetItemSubMenu|GUICtrlMenu_GetItemText|GUICtrlMenu_GetItemType|GUICtrlMenu_GetMenu|GUICtrlMenu_GetMenuBackground|GUICtrlMenu_GetMenuBarInfo|GUICtrlMenu_GetMenuContextHelpID|GUICtrlMenu_GetMenuData|GUICtrlMenu_GetMenuDefaultItem|GUICtrlMenu_GetMenuHeight|GUICtrlMenu_GetMenuInfo|GUICtrlMenu_GetMenuStyle|GUICtrlMenu_GetSystemMenu|GUICtrlMenu_InsertMenuItem|GUICtrlMenu_InsertMenuItemEx|GUICtrlMenu_IsMenu|GUICtrlMenu_LoadMenu|GUICtrlMenu_MapAccelerator|GUICtrlMenu_MenuItemFromPoint|GUICtrlMenu_RemoveMenu|GUICtrlMenu_SetItemBitmaps|GUICtrlMenu_SetItemBmp|GUICtrlMenu_SetItemBmpChecked|GUICtrlMenu_SetItemBmpUnchecked|GUICtrlMenu_SetItemChecked|GUICtrlMenu_SetItemData|GUICtrlMenu_SetItemDefault|GUICtrlMenu_SetItemDisabled|GUICtrlMenu_SetItemEnabled|GUICtrlMenu_SetItemGrayed|GUICtrlMenu_SetItemHighlighted|GUICtrlMenu_SetItemID|GUICtrlMenu_SetItemInfo|GUICtrlMenu_SetItemState|GUICtrlMenu_SetItemSubMenu|GUICtrlMenu_SetItemText|GUICtrlMenu_SetItemType|GUICtrlMenu_SetMenu|GUICtrlMenu_SetMenuBackground|GUICtrlMenu_SetMenuContextHelpID|GUICtrlMenu_SetMenuData|GUICtrlMenu_SetMenuDefaultItem|GUICtrlMenu_SetMenuHeight|GUICtrlMenu_SetMenuInfo|GUICtrlMenu_SetMenuStyle|GUICtrlMenu_TrackPopupMenu|GUICtrlMonthCal_Create|GUICtrlMonthCal_Destroy|GUICtrlMonthCal_GetColor|GUICtrlMonthCal_GetColorArray|GUICtrlMonthCal_GetCurSel|GUICtrlMonthCal_GetCurSelStr|GUICtrlMonthCal_GetFirstDOW|GUICtrlMonthCal_GetFirstDOWStr|GUICtrlMonthCal_GetMaxSelCount|GUICtrlMonthCal_GetMaxTodayWidth|GUICtrlMonthCal_GetMinReqHeight|GUICtrlMonthCal_GetMinReqRect|GUICtrlMonthCal_GetMinReqRectArray|GUICtrlMonthCal_GetMinReqWidth|GUICtrlMonthCal_GetMonthDelta|GUICtrlMonthCal_GetMonthRange|GUICtrlMonthCal_GetMonthRangeMax|GUICtrlMonthCal_GetMonthRangeMaxStr|GUICtrlMonthCal_GetMonthRangeMin|GUICtrlMonthCal_GetMonthRangeMinStr|GUICtrlMonthCal_GetMonthRangeSpan|GUICtrlMonthCal_GetRange|GUICtrlMonthCal_GetRangeMax|GUICtrlMonthCal_GetRangeMaxStr|GUICtrlMonthCal_GetRangeMin|GUICtrlMonthCal_GetRangeMinStr|GUICtrlMonthCal_GetSelRange|GUICtrlMonthCal_GetSelRangeMax|GUICtrlMonthCal_GetSelRangeMaxStr|GUICtrlMonthCal_GetSelRangeMin|GUICtrlMonthCal_GetSelRangeMinStr|GUICtrlMonthCal_GetToday|GUICtrlMonthCal_GetTodayStr|GUICtrlMonthCal_GetUnicodeFormat|GUICtrlMonthCal_HitTest|GUICtrlMonthCal_SetColor|GUICtrlMonthCal_SetCurSel|GUICtrlMonthCal_SetDayState|GUICtrlMonthCal_SetFirstDOW|GUICtrlMonthCal_SetMaxSelCount|GUICtrlMonthCal_SetMonthDelta|GUICtrlMonthCal_SetRange|GUICtrlMonthCal_SetSelRange|GUICtrlMonthCal_SetToday|GUICtrlMonthCal_SetUnicodeFormat|GUICtrlRebar_AddBand|GUICtrlRebar_AddToolBarBand|GUICtrlRebar_BeginDrag|GUICtrlRebar_Create|GUICtrlRebar_DeleteBand|GUICtrlRebar_Destroy|GUICtrlRebar_DragMove|GUICtrlRebar_EndDrag|GUICtrlRebar_GetBandBackColor|GUICtrlRebar_GetBandBorders|GUICtrlRebar_GetBandBordersEx|GUICtrlRebar_GetBandChildHandle|GUICtrlRebar_GetBandChildSize|GUICtrlRebar_GetBandCount|GUICtrlRebar_GetBandForeColor|GUICtrlRebar_GetBandHeaderSize|GUICtrlRebar_GetBandID|GUICtrlRebar_GetBandIdealSize|GUICtrlRebar_GetBandLength|GUICtrlRebar_GetBandLParam|GUICtrlRebar_GetBandMargins|GUICtrlRebar_GetBandMarginsEx|GUICtrlRebar_GetBandRect|GUICtrlRebar_GetBandRectEx|GUICtrlRebar_GetBandStyle|GUICtrlRebar_GetBandStyleBreak|GUICtrlRebar_GetBandStyleChildEdge|GUICtrlRebar_GetBandStyleFixedBMP|GUICtrlRebar_GetBandStyleFixedSize|GUICtrlRebar_GetBandStyleGripperAlways|GUICtrlRebar_GetBandStyleHidden|GUICtrlRebar_GetBandStyleHideTitle|GUICtrlRebar_GetBandStyleNoGripper|GUICtrlRebar_GetBandStyleTopAlign|GUICtrlRebar_GetBandStyleUseChevron|GUICtrlRebar_GetBandStyleVariableHeight|GUICtrlRebar_GetBandText|GUICtrlRebar_GetBarHeight|GUICtrlRebar_GetBKColor|GUICtrlRebar_GetColorScheme|GUICtrlRebar_GetRowCount|GUICtrlRebar_GetRowHeight|GUICtrlRebar_GetTextColor|GUICtrlRebar_GetToolTips|GUICtrlRebar_GetUnicodeFormat|GUICtrlRebar_HitTest|GUICtrlRebar_IDToIndex|GUICtrlRebar_MaximizeBand|GUICtrlRebar_MinimizeBand|GUICtrlRebar_MoveBand|GUICtrlRebar_SetBandBackColor|GUICtrlRebar_SetBandForeColor|GUICtrlRebar_SetBandHeaderSize|GUICtrlRebar_SetBandID|GUICtrlRebar_SetBandIdealSize|GUICtrlRebar_SetBandLength|GUICtrlRebar_SetBandLParam|GUICtrlRebar_SetBandStyle|GUICtrlRebar_SetBandStyleBreak|GUICtrlRebar_SetBandStyleChildEdge|GUICtrlRebar_SetBandStyleFixedBMP|GUICtrlRebar_SetBandStyleFixedSize|GUICtrlRebar_SetBandStyleGripperAlways|GUICtrlRebar_SetBandStyleHidden|GUICtrlRebar_SetBandStyleHideTitle|GUICtrlRebar_SetBandStyleNoGripper|GUICtrlRebar_SetBandStyleTopAlign|GUICtrlRebar_SetBandStyleUseChevron|GUICtrlRebar_SetBandStyleVariableHeight|GUICtrlRebar_SetBandText|GUICtrlRebar_SetBKColor|GUICtrlRebar_SetColorScheme|GUICtrlRebar_SetTextColor|GUICtrlRebar_SetToolTips|GUICtrlRebar_SetUnicodeFormat|GUICtrlRebar_ShowBand|GUICtrlSlider_ClearSel|GUICtrlSlider_ClearTics|GUICtrlSlider_Create|GUICtrlSlider_Destroy|GUICtrlSlider_GetBuddy|GUICtrlSlider_GetChannelRect|GUICtrlSlider_GetLineSize|GUICtrlSlider_GetNumTics|GUICtrlSlider_GetPageSize|GUICtrlSlider_GetPos|GUICtrlSlider_GetPTics|GUICtrlSlider_GetRange|GUICtrlSlider_GetRangeMax|GUICtrlSlider_GetRangeMin|GUICtrlSlider_GetSel|GUICtrlSlider_GetSelEnd|GUICtrlSlider_GetSelStart|GUICtrlSlider_GetThumbLength|GUICtrlSlider_GetThumbRect|GUICtrlSlider_GetThumbRectEx|GUICtrlSlider_GetTic|GUICtrlSlider_GetTicPos|GUICtrlSlider_GetToolTips|GUICtrlSlider_GetUnicodeFormat|GUICtrlSlider_SetBuddy|GUICtrlSlider_SetLineSize|GUICtrlSlider_SetPageSize|GUICtrlSlider_SetPos|GUICtrlSlider_SetRange|GUICtrlSlider_SetRangeMax|GUICtrlSlider_SetRangeMin|GUICtrlSlider_SetSel|GUICtrlSlider_SetSelEnd|GUICtrlSlider_SetSelStart|GUICtrlSlider_SetThumbLength|GUICtrlSlider_SetTic|GUICtrlSlider_SetTicFreq|GUICtrlSlider_SetTipSide|GUICtrlSlider_SetToolTips|GUICtrlSlider_SetUnicodeFormat|GUICtrlStatusBar_Create|GUICtrlStatusBar_Destroy|GUICtrlStatusBar_EmbedControl|GUICtrlStatusBar_GetBorders|GUICtrlStatusBar_GetBordersHorz|GUICtrlStatusBar_GetBordersRect|GUICtrlStatusBar_GetBordersVert|GUICtrlStatusBar_GetCount|GUICtrlStatusBar_GetHeight|GUICtrlStatusBar_GetIcon|GUICtrlStatusBar_GetParts|GUICtrlStatusBar_GetRect|GUICtrlStatusBar_GetRectEx|GUICtrlStatusBar_GetText|GUICtrlStatusBar_GetTextFlags|GUICtrlStatusBar_GetTextLength|GUICtrlStatusBar_GetTextLengthEx|GUICtrlStatusBar_GetTipText|GUICtrlStatusBar_GetUnicodeFormat|GUICtrlStatusBar_GetWidth|GUICtrlStatusBar_IsSimple|GUICtrlStatusBar_Resize|GUICtrlStatusBar_SetBkColor|GUICtrlStatusBar_SetIcon|GUICtrlStatusBar_SetMinHeight|GUICtrlStatusBar_SetParts|GUICtrlStatusBar_SetSimple|GUICtrlStatusBar_SetText|GUICtrlStatusBar_SetTipText|GUICtrlStatusBar_SetUnicodeFormat|GUICtrlStatusBar_ShowHide|GUICtrlTab_Create|GUICtrlTab_DeleteAllItems|GUICtrlTab_DeleteItem|GUICtrlTab_DeselectAll|GUICtrlTab_Destroy|GUICtrlTab_FindTab|GUICtrlTab_GetCurFocus|GUICtrlTab_GetCurSel|GUICtrlTab_GetDisplayRect|GUICtrlTab_GetDisplayRectEx|GUICtrlTab_GetExtendedStyle|GUICtrlTab_GetImageList|GUICtrlTab_GetItem|GUICtrlTab_GetItemCount|GUICtrlTab_GetItemImage|GUICtrlTab_GetItemParam|GUICtrlTab_GetItemRect|GUICtrlTab_GetItemRectEx|GUICtrlTab_GetItemState|GUICtrlTab_GetItemText|GUICtrlTab_GetRowCount|GUICtrlTab_GetToolTips|GUICtrlTab_GetUnicodeFormat|GUICtrlTab_HighlightItem|GUICtrlTab_HitTest|GUICtrlTab_InsertItem|GUICtrlTab_RemoveImage|GUICtrlTab_SetCurFocus|GUICtrlTab_SetCurSel|GUICtrlTab_SetExtendedStyle|GUICtrlTab_SetImageList|GUICtrlTab_SetItem|GUICtrlTab_SetItemImage|GUICtrlTab_SetItemParam|GUICtrlTab_SetItemSize|GUICtrlTab_SetItemState|GUICtrlTab_SetItemText|GUICtrlTab_SetMinTabWidth|GUICtrlTab_SetPadding|GUICtrlTab_SetToolTips|GUICtrlTab_SetUnicodeFormat|GUICtrlToolbar_AddBitmap|GUICtrlToolbar_AddButton|GUICtrlToolbar_AddButtonSep|GUICtrlToolbar_AddString|GUICtrlToolbar_ButtonCount|GUICtrlToolbar_CheckButton|GUICtrlToolbar_ClickAccel|GUICtrlToolbar_ClickButton|GUICtrlToolbar_ClickIndex|GUICtrlToolbar_CommandToIndex|GUICtrlToolbar_Create|GUICtrlToolbar_Customize|GUICtrlToolbar_DeleteButton|GUICtrlToolbar_Destroy|GUICtrlToolbar_EnableButton|GUICtrlToolbar_FindToolbar|GUICtrlToolbar_GetAnchorHighlight|GUICtrlToolbar_GetBitmapFlags|GUICtrlToolbar_GetButtonBitmap|GUICtrlToolbar_GetButtonInfo|GUICtrlToolbar_GetButtonInfoEx|GUICtrlToolbar_GetButtonParam|GUICtrlToolbar_GetButtonRect|GUICtrlToolbar_GetButtonRectEx|GUICtrlToolbar_GetButtonSize|GUICtrlToolbar_GetButtonState|GUICtrlToolbar_GetButtonStyle|GUICtrlToolbar_GetButtonText|GUICtrlToolbar_GetColorScheme|GUICtrlToolbar_GetDisabledImageList|GUICtrlToolbar_GetExtendedStyle|GUICtrlToolbar_GetHotImageList|GUICtrlToolbar_GetHotItem|GUICtrlToolbar_GetImageList|GUICtrlToolbar_GetInsertMark|GUICtrlToolbar_GetInsertMarkColor|GUICtrlToolbar_GetMaxSize|GUICtrlToolbar_GetMetrics|GUICtrlToolbar_GetPadding|GUICtrlToolbar_GetRows|GUICtrlToolbar_GetString|GUICtrlToolbar_GetStyle|GUICtrlToolbar_GetStyleAltDrag|GUICtrlToolbar_GetStyleCustomErase|GUICtrlToolbar_GetStyleFlat|GUICtrlToolbar_GetStyleList|GUICtrlToolbar_GetStyleRegisterDrop|GUICtrlToolbar_GetStyleToolTips|GUICtrlToolbar_GetStyleTransparent|GUICtrlToolbar_GetStyleWrapable|GUICtrlToolbar_GetTextRows|GUICtrlToolbar_GetToolTips|GUICtrlToolbar_GetUnicodeFormat|GUICtrlToolbar_HideButton|GUICtrlToolbar_HighlightButton|GUICtrlToolbar_HitTest|GUICtrlToolbar_IndexToCommand|GUICtrlToolbar_InsertButton|GUICtrlToolbar_InsertMarkHitTest|GUICtrlToolbar_IsButtonChecked|GUICtrlToolbar_IsButtonEnabled|GUICtrlToolbar_IsButtonHidden|GUICtrlToolbar_IsButtonHighlighted|GUICtrlToolbar_IsButtonIndeterminate|GUICtrlToolbar_IsButtonPressed|GUICtrlToolbar_LoadBitmap|GUICtrlToolbar_LoadImages|GUICtrlToolbar_MapAccelerator|GUICtrlToolbar_MoveButton|GUICtrlToolbar_PressButton|GUICtrlToolbar_SetAnchorHighlight|GUICtrlToolbar_SetBitmapSize|GUICtrlToolbar_SetButtonBitMap|GUICtrlToolbar_SetButtonInfo|GUICtrlToolbar_SetButtonInfoEx|GUICtrlToolbar_SetButtonParam|GUICtrlToolbar_SetButtonSize|GUICtrlToolbar_SetButtonState|GUICtrlToolbar_SetButtonStyle|GUICtrlToolbar_SetButtonText|GUICtrlToolbar_SetButtonWidth|GUICtrlToolbar_SetCmdID|GUICtrlToolbar_SetColorScheme|GUICtrlToolbar_SetDisabledImageList|GUICtrlToolbar_SetDrawTextFlags|GUICtrlToolbar_SetExtendedStyle|GUICtrlToolbar_SetHotImageList|GUICtrlToolbar_SetHotItem|GUICtrlToolbar_SetImageList|GUICtrlToolbar_SetIndent|GUICtrlToolbar_SetIndeterminate|GUICtrlToolbar_SetInsertMark|GUICtrlToolbar_SetInsertMarkColor|GUICtrlToolbar_SetMaxTextRows|GUICtrlToolbar_SetMetrics|GUICtrlToolbar_SetPadding|GUICtrlToolbar_SetParent|GUICtrlToolbar_SetRows|GUICtrlToolbar_SetStyle|GUICtrlToolbar_SetStyleAltDrag|GUICtrlToolbar_SetStyleCustomErase|GUICtrlToolbar_SetStyleFlat|GUICtrlToolbar_SetStyleList|GUICtrlToolbar_SetStyleRegisterDrop|GUICtrlToolbar_SetStyleToolTips|GUICtrlToolbar_SetStyleTransparent|GUICtrlToolbar_SetStyleWrapable|GUICtrlToolbar_SetToolTips|GUICtrlToolbar_SetUnicodeFormat|GUICtrlToolbar_SetWindowTheme|GUICtrlTreeView_Add|GUICtrlTreeView_AddChild|GUICtrlTreeView_AddChildFirst|GUICtrlTreeView_AddFirst|GUICtrlTreeView_BeginUpdate|GUICtrlTreeView_ClickItem|GUICtrlTreeView_Create|GUICtrlTreeView_CreateDragImage|GUICtrlTreeView_CreateSolidBitMap|GUICtrlTreeView_Delete|GUICtrlTreeView_DeleteAll|GUICtrlTreeView_DeleteChildren|GUICtrlTreeView_Destroy|GUICtrlTreeView_DisplayRect|GUICtrlTreeView_DisplayRectEx|GUICtrlTreeView_EditText|GUICtrlTreeView_EndEdit|GUICtrlTreeView_EndUpdate|GUICtrlTreeView_EnsureVisible|GUICtrlTreeView_Expand|GUICtrlTreeView_ExpandedOnce|GUICtrlTreeView_FindItem|GUICtrlTreeView_FindItemEx|GUICtrlTreeView_GetBkColor|GUICtrlTreeView_GetBold|GUICtrlTreeView_GetChecked|GUICtrlTreeView_GetChildCount|GUICtrlTreeView_GetChildren|GUICtrlTreeView_GetCount|GUICtrlTreeView_GetCut|GUICtrlTreeView_GetDropTarget|GUICtrlTreeView_GetEditControl|GUICtrlTreeView_GetExpanded|GUICtrlTreeView_GetFirstChild|GUICtrlTreeView_GetFirstItem|GUICtrlTreeView_GetFirstVisible|GUICtrlTreeView_GetFocused|GUICtrlTreeView_GetHeight|GUICtrlTreeView_GetImageIndex|GUICtrlTreeView_GetImageListIconHandle|GUICtrlTreeView_GetIndent|GUICtrlTreeView_GetInsertMarkColor|GUICtrlTreeView_GetISearchString|GUICtrlTreeView_GetItemByIndex|GUICtrlTreeView_GetItemHandle|GUICtrlTreeView_GetItemParam|GUICtrlTreeView_GetLastChild|GUICtrlTreeView_GetLineColor|GUICtrlTreeView_GetNext|GUICtrlTreeView_GetNextChild|GUICtrlTreeView_GetNextSibling|GUICtrlTreeView_GetNextVisible|GUICtrlTreeView_GetNormalImageList|GUICtrlTreeView_GetParentHandle|GUICtrlTreeView_GetParentParam|GUICtrlTreeView_GetPrev|GUICtrlTreeView_GetPrevChild|GUICtrlTreeView_GetPrevSibling|GUICtrlTreeView_GetPrevVisible|GUICtrlTreeView_GetScrollTime|GUICtrlTreeView_GetSelected|GUICtrlTreeView_GetSelectedImageIndex|GUICtrlTreeView_GetSelection|GUICtrlTreeView_GetSiblingCount|GUICtrlTreeView_GetState|GUICtrlTreeView_GetStateImageIndex|GUICtrlTreeView_GetStateImageList|GUICtrlTreeView_GetText|GUICtrlTreeView_GetTextColor|GUICtrlTreeView_GetToolTips|GUICtrlTreeView_GetTree|GUICtrlTreeView_GetUnicodeFormat|GUICtrlTreeView_GetVisible|GUICtrlTreeView_GetVisibleCount|GUICtrlTreeView_HitTest|GUICtrlTreeView_HitTestEx|GUICtrlTreeView_HitTestItem|GUICtrlTreeView_Index|GUICtrlTreeView_InsertItem|GUICtrlTreeView_IsFirstItem|GUICtrlTreeView_IsParent|GUICtrlTreeView_Level|GUICtrlTreeView_SelectItem|GUICtrlTreeView_SelectItemByIndex|GUICtrlTreeView_SetBkColor|GUICtrlTreeView_SetBold|GUICtrlTreeView_SetChecked|GUICtrlTreeView_SetCheckedByIndex|GUICtrlTreeView_SetChildren|GUICtrlTreeView_SetCut|GUICtrlTreeView_SetDropTarget|GUICtrlTreeView_SetFocused|GUICtrlTreeView_SetHeight|GUICtrlTreeView_SetIcon|GUICtrlTreeView_SetImageIndex|GUICtrlTreeView_SetIndent|GUICtrlTreeView_SetInsertMark|GUICtrlTreeView_SetInsertMarkColor|GUICtrlTreeView_SetItemHeight|GUICtrlTreeView_SetItemParam|GUICtrlTreeView_SetLineColor|GUICtrlTreeView_SetNormalImageList|GUICtrlTreeView_SetScrollTime|GUICtrlTreeView_SetSelected|GUICtrlTreeView_SetSelectedImageIndex|GUICtrlTreeView_SetState|GUICtrlTreeView_SetStateImageIndex|GUICtrlTreeView_SetStateImageList|GUICtrlTreeView_SetText|GUICtrlTreeView_SetTextColor|GUICtrlTreeView_SetToolTips|GUICtrlTreeView_SetUnicodeFormat|GUICtrlTreeView_Sort|GUIImageList_Add|GUIImageList_AddBitmap|GUIImageList_AddIcon|GUIImageList_AddMasked|GUIImageList_BeginDrag|GUIImageList_Copy|GUIImageList_Create|GUIImageList_Destroy|GUIImageList_DestroyIcon|GUIImageList_DragEnter|GUIImageList_DragLeave|GUIImageList_DragMove|GUIImageList_Draw|GUIImageList_DrawEx|GUIImageList_Duplicate|GUIImageList_EndDrag|GUIImageList_GetBkColor|GUIImageList_GetIcon|GUIImageList_GetIconHeight|GUIImageList_GetIconSize|GUIImageList_GetIconSizeEx|GUIImageList_GetIconWidth|GUIImageList_GetImageCount|GUIImageList_GetImageInfoEx|GUIImageList_Remove|GUIImageList_ReplaceIcon|GUIImageList_SetBkColor|GUIImageList_SetIconSize|GUIImageList_SetImageCount|GUIImageList_Swap|GUIScrollBars_EnableScrollBar|GUIScrollBars_GetScrollBarInfoEx|GUIScrollBars_GetScrollBarRect|GUIScrollBars_GetScrollBarRGState|GUIScrollBars_GetScrollBarXYLineButton|GUIScrollBars_GetScrollBarXYThumbBottom|GUIScrollBars_GetScrollBarXYThumbTop|GUIScrollBars_GetScrollInfo|GUIScrollBars_GetScrollInfoEx|GUIScrollBars_GetScrollInfoMax|GUIScrollBars_GetScrollInfoMin|GUIScrollBars_GetScrollInfoPage|GUIScrollBars_GetScrollInfoPos|GUIScrollBars_GetScrollInfoTrackPos|GUIScrollBars_GetScrollPos|GUIScrollBars_GetScrollRange|GUIScrollBars_Init|GUIScrollBars_ScrollWindow|GUIScrollBars_SetScrollInfo|GUIScrollBars_SetScrollInfoMax|GUIScrollBars_SetScrollInfoMin|GUIScrollBars_SetScrollInfoPage|GUIScrollBars_SetScrollInfoPos|GUIScrollBars_SetScrollRange|GUIScrollBars_ShowScrollBar|GUIToolTip_Activate|GUIToolTip_AddTool|GUIToolTip_AdjustRect|GUIToolTip_BitsToTTF|GUIToolTip_Create|GUIToolTip_DelTool|GUIToolTip_Destroy|GUIToolTip_EnumTools|GUIToolTip_GetBubbleHeight|GUIToolTip_GetBubbleSize|GUIToolTip_GetBubbleWidth|GUIToolTip_GetCurrentTool|GUIToolTip_GetDelayTime|GUIToolTip_GetMargin|GUIToolTip_GetMarginEx|GUIToolTip_GetMaxTipWidth|GUIToolTip_GetText|GUIToolTip_GetTipBkColor|GUIToolTip_GetTipTextColor|GUIToolTip_GetTitleBitMap|GUIToolTip_GetTitleText|GUIToolTip_GetToolCount|GUIToolTip_GetToolInfo|GUIToolTip_HitTest|GUIToolTip_NewToolRect|GUIToolTip_Pop|GUIToolTip_PopUp|GUIToolTip_SetDelayTime|GUIToolTip_SetMargin|GUIToolTip_SetMaxTipWidth|GUIToolTip_SetTipBkColor|GUIToolTip_SetTipTextColor|GUIToolTip_SetTitle|GUIToolTip_SetToolInfo|GUIToolTip_SetWindowTheme|GUIToolTip_ToolExists|GUIToolTip_ToolToArray|GUIToolTip_TrackActivate|GUIToolTip_TrackPosition|GUIToolTip_TTFToBits|GUIToolTip_Update|GUIToolTip_UpdateTipText|HexToString|IE_Example|IE_Introduction|IE_VersionInfo|IEAction|IEAttach|IEBodyReadHTML|IEBodyReadText|IEBodyWriteHTML|IECreate|IECreateEmbedded|IEDocGetObj|IEDocInsertHTML|IEDocInsertText|IEDocReadHTML|IEDocWriteHTML|IEErrorHandlerDeRegister|IEErrorHandlerRegister|IEErrorNotify|IEFormElementCheckBoxSelect|IEFormElementGetCollection|IEFormElementGetObjByName|IEFormElementGetValue|IEFormElementOptionSelect|IEFormElementRadioSelect|IEFormElementSetValue|IEFormGetCollection|IEFormGetObjByName|IEFormImageClick|IEFormReset|IEFormSubmit|IEFrameGetCollection|IEFrameGetObjByName|IEGetObjById|IEGetObjByName|IEHeadInsertEventScript|IEImgClick|IEImgGetCollection|IEIsFrameSet|IELinkClickByIndex|IELinkClickByText|IELinkGetCollection|IELoadWait|IELoadWaitTimeout|IENavigate|IEPropertyGet|IEPropertySet|IEQuit|IETableGetCollection|IETableWriteToArray|IETagNameAllGetCollection|IETagNameGetCollection|Iif|INetExplorerCapable|INetGetSource|INetMail|INetSmtpMail|IsPressed|MathCheckDiv|Max|MemGlobalAlloc|MemGlobalFree|MemGlobalLock|MemGlobalSize|MemGlobalUnlock|MemMoveMemory|MemMsgBox|MemShowError|MemVirtualAlloc|MemVirtualAllocEx|MemVirtualFree|MemVirtualFreeEx|Min|MouseTrap|NamedPipes_CallNamedPipe|NamedPipes_ConnectNamedPipe|NamedPipes_CreateNamedPipe|NamedPipes_CreatePipe|NamedPipes_DisconnectNamedPipe|NamedPipes_GetNamedPipeHandleState|NamedPipes_GetNamedPipeInfo|NamedPipes_PeekNamedPipe|NamedPipes_SetNamedPipeHandleState|NamedPipes_TransactNamedPipe|NamedPipes_WaitNamedPipe|Net_Share_ConnectionEnum|Net_Share_FileClose|Net_Share_FileEnum|Net_Share_FileGetInfo|Net_Share_PermStr|Net_Share_ResourceStr|Net_Share_SessionDel|Net_Share_SessionEnum|Net_Share_SessionGetInfo|Net_Share_ShareAdd|Net_Share_ShareCheck|Net_Share_ShareDel|Net_Share_ShareEnum|Net_Share_ShareGetInfo|Net_Share_ShareSetInfo|Net_Share_StatisticsGetSvr|Net_Share_StatisticsGetWrk|Now|NowCalc|NowCalcDate|NowDate|NowTime|PathFull|PathMake|PathSplit|ProcessGetName|ProcessGetPriority|Radian|ReplaceStringInFile|RunDOS|ScreenCapture_Capture|ScreenCapture_CaptureWnd|ScreenCapture_SaveImage|ScreenCapture_SetBMPFormat|ScreenCapture_SetJPGQuality|ScreenCapture_SetTIFColorDepth|ScreenCapture_SetTIFCompression|Security__AdjustTokenPrivileges|Security__GetAccountSid|Security__GetLengthSid|Security__GetTokenInformation|Security__ImpersonateSelf|Security__IsValidSid|Security__LookupAccountName|Security__LookupAccountSid|Security__LookupPrivilegeValue|Security__OpenProcessToken|Security__OpenThreadToken|Security__OpenThreadTokenEx|Security__SetPrivilege|Security__SidToStringSid|Security__SidTypeStr|Security__StringSidToSid|SendMessage|SendMessageA|SetDate|SetTime|Singleton|SoundClose|SoundLength|SoundOpen|SoundPause|SoundPlay|SoundPos|SoundResume|SoundSeek|SoundStatus|SoundStop|SQLite_Changes|SQLite_Close|SQLite_Display2DResult|SQLite_Encode|SQLite_ErrCode|SQLite_ErrMsg|SQLite_Escape|SQLite_Exec|SQLite_FetchData|SQLite_FetchNames|SQLite_GetTable|SQLite_GetTable2d|SQLite_LastInsertRowID|SQLite_LibVersion|SQLite_Open|SQLite_Query|SQLite_QueryFinalize|SQLite_QueryReset|SQLite_QuerySingleRow|SQLite_SaveMode|SQLite_SetTimeout|SQLite_Shutdown|SQLite_SQLiteExe|SQLite_Startup|SQLite_TotalChanges|StringAddComma|StringBetween|StringEncrypt|StringInsert|StringProper|StringRepeat|StringReverse|StringSplit|StringToHex|TCPIpToName|TempFile|TicksToTime|Timer_Diff|Timer_GetTimerID|Timer_Init|Timer_KillAllTimers|Timer_KillTimer|Timer_SetTimer|TimeToTicks|VersionCompare|viClose|viExecCommand|viFindGpib|viGpibBusReset|viGTL|viOpen|viSetAttribute|viSetTimeout|WeekNumberISO|WinAPI_AttachConsole|WinAPI_AttachThreadInput|WinAPI_Beep|WinAPI_BitBlt|WinAPI_CallNextHookEx|WinAPI_Check|WinAPI_ClientToScreen|WinAPI_CloseHandle|WinAPI_CommDlgExtendedError|WinAPI_CopyIcon|WinAPI_CreateBitmap|WinAPI_CreateCompatibleBitmap|WinAPI_CreateCompatibleDC|WinAPI_CreateEvent|WinAPI_CreateFile|WinAPI_CreateFont|WinAPI_CreateFontIndirect|WinAPI_CreateProcess|WinAPI_CreateSolidBitmap|WinAPI_CreateSolidBrush|WinAPI_CreateWindowEx|WinAPI_DefWindowProc|WinAPI_DeleteDC|WinAPI_DeleteObject|WinAPI_DestroyIcon|WinAPI_DestroyWindow|WinAPI_DrawEdge|WinAPI_DrawFrameControl|WinAPI_DrawIcon|WinAPI_DrawIconEx|WinAPI_DrawText|WinAPI_EnableWindow|WinAPI_EnumDisplayDevices|WinAPI_EnumWindows|WinAPI_EnumWindowsPopup|WinAPI_EnumWindowsTop|WinAPI_ExpandEnvironmentStrings|WinAPI_ExtractIconEx|WinAPI_FatalAppExit|WinAPI_FillRect|WinAPI_FindExecutable|WinAPI_FindWindow|WinAPI_FlashWindow|WinAPI_FlashWindowEx|WinAPI_FloatToInt|WinAPI_FlushFileBuffers|WinAPI_FormatMessage|WinAPI_FrameRect|WinAPI_FreeLibrary|WinAPI_GetAncestor|WinAPI_GetAsyncKeyState|WinAPI_GetClassName|WinAPI_GetClientHeight|WinAPI_GetClientRect|WinAPI_GetClientWidth|WinAPI_GetCurrentProcess|WinAPI_GetCurrentProcessID|WinAPI_GetCurrentThread|WinAPI_GetCurrentThreadId|WinAPI_GetCursorInfo|WinAPI_GetDC|WinAPI_GetDesktopWindow|WinAPI_GetDeviceCaps|WinAPI_GetDIBits|WinAPI_GetDlgCtrlID|WinAPI_GetDlgItem|WinAPI_GetFileSizeEx|WinAPI_GetFocus|WinAPI_GetForegroundWindow|WinAPI_GetIconInfo|WinAPI_GetLastError|WinAPI_GetLastErrorMessage|WinAPI_GetModuleHandle|WinAPI_GetMousePos|WinAPI_GetMousePosX|WinAPI_GetMousePosY|WinAPI_GetObject|WinAPI_GetOpenFileName|WinAPI_GetOverlappedResult|WinAPI_GetParent|WinAPI_GetProcessAffinityMask|WinAPI_GetSaveFileName|WinAPI_GetStdHandle|WinAPI_GetStockObject|WinAPI_GetSysColor|WinAPI_GetSysColorBrush|WinAPI_GetSystemMetrics|WinAPI_GetTextExtentPoint32|WinAPI_GetWindow|WinAPI_GetWindowDC|WinAPI_GetWindowHeight|WinAPI_GetWindowLong|WinAPI_GetWindowRect|WinAPI_GetWindowText|WinAPI_GetWindowThreadProcessId|WinAPI_GetWindowWidth|WinAPI_GetXYFromPoint|WinAPI_GlobalMemStatus|WinAPI_GUIDFromString|WinAPI_GUIDFromStringEx|WinAPI_HiWord|WinAPI_InProcess|WinAPI_IntToFloat|WinAPI_InvalidateRect|WinAPI_IsClassName|WinAPI_IsWindow|WinAPI_IsWindowVisible|WinAPI_LoadBitmap|WinAPI_LoadImage|WinAPI_LoadLibrary|WinAPI_LoadLibraryEx|WinAPI_LoadShell32Icon|WinAPI_LoadString|WinAPI_LocalFree|WinAPI_LoWord|WinAPI_MakeDWord|WinAPI_MAKELANGID|WinAPI_MAKELCID|WinAPI_MakeLong|WinAPI_MessageBeep|WinAPI_Mouse_Event|WinAPI_MoveWindow|WinAPI_MsgBox|WinAPI_MulDiv|WinAPI_MultiByteToWideChar|WinAPI_MultiByteToWideCharEx|WinAPI_OpenProcess|WinAPI_PointFromRect|WinAPI_PostMessage|WinAPI_PrimaryLangId|WinAPI_PtInRect|WinAPI_ReadFile|WinAPI_ReadProcessMemory|WinAPI_RectIsEmpty|WinAPI_RedrawWindow|WinAPI_RegisterWindowMessage|WinAPI_ReleaseCapture|WinAPI_ReleaseDC|WinAPI_ScreenToClient|WinAPI_SelectObject|WinAPI_SetBkColor|WinAPI_SetCapture|WinAPI_SetCursor|WinAPI_SetDefaultPrinter|WinAPI_SetDIBits|WinAPI_SetEvent|WinAPI_SetFocus|WinAPI_SetFont|WinAPI_SetHandleInformation|WinAPI_SetLastError|WinAPI_SetParent|WinAPI_SetProcessAffinityMask|WinAPI_SetSysColors|WinAPI_SetTextColor|WinAPI_SetWindowLong|WinAPI_SetWindowPos|WinAPI_SetWindowsHookEx|WinAPI_SetWindowText|WinAPI_ShowCursor|WinAPI_ShowError|WinAPI_ShowMsg|WinAPI_ShowWindow|WinAPI_StringFromGUID|WinAPI_SubLangId|WinAPI_SystemParametersInfo|WinAPI_TwipsPerPixelX|WinAPI_TwipsPerPixelY|WinAPI_UnhookWindowsHookEx|WinAPI_UpdateLayeredWindow|WinAPI_UpdateWindow|WinAPI_ValidateClassName|WinAPI_WaitForInputIdle|WinAPI_WaitForMultipleObjects|WinAPI_WaitForSingleObject|WinAPI_WideCharToMultiByte|WinAPI_WindowFromPoint|WinAPI_WriteConsole|WinAPI_WriteFile|WinAPI_WriteProcessMemory|WinNet_AddConnection|WinNet_AddConnection2|WinNet_AddConnection3|WinNet_CancelConnection|WinNet_CancelConnection2|WinNet_CloseEnum|WinNet_ConnectionDialog|WinNet_ConnectionDialog1|WinNet_DisconnectDialog|WinNet_DisconnectDialog1|WinNet_EnumResource|WinNet_GetConnection|WinNet_GetConnectionPerformance|WinNet_GetLastError|WinNet_GetNetworkInformation|WinNet_GetProviderName|WinNet_GetResourceInformation|WinNet_GetResourceParent|WinNet_GetUniversalName|WinNet_GetUser|WinNet_OpenEnum|WinNet_RestoreConnection|WinNet_UseConnection|Word_VersionInfo|WordAttach|WordCreate|WordDocAdd|WordDocAddLink|WordDocAddPicture|WordDocClose|WordDocFindReplace|WordDocGetCollection|WordDocLinkGetCollection|WordDocOpen|WordDocPrint|WordDocPropertyGet|WordDocPropertySet|WordDocSave|WordDocSaveAs|WordErrorHandlerDeRegister|WordErrorHandlerRegister|WordErrorNotify|WordMacroRun|WordPropertyGet|WordPropertySet|WordQuit|' + 'ce|comments-end|comments-start|cs|include|include-once|NoTrayIcon|RequireAdmin|' + 'AutoIt3Wrapper_Au3Check_Parameters|AutoIt3Wrapper_Au3Check_Stop_OnWarning|AutoIt3Wrapper_Change2CUI|AutoIt3Wrapper_Compression|AutoIt3Wrapper_cvsWrapper_Parameters|AutoIt3Wrapper_Icon|AutoIt3Wrapper_Outfile|AutoIt3Wrapper_Outfile_Type|AutoIt3Wrapper_Plugin_Funcs|AutoIt3Wrapper_Res_Comment|AutoIt3Wrapper_Res_Description|AutoIt3Wrapper_Res_Field|AutoIt3Wrapper_Res_File_Add|AutoIt3Wrapper_Res_Fileversion|AutoIt3Wrapper_Res_FileVersion_AutoIncrement|AutoIt3Wrapper_Res_Icon_Add|AutoIt3Wrapper_Res_Language|AutoIt3Wrapper_Res_LegalCopyright|AutoIt3Wrapper_res_requestedExecutionLevel|AutoIt3Wrapper_Res_SaveSource|AutoIt3Wrapper_Run_After|AutoIt3Wrapper_Run_Au3check|AutoIt3Wrapper_Run_Before|AutoIt3Wrapper_Run_cvsWrapper|AutoIt3Wrapper_Run_Debug_Mode|AutoIt3Wrapper_Run_Obfuscator|AutoIt3Wrapper_Run_Tidy|AutoIt3Wrapper_Tidy_Stop_OnError|AutoIt3Wrapper_UseAnsi|AutoIt3Wrapper_UseUpx|AutoIt3Wrapper_UseX64|AutoIt3Wrapper_Version|EndRegion|forceref|Obfuscator_Ignore_Funcs|Obfuscator_Ignore_Variables|Obfuscator_Parameters|Region|Tidy_Parameters'; var atKeywords = 'AppDataCommonDir|AppDataDir|AutoItExe|AutoItPID|AutoItUnicode|AutoItVersion|AutoItX64|COM_EventObj|CommonFilesDir|Compiled|ComputerName|ComSpec|CR|CRLF|DesktopCommonDir|DesktopDepth|DesktopDir|DesktopHeight|DesktopRefresh|DesktopWidth|DocumentsCommonDir|error|exitCode|exitMethod|extended|FavoritesCommonDir|FavoritesDir|GUI_CtrlHandle|GUI_CtrlId|GUI_DragFile|GUI_DragId|GUI_DropId|GUI_WinHandle|HomeDrive|HomePath|HomeShare|HotKeyPressed|HOUR|InetGetActive|InetGetBytesRead|IPAddress1|IPAddress2|IPAddress3|IPAddress4|KBLayout|LF|LogonDNSDomain|LogonDomain|LogonServer|MDAY|MIN|MON|MyDocumentsDir|NumParams|OSBuild|OSLang|OSServicePack|OSTYPE|OSVersion|ProcessorArch|ProgramFilesDir|ProgramsCommonDir|ProgramsDir|ScriptDir|ScriptFullPath|ScriptLineNumber|ScriptName|SEC|StartMenuCommonDir|StartMenuDir|StartupCommonDir|StartupDir|SW_DISABLE|SW_ENABLE|SW_HIDE|SW_LOCK|SW_MAXIMIZE|SW_MINIMIZE|SW_RESTORE|SW_SHOW|SW_SHOWDEFAULT|SW_SHOWMAXIMIZED|SW_SHOWMINIMIZED|SW_SHOWMINNOACTIVE|SW_SHOWNA|SW_SHOWNOACTIVATE|SW_SHOWNORMAL|SW_UNLOCK|SystemDir|TAB|TempDir|TRAY_ID|TrayIconFlashing|TrayIconVisible|UserName|UserProfileDir|WDAY|WindowsDir|WorkingDir|YDAY|YEAR'; this.$rules = { start: [ { token: 'comment.line.ahk', regex: '(?:^| );.*$' }, { token: 'comment.block.ahk', regex: '/\\*', push: [ { token: 'comment.block.ahk', regex: '\\*/', next: 'pop' }, { defaultToken: 'comment.block.ahk' } ] }, { token: 'doc.comment.ahk', regex: '#cs', push: [ { token: 'doc.comment.ahk', regex: '#ce', next: 'pop' }, { defaultToken: 'doc.comment.ahk' } ] }, { token: 'keyword.command.ahk', regex: '(?:\\b|^)(?:allowsamelinecomments|clipboardtimeout|commentflag|errorstdout|escapechar|hotkeyinterval|hotkeymodifiertimeout|hotstring|include|includeagain|installkeybdhook|installmousehook|keyhistory|ltrim|maxhotkeysperinterval|maxmem|maxthreads|maxthreadsbuffer|maxthreadsperhotkey|noenv|notrayicon|persistent|singleinstance|usehook|winactivateforce|autotrim|blockinput|click|clipwait|continue|control|controlclick|controlfocus|controlget|controlgetfocus|controlgetpos|controlgettext|controlmove|controlsend|controlsendraw|controlsettext|coordmode|critical|detecthiddentext|detecthiddenwindows|drive|driveget|drivespacefree|edit|endrepeat|envadd|envdiv|envget|envmult|envset|envsub|envupdate|exit|exitapp|fileappend|filecopy|filecopydir|filecreatedir|filecreateshortcut|filedelete|filegetattrib|filegetshortcut|filegetsize|filegettime|filegetversion|fileinstall|filemove|filemovedir|fileread|filereadline|filerecycle|filerecycleempty|fileremovedir|fileselectfile|fileselectfolder|filesetattrib|filesettime|formattime|getkeystate|gosub|goto|groupactivate|groupadd|groupclose|groupdeactivate|gui|guicontrol|guicontrolget|hideautoitwin|hotkey|ifequal|ifexist|ifgreater|ifgreaterorequal|ifinstring|ifless|iflessorequal|ifmsgbox|ifnotequal|ifnotexist|ifnotinstring|ifwinactive|ifwinexist|ifwinnotactive|ifwinnotexist|imagesearch|inidelete|iniread|iniwrite|input|inputbox|keyhistory|keywait|listhotkeys|listlines|listvars|menu|mouseclick|mouseclickdrag|mousegetpos|mousemove|msgbox|onexit|outputdebug|pause|pixelgetcolor|pixelsearch|postmessage|process|progress|random|regdelete|regread|regwrite|reload|repeat|run|runas|runwait|send|sendevent|sendinput|sendmode|sendplay|sendmessage|sendraw|setbatchlines|setcapslockstate|setcontroldelay|setdefaultmousespeed|setenv|setformat|setkeydelay|setmousedelay|setnumlockstate|setscrolllockstate|setstorecapslockmode|settimer|settitlematchmode|setwindelay|setworkingdir|shutdown|sleep|sort|soundbeep|soundget|soundgetwavevolume|soundplay|soundset|soundsetwavevolume|splashimage|splashtextoff|splashtexton|splitpath|statusbargettext|statusbarwait|stringcasesense|stringgetpos|stringleft|stringlen|stringlower|stringmid|stringreplace|stringright|stringsplit|stringtrimleft|stringtrimright|stringupper|suspend|sysget|thread|tooltip|transform|traytip|urldownloadtofile|while|winactivate|winactivatebottom|winclose|winget|wingetactivestats|wingetactivetitle|wingetclass|wingetpos|wingettext|wingettitle|winhide|winkill|winmaximize|winmenuselectitem|winminimize|winminimizeall|winminimizeallundo|winmove|winrestore|winset|winsettitle|winshow|winwait|winwaitactive|winwaitclose|winwaitnotactive)\\b', caseInsensitive: true }, { token: 'keyword.control.ahk', regex: '(?:\\b|^)(?:if|else|return|loop|break|for|while|global|local|byref)\\b', caseInsensitive: true }, { token: 'support.function.ahk', regex: '(?:\\b|^)(?:abs|acos|asc|asin|atan|ceil|chr|cos|dllcall|exp|fileexist|floor|getkeystate|il_add|il_create|il_destroy|instr|substr|isfunc|islabel|ln|log|lv_add|lv_delete|lv_deletecol|lv_getcount|lv_getnext|lv_gettext|lv_insert|lv_insertcol|lv_modify|lv_modifycol|lv_setimagelist|mod|onmessage|numget|numput|registercallback|regexmatch|regexreplace|round|sin|tan|sqrt|strlen|sb_seticon|sb_setparts|sb_settext|tv_add|tv_delete|tv_getchild|tv_getcount|tv_getnext|tv_get|tv_getparent|tv_getprev|tv_getselection|tv_gettext|tv_modify|varsetcapacity|winactive|winexist)\\b', caseInsensitive: true }, { token: 'variable.predefined.ahk', regex: '(?:\\b|^)(?:a_ahkpath|a_ahkversion|a_appdata|a_appdatacommon|a_autotrim|a_batchlines|a_caretx|a_carety|a_computername|a_controldelay|a_cursor|a_dd|a_ddd|a_dddd|a_defaultmousespeed|a_desktop|a_desktopcommon|a_detecthiddentext|a_detecthiddenwindows|a_endchar|a_eventinfo|a_exitreason|a_formatfloat|a_formatinteger|a_gui|a_guievent|a_guicontrol|a_guicontrolevent|a_guiheight|a_guiwidth|a_guix|a_guiy|a_hour|a_iconfile|a_iconhidden|a_iconnumber|a_icontip|a_index|a_ipaddress1|a_ipaddress2|a_ipaddress3|a_ipaddress4|a_isadmin|a_iscompiled|a_iscritical|a_ispaused|a_issuspended|a_keydelay|a_language|a_lasterror|a_linefile|a_linenumber|a_loopfield|a_loopfileattrib|a_loopfiledir|a_loopfileext|a_loopfilefullpath|a_loopfilelongpath|a_loopfilename|a_loopfileshortname|a_loopfileshortpath|a_loopfilesize|a_loopfilesizekb|a_loopfilesizemb|a_loopfiletimeaccessed|a_loopfiletimecreated|a_loopfiletimemodified|a_loopreadline|a_loopregkey|a_loopregname|a_loopregsubkey|a_loopregtimemodified|a_loopregtype|a_mday|a_min|a_mm|a_mmm|a_mmmm|a_mon|a_mousedelay|a_msec|a_mydocuments|a_now|a_nowutc|a_numbatchlines|a_ostype|a_osversion|a_priorhotkey|programfiles|a_programfiles|a_programs|a_programscommon|a_screenheight|a_screenwidth|a_scriptdir|a_scriptfullpath|a_scriptname|a_sec|a_space|a_startmenu|a_startmenucommon|a_startup|a_startupcommon|a_stringcasesense|a_tab|a_temp|a_thisfunc|a_thishotkey|a_thislabel|a_thismenu|a_thismenuitem|a_thismenuitempos|a_tickcount|a_timeidle|a_timeidlephysical|a_timesincepriorhotkey|a_timesincethishotkey|a_titlematchmode|a_titlematchmodespeed|a_username|a_wday|a_windelay|a_windir|a_workingdir|a_yday|a_year|a_yweek|a_yyyy|clipboard|clipboardall|comspec|errorlevel)\\b', caseInsensitive: true }, { token: 'support.constant.ahk', regex: '(?:\\b|^)(?:shift|lshift|rshift|alt|lalt|ralt|control|lcontrol|rcontrol|ctrl|lctrl|rctrl|lwin|rwin|appskey|altdown|altup|shiftdown|shiftup|ctrldown|ctrlup|lwindown|lwinup|rwindown|rwinup|lbutton|rbutton|mbutton|wheelup|wheelleft|wheelright|wheeldown|xbutton1|xbutton2|joy1|joy2|joy3|joy4|joy5|joy6|joy7|joy8|joy9|joy10|joy11|joy12|joy13|joy14|joy15|joy16|joy17|joy18|joy19|joy20|joy21|joy22|joy23|joy24|joy25|joy26|joy27|joy28|joy29|joy30|joy31|joy32|joyx|joyy|joyz|joyr|joyu|joyv|joypov|joyname|joybuttons|joyaxes|joyinfo|space|tab|enter|escape|esc|backspace|bs|delete|del|insert|ins|pgup|pgdn|home|end|up|down|left|right|printscreen|ctrlbreak|pause|scrolllock|capslock|numlock|numpad0|numpad1|numpad2|numpad3|numpad4|numpad5|numpad6|numpad7|numpad8|numpad9|numpadmult|numpadadd|numpadsub|numpaddiv|numpaddot|numpaddel|numpadins|numpadclear|numpadup|numpaddown|numpadleft|numpadright|numpadhome|numpadend|numpadpgup|numpadpgdn|numpadenter|f1|f2|f3|f4|f5|f6|f7|f8|f9|f10|f11|f12|f13|f14|f15|f16|f17|f18|f19|f20|f21|f22|f23|f24|browser_back|browser_forward|browser_refresh|browser_stop|browser_search|browser_favorites|browser_home|volume_mute|volume_down|volume_up|media_next|media_prev|media_stop|media_play_pause|launch_mail|launch_media|launch_app1|launch_app2)\\b', caseInsensitive: true }, { token: 'variable.parameter', regex: '(?:\\b|^)(?:pixel|mouse|screen|relative|rgb|ltrim|rtrim|join|low|belownormal|normal|abovenormal|high|realtime|ahk_id|ahk_pid|ahk_class|ahk_group|between|contains|in|is|integer|float|integerfast|floatfast|number|digit|xdigit|alpha|upper|lower|alnum|time|date|not|or|and|alwaysontop|topmost|top|bottom|transparent|transcolor|redraw|region|id|idlast|processname|minmax|controllist|count|list|capacity|statuscd|eject|lock|unlock|label|filesystem|label|setlabel|serial|type|status|static|seconds|minutes|hours|days|read|parse|logoff|close|error|single|tray|add|rename|check|uncheck|togglecheck|enable|disable|toggleenable|default|nodefault|standard|nostandard|color|delete|deleteall|icon|noicon|tip|click|show|mainwindow|nomainwindow|useerrorlevel|text|picture|pic|groupbox|button|checkbox|radio|dropdownlist|ddl|combobox|listbox|listview|datetime|monthcal|updown|slider|tab|tab2|statusbar|treeview|iconsmall|tile|report|sortdesc|nosort|nosorthdr|grid|hdr|autosize|range|xm|ym|ys|xs|xp|yp|font|resize|owner|submit|nohide|minimize|maximize|restore|noactivate|na|cancel|destroy|center|margin|maxsize|minsize|owndialogs|guiescape|guiclose|guisize|guicontextmenu|guidropfiles|tabstop|section|altsubmit|wrap|hscroll|vscroll|border|top|bottom|buttons|expand|first|imagelist|lines|wantctrla|wantf2|vis|visfirst|number|uppercase|lowercase|limit|password|multi|wantreturn|group|background|bold|italic|strike|underline|norm|backgroundtrans|theme|caption|delimiter|minimizebox|maximizebox|sysmenu|toolwindow|flash|style|exstyle|check3|checked|checkedgray|readonly|password|hidden|left|right|center|notab|section|move|focus|hide|choose|choosestring|text|pos|enabled|disabled|visible|lastfound|lastfoundexist|alttab|shiftalttab|alttabmenu|alttabandmenu|alttabmenudismiss|notimers|interrupt|priority|waitclose|blind|raw|unicode|deref|pow|bitnot|bitand|bitor|bitxor|bitshiftleft|bitshiftright|yes|no|ok|cancel|abort|retry|ignore|tryagain|on|off|all|hkey_local_machine|hkey_users|hkey_current_user|hkey_classes_root|hkey_current_config|hklm|hku|hkcu|hkcr|hkcc|reg_sz|reg_expand_sz|reg_multi_sz|reg_dword|reg_qword|reg_binary|reg_link|reg_resource_list|reg_full_resource_descriptor|reg_resource_requirements_list|reg_dword_big_endian)\\b', caseInsensitive: true }, { keywordMap: {"constant.language": autoItKeywords}, regex: '\\w+\\b'}, { keywordMap: {"variable.function": atKeywords}, regex: '@\\w+\\b'}, { token : "constant.numeric", regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b"}, { token: 'keyword.operator.ahk', regex: '=|==|<>|:=|<|>|\\*|\\/|\\+|:|\\?|\\-' }, { token: 'punctuation.ahk', regex: '#|`|::|,|\\{|\\}|\\(|\\)|\\%' }, { token: [ 'punctuation.quote.double', 'string.quoted.ahk', 'punctuation.quote.double' ], regex: '(")((?:[^"]|"")*)(")' }, { token: [ 'label.ahk', 'punctuation.definition.label.ahk' ], regex: '^([^: ]+)(:)(?!:)' } ] }; this.normalizeRules(); }; AutoHotKeyHighlightRules.metaData = { name: 'AutoHotKey', scopeName: 'source.ahk', fileTypes: [ 'ahk' ], foldingStartMarker: '^\\s*/\\*|^(?![^{]*?;|[^{]*?/\\*(?!.*?\\*/.*?\\{)).*?\\{\\s*($|;|/\\*(?!.*?\\*/.*\\S))', foldingStopMarker: '^\\s*\\*/|^\\s*\\}' }; oop.inherits(AutoHotKeyHighlightRules, TextHighlightRules); exports.AutoHotKeyHighlightRules = AutoHotKeyHighlightRules; }); ================================================ FILE: lib/ace/mode/batchfile.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * * Contributor(s): * * * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var BatchFileHighlightRules = require("./batchfile_highlight_rules").BatchFileHighlightRules; var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = BatchFileHighlightRules; this.foldingRules = new FoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "::"; this.blockComment = ""; this.$id = "ace/mode/batchfile"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/batchfile_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* This file was autogenerated from C:\Users\LED\AppData\Roaming\Sublime Text 2\Packages\Batch File\Batch File.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var BatchFileHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [ { token: 'keyword.command.dosbatch', regex: '\\b(?:append|assoc|at|attrib|break|cacls|cd|chcp|chdir|chkdsk|chkntfs|cls|cmd|color|comp|compact|convert|copy|date|del|dir|diskcomp|diskcopy|doskey|echo|endlocal|erase|fc|find|findstr|format|ftype|graftabl|help|keyb|label|md|mkdir|mode|more|move|path|pause|popd|print|prompt|pushd|rd|recover|ren|rename|replace|restore|rmdir|set|setlocal|shift|sort|start|subst|time|title|tree|type|ver|verify|vol|xcopy)\\b', caseInsensitive: true }, { token: 'keyword.control.statement.dosbatch', regex: '\\b(?:goto|call|exit)\\b', caseInsensitive: true }, { token: 'keyword.control.conditional.if.dosbatch', regex: '\\bif\\s+not\\s+(?:exist|defined|errorlevel|cmdextversion)\\b', caseInsensitive: true }, { token: 'keyword.control.conditional.dosbatch', regex: '\\b(?:if|else)\\b', caseInsensitive: true }, { token: 'keyword.control.repeat.dosbatch', regex: '\\bfor\\b', caseInsensitive: true }, { token: 'keyword.operator.dosbatch', regex: '\\b(?:EQU|NEQ|LSS|LEQ|GTR|GEQ)\\b' }, { token: ['doc.comment', 'comment'], regex: '(?:^|\\b)(rem)($|\\s.*$)', caseInsensitive: true }, { token: 'comment.line.colons.dosbatch', regex: '::.*$' }, { include: 'variable' }, { token: 'punctuation.definition.string.begin.shell', regex: '"', push: [ { token: 'punctuation.definition.string.end.shell', regex: '"', next: 'pop' }, { include: 'variable' }, { defaultToken: 'string.quoted.double.dosbatch' } ] }, { token: 'keyword.operator.pipe.dosbatch', regex: '[|]' }, { token: 'keyword.operator.redirect.shell', regex: '&>|\\d*>&\\d*|\\d*(?:>>|>|<)|\\d*<&|\\d*<>' } ], variable: [ { token: 'constant.numeric', regex: '%%\\w+|%[*\\d]|%\\w+%'}, { token: 'constant.numeric', regex: '%~\\d+'}, { token: ['markup.list', 'constant.other', 'markup.list'], regex: '(%)(\\w+)(%?)' }]}; this.normalizeRules(); }; BatchFileHighlightRules.metaData = { name: 'Batch File', scopeName: 'source.dosbatch', fileTypes: [ 'bat' ] }; oop.inherits(BatchFileHighlightRules, TextHighlightRules); exports.BatchFileHighlightRules = BatchFileHighlightRules; }); ================================================ FILE: lib/ace/mode/behaviour/behaviour_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); require("../../test/mockdom"); } define(function(require, exports, module) { "use strict"; require("../../multi_select"); var assert = require("../../test/assertions"); var Range = require("../../range").Range; var Editor = require("../../editor").Editor; var EditSession = require("../../edit_session").EditSession; var MockRenderer = require("../../test/mockrenderer").MockRenderer; var JavaScriptMode = require("../javascript").Mode; var RustMode = require("../rust").Mode; var XMLMode = require("../xml").Mode; var editor; var exec = function(name, times, args) { do { editor.commands.exec(name, editor, args); } while(times --> 1); }; var testRanges = function(str) { assert.equal(editor.selection.getAllRanges() + "", str + ""); }; module.exports = { "test: cstyle": function() { function testValue(line) { assert.equal(editor.getValue(), Array(4).join(line + "\n")); } function testSelection(line, col, inc) { editor.selection.rangeList.ranges.forEach(function(r) { assert.range(r, line, col, line, col); line += (inc || 1); }); } var doc = new EditSession([ "", "", "", "" ], new JavaScriptMode()); editor = new Editor(new MockRenderer(), doc); editor.setOption("behavioursEnabled", true); editor.navigateFileStart(); exec("addCursorBelow", 2); exec("insertstring", 1, "if "); // pairing ( exec("insertstring", 1, "("); testValue("if ()"); testSelection(0, 4); exec("insertstring", 1, ")"); testValue("if ()"); testSelection(0, 5); // pairing [ exec("gotoleft", 1); exec("insertstring", 1, "["); testValue("if ([])"); testSelection(0, 5); exec("insertstring", 1, "]"); testValue("if ([])"); testSelection(0, 6); // test deletion exec("gotoleft", 1); exec("backspace", 1); testValue("if ()"); testSelection(0, 4); exec("gotolineend", 1); exec("insertstring", 1, "{"); testValue("if (){}"); testSelection(0, 6); exec("insertstring", 1, "}"); testValue("if (){}"); testSelection(0, 7); exec("gotolinestart", 1); exec("insertstring", 1, "("); testValue("(if (){}"); exec("backspace", 1); editor.setValue(""); exec("insertstring", 1, "{"); assert.equal(editor.getValue(), "{"); exec("insertstring", 1, "\n"); assert.equal(editor.getValue(), "{\n \n}"); editor.setValue(""); exec("insertstring", 1, "("); exec("insertstring", 1, '"'); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), '("")'); exec("backspace", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), '("")'); editor.setValue("('foo')", 1); exec("gotoleft", 1); exec("selectleft", 1); exec("selectMoreBefore", 1); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "('foo')"); exec("selectleft", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), '("foo")'); exec("selectleft", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), '("foo")'); editor.setValue("", 1); exec("selectleft", 1); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), '""'); exec("insertstring", 1, '\\'); exec("insertstring", 1, 'n'); exec("insertstring", 1, '"'); assert.equal(editor.getValue(), '"\\n"'); }, "test: xml": function() { editor = new Editor(new MockRenderer()); editor.setValue(["", " " ].join("\n")); editor.session.setMode(new XMLMode); exec("golinedown", 1); exec("gotolineend", 1); exec("insertstring", 1, '\n'); assert.equal(editor.session.getLine(2), " "); exec("gotolineup", 1); exec("gotolineend", 1); exec("insertstring", 1, '\n'); assert.equal(editor.session.getLine(2), " "); editor.session.setValue(["'); assert.equal(editor.session.getLine(1), " "); }, "test: quotes": function() { editor = new Editor(new MockRenderer()); editor.session.setMode(new RustMode); editor.setValue(""); exec("insertstring", 1, '"'); exec("insertstring", 1, 'a'); assert.equal(editor.getValue(), '"a"'); exec("backspace", 2); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "'"); editor.session.setMode(new JavaScriptMode); editor.setValue(""); exec("insertstring", 1, '"'); exec("insertstring", 1, 'a'); assert.equal(editor.getValue(), '"a"'); exec("backspace", 2); exec("insertstring", 1, "'"); assert.equal(editor.getValue(), "''"); exec("backspace", 1); exec("insertstring", 1, '`'); exec("insertstring", 1, 'b'); assert.equal(editor.getValue(), "`b`"); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/mode/behaviour/css.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var CstyleBehaviour = require("./cstyle").CstyleBehaviour; var TokenIterator = require("../../token_iterator").TokenIterator; var CssBehaviour = function () { this.inherit(CstyleBehaviour); this.add("colon", "insertion", function (state, action, editor, session, text) { if (text === ':') { var cursor = editor.getCursorPosition(); var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); if (token && token.value.match(/\s+/)) { token = iterator.stepBackward(); } if (token && token.type === 'support.type') { var line = session.doc.getLine(cursor.row); var rightChar = line.substring(cursor.column, cursor.column + 1); if (rightChar === ':') { return { text: '', selection: [1, 1] }; } if (!line.substring(cursor.column).match(/^\s*;/)) { return { text: ':;', selection: [1, 1] }; } } } }); this.add("colon", "deletion", function (state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && selected === ':') { var cursor = editor.getCursorPosition(); var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); if (token && token.value.match(/\s+/)) { token = iterator.stepBackward(); } if (token && token.type === 'support.type') { var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.end.column, range.end.column + 1); if (rightChar === ';') { range.end.column ++; return range; } } } }); this.add("semicolon", "insertion", function (state, action, editor, session, text) { if (text === ';') { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var rightChar = line.substring(cursor.column, cursor.column + 1); if (rightChar === ';') { return { text: '', selection: [1, 1] }; } } }); }; oop.inherits(CssBehaviour, CstyleBehaviour); exports.CssBehaviour = CssBehaviour; }); ================================================ FILE: lib/ace/mode/behaviour/cstyle.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var TokenIterator = require("../../token_iterator").TokenIterator; var lang = require("../../lib/lang"); var SAFE_INSERT_IN_TOKENS = ["text", "paren.rparen", "punctuation.operator"]; var SAFE_INSERT_BEFORE_TOKENS = ["text", "paren.rparen", "punctuation.operator", "comment"]; var context; var contextCache = {}; var defaultQuotes = {'"' : '"', "'" : "'"}; var initContext = function(editor) { var id = -1; if (editor.multiSelect) { id = editor.selection.index; if (contextCache.rangeCount != editor.multiSelect.rangeCount) contextCache = {rangeCount: editor.multiSelect.rangeCount}; } if (contextCache[id]) return context = contextCache[id]; context = contextCache[id] = { autoInsertedBrackets: 0, autoInsertedRow: -1, autoInsertedLineEnd: "", maybeInsertedBrackets: 0, maybeInsertedRow: -1, maybeInsertedLineStart: "", maybeInsertedLineEnd: "" }; }; var getWrapped = function(selection, selected, opening, closing) { var rowDiff = selection.end.row - selection.start.row; return { text: opening + selected + closing, selection: [ 0, selection.start.column + 1, rowDiff, selection.end.column + (rowDiff ? 0 : 1) ] }; }; var CstyleBehaviour = function(options) { this.add("braces", "insertion", function(state, action, editor, session, text) { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); if (text == '{') { initContext(editor); var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && selected !== "{" && editor.getWrapBehavioursEnabled()) { return getWrapped(selection, selected, '{', '}'); } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { if (/[\]\}\)]/.test(line[cursor.column]) || editor.inMultiSelectMode || options && options.braces) { CstyleBehaviour.recordAutoInsert(editor, session, "}"); return { text: '{}', selection: [1, 1] }; } else { CstyleBehaviour.recordMaybeInsert(editor, session, "{"); return { text: '{', selection: [1, 1] }; } } } else if (text == '}') { initContext(editor); var rightChar = line.substring(cursor.column, cursor.column + 1); if (rightChar == '}') { var matching = session.$findOpeningBracket('}', {column: cursor.column + 1, row: cursor.row}); if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { CstyleBehaviour.popAutoInsertedClosing(); return { text: '', selection: [1, 1] }; } } } else if (text == "\n" || text == "\r\n") { initContext(editor); var closing = ""; if (CstyleBehaviour.isMaybeInsertedClosing(cursor, line)) { closing = lang.stringRepeat("}", context.maybeInsertedBrackets); CstyleBehaviour.clearMaybeInsertedClosing(); } var rightChar = line.substring(cursor.column, cursor.column + 1); if (rightChar === '}') { var openBracePos = session.findMatchingBracket({row: cursor.row, column: cursor.column+1}, '}'); if (!openBracePos) return null; var next_indent = this.$getIndent(session.getLine(openBracePos.row)); } else if (closing) { var next_indent = this.$getIndent(line); } else { CstyleBehaviour.clearMaybeInsertedClosing(); return; } var indent = next_indent + session.getTabString(); return { text: '\n' + indent + '\n' + next_indent + closing, selection: [1, indent.length, 1, indent.length] }; } else { CstyleBehaviour.clearMaybeInsertedClosing(); } }); this.add("braces", "deletion", function(state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && selected == '{') { initContext(editor); var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.end.column, range.end.column + 1); if (rightChar == '}') { range.end.column++; return range; } else { context.maybeInsertedBrackets--; } } }); this.add("parens", "insertion", function(state, action, editor, session, text) { if (text == '(') { initContext(editor); var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && editor.getWrapBehavioursEnabled()) { return getWrapped(selection, selected, '(', ')'); } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, ")"); return { text: '()', selection: [1, 1] }; } } else if (text == ')') { initContext(editor); var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var rightChar = line.substring(cursor.column, cursor.column + 1); if (rightChar == ')') { var matching = session.$findOpeningBracket(')', {column: cursor.column + 1, row: cursor.row}); if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { CstyleBehaviour.popAutoInsertedClosing(); return { text: '', selection: [1, 1] }; } } } }); this.add("parens", "deletion", function(state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && selected == '(') { initContext(editor); var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.start.column + 1, range.start.column + 2); if (rightChar == ')') { range.end.column++; return range; } } }); this.add("brackets", "insertion", function(state, action, editor, session, text) { if (text == '[') { initContext(editor); var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && editor.getWrapBehavioursEnabled()) { return getWrapped(selection, selected, '[', ']'); } else if (CstyleBehaviour.isSaneInsertion(editor, session)) { CstyleBehaviour.recordAutoInsert(editor, session, "]"); return { text: '[]', selection: [1, 1] }; } } else if (text == ']') { initContext(editor); var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var rightChar = line.substring(cursor.column, cursor.column + 1); if (rightChar == ']') { var matching = session.$findOpeningBracket(']', {column: cursor.column + 1, row: cursor.row}); if (matching !== null && CstyleBehaviour.isAutoInsertedClosing(cursor, line, text)) { CstyleBehaviour.popAutoInsertedClosing(); return { text: '', selection: [1, 1] }; } } } }); this.add("brackets", "deletion", function(state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && selected == '[') { initContext(editor); var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.start.column + 1, range.start.column + 2); if (rightChar == ']') { range.end.column++; return range; } } }); this.add("string_dquotes", "insertion", function(state, action, editor, session, text) { var quotes = session.$mode.$quotes || defaultQuotes; if (text.length == 1 && quotes[text]) { if (this.lineCommentStart && this.lineCommentStart.indexOf(text) != -1) return; initContext(editor); var quote = text; var selection = editor.getSelectionRange(); var selected = session.doc.getTextRange(selection); if (selected !== "" && (selected.length != 1 || !quotes[selected]) && editor.getWrapBehavioursEnabled()) { return getWrapped(selection, selected, quote, quote); } else if (!selected) { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var leftChar = line.substring(cursor.column-1, cursor.column); var rightChar = line.substring(cursor.column, cursor.column + 1); var token = session.getTokenAt(cursor.row, cursor.column); var rightToken = session.getTokenAt(cursor.row, cursor.column + 1); // We're escaped. if (leftChar == "\\" && token && /escape/.test(token.type)) return null; var stringBefore = token && /string|escape/.test(token.type); var stringAfter = !rightToken || /string|escape/.test(rightToken.type); var pair; if (rightChar == quote) { pair = stringBefore !== stringAfter; if (pair && /string\.end/.test(rightToken.type)) pair = false; } else { if (stringBefore && !stringAfter) return null; // wrap string with different quote if (stringBefore && stringAfter) return null; // do not pair quotes inside strings var wordRe = session.$mode.tokenRe; wordRe.lastIndex = 0; var isWordBefore = wordRe.test(leftChar); wordRe.lastIndex = 0; var isWordAfter = wordRe.test(leftChar); if (isWordBefore || isWordAfter) return null; // before or after alphanumeric if (rightChar && !/[\s;,.})\]\\]/.test(rightChar)) return null; // there is rightChar and it isn't closing pair = true; } return { text: pair ? quote + quote : "", selection: [1,1] }; } } }); this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && (selected == '"' || selected == "'")) { initContext(editor); var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.start.column + 1, range.start.column + 2); if (rightChar == selected) { range.end.column++; return range; } } }); }; CstyleBehaviour.isSaneInsertion = function(editor, session) { var cursor = editor.getCursorPosition(); var iterator = new TokenIterator(session, cursor.row, cursor.column); // Don't insert in the middle of a keyword/identifier/lexical if (!this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) { // Look ahead in case we're at the end of a token var iterator2 = new TokenIterator(session, cursor.row, cursor.column + 1); if (!this.$matchTokenType(iterator2.getCurrentToken() || "text", SAFE_INSERT_IN_TOKENS)) return false; } // Only insert in front of whitespace/comments iterator.stepForward(); return iterator.getCurrentTokenRow() !== cursor.row || this.$matchTokenType(iterator.getCurrentToken() || "text", SAFE_INSERT_BEFORE_TOKENS); }; CstyleBehaviour.$matchTokenType = function(token, types) { return types.indexOf(token.type || token) > -1; }; CstyleBehaviour.recordAutoInsert = function(editor, session, bracket) { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); // Reset previous state if text or context changed too much if (!this.isAutoInsertedClosing(cursor, line, context.autoInsertedLineEnd[0])) context.autoInsertedBrackets = 0; context.autoInsertedRow = cursor.row; context.autoInsertedLineEnd = bracket + line.substr(cursor.column); context.autoInsertedBrackets++; }; CstyleBehaviour.recordMaybeInsert = function(editor, session, bracket) { var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); if (!this.isMaybeInsertedClosing(cursor, line)) context.maybeInsertedBrackets = 0; context.maybeInsertedRow = cursor.row; context.maybeInsertedLineStart = line.substr(0, cursor.column) + bracket; context.maybeInsertedLineEnd = line.substr(cursor.column); context.maybeInsertedBrackets++; }; CstyleBehaviour.isAutoInsertedClosing = function(cursor, line, bracket) { return context.autoInsertedBrackets > 0 && cursor.row === context.autoInsertedRow && bracket === context.autoInsertedLineEnd[0] && line.substr(cursor.column) === context.autoInsertedLineEnd; }; CstyleBehaviour.isMaybeInsertedClosing = function(cursor, line) { return context.maybeInsertedBrackets > 0 && cursor.row === context.maybeInsertedRow && line.substr(cursor.column) === context.maybeInsertedLineEnd && line.substr(0, cursor.column) == context.maybeInsertedLineStart; }; CstyleBehaviour.popAutoInsertedClosing = function() { context.autoInsertedLineEnd = context.autoInsertedLineEnd.substr(1); context.autoInsertedBrackets--; }; CstyleBehaviour.clearMaybeInsertedClosing = function() { if (context) { context.maybeInsertedBrackets = 0; context.maybeInsertedRow = -1; } }; oop.inherits(CstyleBehaviour, Behaviour); exports.CstyleBehaviour = CstyleBehaviour; }); ================================================ FILE: lib/ace/mode/behaviour/html.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var XmlBehaviour = require("../behaviour/xml").XmlBehaviour; var HtmlBehaviour = function () { XmlBehaviour.call(this); }; oop.inherits(HtmlBehaviour, XmlBehaviour); exports.HtmlBehaviour = HtmlBehaviour; }); ================================================ FILE: lib/ace/mode/behaviour/xml.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../../lib/oop"); var Behaviour = require("../behaviour").Behaviour; var TokenIterator = require("../../token_iterator").TokenIterator; var lang = require("../../lib/lang"); function is(token, type) { return token.type.lastIndexOf(type + ".xml") > -1; } var XmlBehaviour = function () { this.add("string_dquotes", "insertion", function (state, action, editor, session, text) { if (text == '"' || text == "'") { var quote = text; var selected = session.doc.getTextRange(editor.getSelectionRange()); if (selected !== "" && selected !== "'" && selected != '"' && editor.getWrapBehavioursEnabled()) { return { text: quote + selected + quote, selection: false }; } var cursor = editor.getCursorPosition(); var line = session.doc.getLine(cursor.row); var rightChar = line.substring(cursor.column, cursor.column + 1); var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); if (rightChar == quote && (is(token, "attribute-value") || is(token, "string"))) { // Ignore input and move right one if we're typing over the closing quote. return { text: "", selection: [1, 1] }; } if (!token) token = iterator.stepBackward(); if (!token) return; while (is(token, "tag-whitespace") || is(token, "whitespace")) { token = iterator.stepBackward(); } var rightSpace = !rightChar || rightChar.match(/\s/); if (is(token, "attribute-equals") && (rightSpace || rightChar == '>') || (is(token, "decl-attribute-equals") && (rightSpace || rightChar == '?'))) { return { text: quote + quote, selection: [1, 1] }; } } }); this.add("string_dquotes", "deletion", function(state, action, editor, session, range) { var selected = session.doc.getTextRange(range); if (!range.isMultiLine() && (selected == '"' || selected == "'")) { var line = session.doc.getLine(range.start.row); var rightChar = line.substring(range.start.column + 1, range.start.column + 2); if (rightChar == selected) { range.end.column++; return range; } } }); this.add("autoclosing", "insertion", function (state, action, editor, session, text) { if (text == '>') { var position = editor.getSelectionRange().start; var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken() || iterator.stepBackward(); // exit if we're not in a tag if (!token || !(is(token, "tag-name") || is(token, "tag-whitespace") || is(token, "attribute-name") || is(token, "attribute-equals") || is(token, "attribute-value"))) return; // exit if we're inside of a quoted attribute value if (is(token, "reference.attribute-value")) return; if (is(token, "attribute-value")) { var firstChar = token.value.charAt(0); if (firstChar == '"' || firstChar == "'") { var lastChar = token.value.charAt(token.value.length - 1); var tokenEnd = iterator.getCurrentTokenColumn() + token.value.length; if (tokenEnd > position.column || tokenEnd == position.column && firstChar != lastChar) return; } } // find tag name while (!is(token, "tag-name")) { token = iterator.stepBackward(); if (token.value == "<") { token = iterator.stepForward(); break; } } var tokenRow = iterator.getCurrentTokenRow(); var tokenColumn = iterator.getCurrentTokenColumn(); // exit if the tag is ending if (is(iterator.stepBackward(), "end-tag-open")) return; var element = token.value; if (tokenRow == position.row) element = element.substring(0, position.column - tokenColumn); if (this.voidElements.hasOwnProperty(element.toLowerCase())) return; return { text: ">" + "", selection: [1, 1] }; } }); this.add("autoindent", "insertion", function (state, action, editor, session, text) { if (text == "\n") { var cursor = editor.getCursorPosition(); var line = session.getLine(cursor.row); var iterator = new TokenIterator(session, cursor.row, cursor.column); var token = iterator.getCurrentToken(); if (token && token.type.indexOf("tag-close") !== -1) { if (token.value == "/>") return; //get tag name while (token && token.type.indexOf("tag-name") === -1) { token = iterator.stepBackward(); } if (!token) { return; } var tag = token.value; var row = iterator.getCurrentTokenRow(); //don't indent after closing tag token = iterator.stepBackward(); if (!token || token.type.indexOf("end-tag") !== -1) { return; } if (this.voidElements && !this.voidElements[tag]) { var nextToken = session.getTokenAt(cursor.row, cursor.column+1); var line = session.getLine(row); var nextIndent = this.$getIndent(line); var indent = nextIndent + session.getTabString(); if (nextToken && nextToken.value === "') { var position = editor.getCursorPosition(); var iterator = new TokenIterator(session, position.row, position.column); var token = iterator.getCurrentToken(); var atCursor = false; var state = JSON.parse(state).pop(); if ((token && token.value === '>') || state !== "StartTag") return; if (!token || !hasType(token, 'meta.tag') && !(hasType(token, 'text') && token.value.match('/'))){ do { token = iterator.stepBackward(); } while (token && (hasType(token, 'string') || hasType(token, 'keyword.operator') || hasType(token, 'entity.attribute-name') || hasType(token, 'text'))); } else { atCursor = true; } var previous = iterator.stepBackward(); if (!token || !hasType(token, 'meta.tag') || (previous !== null && previous.value.match('/'))) { return; } var tag = token.value.substring(1); if (atCursor){ var tag = tag.substring(0, position.column - token.start); } return { text: '>' + '', selection: [1, 1] }; } }); }; oop.inherits(XQueryBehaviour, Behaviour); exports.XQueryBehaviour = XQueryBehaviour; }); ================================================ FILE: lib/ace/mode/behaviour.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Behaviour = function() { this.$behaviours = {}; }; (function () { this.add = function (name, action, callback) { switch (undefined) { case this.$behaviours: this.$behaviours = {}; case this.$behaviours[name]: this.$behaviours[name] = {}; } this.$behaviours[name][action] = callback; }; this.addBehaviours = function (behaviours) { for (var key in behaviours) { for (var action in behaviours[key]) { this.add(key, action, behaviours[key][action]); } } }; this.remove = function (name) { if (this.$behaviours && this.$behaviours[name]) { delete this.$behaviours[name]; } }; this.inherit = function (mode, filter) { if (typeof mode === "function") { var behaviours = new mode().getBehaviours(filter); } else { var behaviours = mode.getBehaviours(filter); } this.addBehaviours(behaviours); }; this.getBehaviours = function (filter) { if (!filter) { return this.$behaviours; } else { var ret = {}; for (var i = 0; i < filter.length; i++) { if (this.$behaviours[filter[i]]) { ret[filter[i]] = this.$behaviours[filter[i]]; } } return ret; } }; }).call(Behaviour.prototype); exports.Behaviour = Behaviour; }); ================================================ FILE: lib/ace/mode/bro.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* THIS FILE WAS AUTOGENERATED BY mode.tmpl.js */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var BroHighlightRules = require("./bro_highlight_rules").BroHighlightRules; // TODO: pick appropriate fold mode var FoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = BroHighlightRules; this.foldingRules = new FoldMode(); }; oop.inherits(Mode, TextMode); (function() { // this.lineCommentStart = ""#""; // this.blockComment = {start: ""/*"", end: ""*/""}; // Extra logic goes here. this.$id = "ace/mode/bro"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/bro_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2012, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ /* This file was autogenerated from Bro.tmLanguage (uuid: ) */ /**************************************************************************************** * IT MIGHT NOT BE PERFECT ...But it's a good start from an existing *.tmlanguage file. * * fileTypes * ****************************************************************************************/ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var BroHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { start: [{ token: "punctuation.definition.comment.bro", regex: /#/, push: [{ token: "comment.line.number-sign.bro", regex: /$/, next: "pop" }, { defaultToken: "comment.line.number-sign.bro" }] }, { token: "keyword.control.bro", regex: /\b(?:break|case|continue|else|for|if|return|switch|next|when|timeout|schedule)\b/ }, { token: [ "meta.function.bro", "meta.function.bro", "storage.type.bro", "meta.function.bro", "entity.name.function.bro", "meta.function.bro" ], regex: /^(\s*)(?:function|hook|event)(\s*)(.*)(\s*\()(.*)(\).*$)/ }, { token: "storage.type.bro", regex: /\b(?:bool|enum|double|int|count|port|addr|subnet|any|file|interval|time|string|table|vector|set|record|pattern|hook)\b/ }, { token: "storage.modifier.bro", regex: /\b(?:global|const|redef|local|&(?:optional|rotate_interval|rotate_size|add_func|del_func|expire_func|expire_create|expire_read|expire_write|persistent|synchronized|encrypt|mergeable|priority|group|type_column|log|error_handler))\b/ }, { token: "keyword.operator.bro", regex: /\s*(?:\||&&|(?:>|<|!)=?|==)\s*|\b!?in\b/ }, { token: "constant.language.bro", regex: /\b(?:T|F)\b/ }, { token: "constant.numeric.bro", regex: /\b(?:0(?:x|X)[0-9a-fA-F]*|(?:[0-9]+\.?[0-9]*|\.[0-9]+)(?:(?:e|E)(?:\+|-)?[0-9]+)?)(?:\/(?:tcp|udp|icmp)|\s*(?:u?sec|min|hr|day)s?)?\b/ }, { token: "punctuation.definition.string.begin.bro", regex: /"/, push: [{ token: "punctuation.definition.string.end.bro", regex: /"/, next: "pop" }, { include: "#string_escaped_char" }, { include: "#string_placeholder" }, { defaultToken: "string.quoted.double.bro" }] }, { token: "punctuation.definition.string.begin.bro", regex: /\//, push: [{ token: "punctuation.definition.string.end.bro", regex: /\//, next: "pop" }, { include: "#string_escaped_char" }, { include: "#string_placeholder" }, { defaultToken: "string.quoted.regex.bro" }] }, { token: [ "meta.preprocessor.bro.load", "keyword.other.special-method.bro" ], regex: /^(\s*)(\@load(?:-sigs)?)\b/, push: [{ token: [], regex: /(?=\#)|$/, next: "pop" }, { defaultToken: "meta.preprocessor.bro.load" }] }, { token: [ "meta.preprocessor.bro.if", "keyword.other.special-method.bro", "meta.preprocessor.bro.if" ], regex: /^(\s*)(\@endif|\@if(?:n?def)?)(.*$)/, push: [{ token: [], regex: /$/, next: "pop" }, { defaultToken: "meta.preprocessor.bro.if" }] }], "#disabled": [{ token: "text", regex: /^\s*\@if(?:n?def)?\b.*$/, push: [{ token: "text", regex: /^\s*\@endif\b.*$/, next: "pop" }, { include: "#disabled" }, { include: "#pragma-mark" }], comment: "eat nested preprocessor ifdefs" }], "#preprocessor-rule-other": [{ token: [ "text", "meta.preprocessor.bro", "meta.preprocessor.bro", "text" ], regex: /^(\s*)(@if)((?:n?def)?)\b(.*?)(?:(?=)|$)/, push: [{ token: ["text", "meta.preprocessor.bro", "text"], regex: /^(\s*)(@endif)\b(.*$)/, next: "pop" }, { include: "$base" }] }], "#string_escaped_char": [{ token: "constant.character.escape.bro", regex: /\\(?:\\|[abefnprtv'"?]|[0-3]\d{,2}|[4-7]\d?|x[a-fA-F0-9]{,2})/ }, { token: "invalid.illegal.unknown-escape.bro", regex: /\\./ }], "#string_placeholder": [{ token: "constant.other.placeholder.bro", regex: /%(?:\d+\$)?[#0\- +']*[,;:_]?(?:-?\d+|\*(?:-?\d+\$)?)?(?:\.(?:-?\d+|\*(?:-?\d+\$)?)?)?(?:hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?[diouxXDOUeEfFgGaACcSspn%]/ }, { token: "invalid.illegal.placeholder.bro", regex: /%/ }] }; this.normalizeRules(); }; BroHighlightRules.metaData = { fileTypes: ["bro"], foldingStartMarker: "^(\\@if(n?def)?)", foldingStopMarker: "^\\@endif", keyEquivalent: "@B", name: "Bro", scopeName: "source.bro" }; oop.inherits(BroHighlightRules, TextHighlightRules); exports.BroHighlightRules = BroHighlightRules; }); ================================================ FILE: lib/ace/mode/c9search.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var C9SearchHighlightRules = require("./c9search_highlight_rules").C9SearchHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var C9StyleFoldMode = require("./folding/c9search").FoldMode; var Mode = function() { this.HighlightRules = C9SearchHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.foldingRules = new C9StyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); return indent; }; this.checkOutdent = function(state, line, input) { return this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; this.$id = "ace/mode/c9search"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/c9search_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; function safeCreateRegexp(source, flag) { try { return new RegExp(source, flag); } catch(e) {} } var C9SearchHighlightRules = function() { // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { tokenNames : ["c9searchresults.constant.numeric", "c9searchresults.text", "c9searchresults.text", "c9searchresults.keyword"], regex : /(^\s+[0-9]+)(:)(\d*\s?)([^\r\n]+)/, onMatch : function(val, state, stack) { var values = this.splitRegex.exec(val); var types = this.tokenNames; var tokens = [{ type: types[0], value: values[1] }, { type: types[1], value: values[2] }]; if (values[3]) { if (values[3] == " ") tokens[1] = { type: types[1], value: values[2] + " " }; else tokens.push({ type: types[1], value: values[3] }); } var regex = stack[1]; var str = values[4]; var m; var last = 0; if (regex && regex.exec) { regex.lastIndex = 0; while (m = regex.exec(str)) { var skipped = str.substring(last, m.index); last = regex.lastIndex; if (skipped) tokens.push({type: types[2], value: skipped}); if (m[0]) tokens.push({type: types[3], value: m[0]}); else if (!skipped) break; } } if (last < str.length) tokens.push({type: types[2], value: str.substr(last)}); return tokens; } }, { regex : "^Searching for [^\\r\\n]*$", onMatch: function(val, state, stack) { var parts = val.split("\x01"); if (parts.length < 3) return "text"; var options, search; var i = 0; var tokens = [{ value: parts[i++] + "'", type: "text" }, { value: search = parts[i++], type: "text" // "c9searchresults.keyword" }, { value: "'" + parts[i++], type: "text" }]; // replaced if (parts[2] !== " in") { tokens.push({ value: "'" + parts[i++] + "'", type: "text" }, { value: parts[i++], type: "text" }); } // path tokens.push({ value: " " + parts[i++] + " ", type: "text" }); // options if (parts[i+1]) { options = parts[i+1]; tokens.push({ value: "(" + parts[i+1] + ")", type: "text" }); i += 1; } else { i -= 1; } while (i++ < parts.length) { parts[i] && tokens.push({ value: parts[i], type: "text" }); } if (search) { if (!/regex/.test(options)) search = lang.escapeRegExp(search); if (/whole/.test(options)) search = "\\b" + search + "\\b"; } var regex = search && safeCreateRegexp( "(" + search + ")", / sensitive/.test(options) ? "g" : "ig" ); if (regex) { stack[0] = state; stack[1] = regex; } return tokens; } }, { regex : "^(?=Found \\d+ matches)", token : "text", next : "numbers" }, { token : "string", // single line regex : "^\\S:?[^:]+", next : "numbers" } ], numbers:[{ regex : "\\d+", token : "constant.numeric" }, { regex : "$", token : "text", next : "start" }] }; this.normalizeRules(); }; oop.inherits(C9SearchHighlightRules, TextHighlightRules); exports.C9SearchHighlightRules = C9SearchHighlightRules; }); ================================================ FILE: lib/ace/mode/c_cpp.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var c_cppHighlightRules = require("./c_cpp_highlight_rules").c_cppHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var Range = require("../range").Range; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/cstyle").FoldMode; var Mode = function() { this.HighlightRules = c_cppHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; var endState = tokenizedLine.state; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } if (state == "start") { var match = line.match(/^.*[\{\(\[]\s*$/); if (match) { indent += tab; } } else if (state == "doc-start") { if (endState == "start") { return ""; } var match = line.match(/^\s*(\/?)\*/); if (match) { if (match[1]) { indent += " "; } indent += "* "; } } return indent; }; this.checkOutdent = function(state, line, input) { return this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; this.$id = "ace/mode/c_cpp"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/c_cpp_highlight_rules.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // used by objective-c var cFunctions = exports.cFunctions = "\\b(?:hypot(?:f|l)?|s(?:scanf|ystem|nprintf|ca(?:nf|lb(?:n(?:f|l)?|ln(?:f|l)?))|i(?:n(?:h(?:f|l)?|f|l)?|gn(?:al|bit))|tr(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?)|error|pbrk|ftime|len|rchr|xfrm)|printf|et(?:jmp|vbuf|locale|buf)|qrt(?:f|l)?|w(?:scanf|printf)|rand)|n(?:e(?:arbyint(?:f|l)?|xt(?:toward(?:f|l)?|after(?:f|l)?))|an(?:f|l)?)|c(?:s(?:in(?:h(?:f|l)?|f|l)?|qrt(?:f|l)?)|cos(?:h(?:f)?|f|l)?|imag(?:f|l)?|t(?:ime|an(?:h(?:f|l)?|f|l)?)|o(?:s(?:h(?:f|l)?|f|l)?|nj(?:f|l)?|pysign(?:f|l)?)|p(?:ow(?:f|l)?|roj(?:f|l)?)|e(?:il(?:f|l)?|xp(?:f|l)?)|l(?:o(?:ck|g(?:f|l)?)|earerr)|a(?:sin(?:h(?:f|l)?|f|l)?|cos(?:h(?:f|l)?|f|l)?|tan(?:h(?:f|l)?|f|l)?|lloc|rg(?:f|l)?|bs(?:f|l)?)|real(?:f|l)?|brt(?:f|l)?)|t(?:ime|o(?:upper|lower)|an(?:h(?:f|l)?|f|l)?|runc(?:f|l)?|gamma(?:f|l)?|mp(?:nam|file))|i(?:s(?:space|n(?:ormal|an)|cntrl|inf|digit|u(?:nordered|pper)|p(?:unct|rint)|finite|w(?:space|c(?:ntrl|type)|digit|upper|p(?:unct|rint)|lower|al(?:num|pha)|graph|xdigit|blank)|l(?:ower|ess(?:equal|greater)?)|al(?:num|pha)|gr(?:eater(?:equal)?|aph)|xdigit|blank)|logb(?:f|l)?|max(?:div|abs))|di(?:v|fftime)|_Exit|unget(?:c|wc)|p(?:ow(?:f|l)?|ut(?:s|c(?:har)?|wc(?:har)?)|error|rintf)|e(?:rf(?:c(?:f|l)?|f|l)?|x(?:it|p(?:2(?:f|l)?|f|l|m1(?:f|l)?)?))|v(?:s(?:scanf|nprintf|canf|printf|w(?:scanf|printf))|printf|f(?:scanf|printf|w(?:scanf|printf))|w(?:scanf|printf)|a_(?:start|copy|end|arg))|qsort|f(?:s(?:canf|e(?:tpos|ek))|close|tell|open|dim(?:f|l)?|p(?:classify|ut(?:s|c|w(?:s|c))|rintf)|e(?:holdexcept|set(?:e(?:nv|xceptflag)|round)|clearexcept|testexcept|of|updateenv|r(?:aiseexcept|ror)|get(?:e(?:nv|xceptflag)|round))|flush|w(?:scanf|ide|printf|rite)|loor(?:f|l)?|abs(?:f|l)?|get(?:s|c|pos|w(?:s|c))|re(?:open|e|ad|xp(?:f|l)?)|m(?:in(?:f|l)?|od(?:f|l)?|a(?:f|l|x(?:f|l)?)?))|l(?:d(?:iv|exp(?:f|l)?)|o(?:ngjmp|cal(?:time|econv)|g(?:1(?:p(?:f|l)?|0(?:f|l)?)|2(?:f|l)?|f|l|b(?:f|l)?)?)|abs|l(?:div|abs|r(?:int(?:f|l)?|ound(?:f|l)?))|r(?:int(?:f|l)?|ound(?:f|l)?)|gamma(?:f|l)?)|w(?:scanf|c(?:s(?:s(?:tr|pn)|nc(?:py|at|mp)|c(?:spn|hr|oll|py|at|mp)|to(?:imax|d|u(?:l(?:l)?|max)|k|f|l(?:d|l)?|mbs)|pbrk|ftime|len|r(?:chr|tombs)|xfrm)|to(?:b|mb)|rtomb)|printf|mem(?:set|c(?:hr|py|mp)|move))|a(?:s(?:sert|ctime|in(?:h(?:f|l)?|f|l)?)|cos(?:h(?:f|l)?|f|l)?|t(?:o(?:i|f|l(?:l)?)|exit|an(?:h(?:f|l)?|2(?:f|l)?|f|l)?)|b(?:s|ort))|g(?:et(?:s|c(?:har)?|env|wc(?:har)?)|mtime)|r(?:int(?:f|l)?|ound(?:f|l)?|e(?:name|alloc|wind|m(?:ove|quo(?:f|l)?|ainder(?:f|l)?))|a(?:nd|ise))|b(?:search|towc)|m(?:odf(?:f|l)?|em(?:set|c(?:hr|py|mp)|move)|ktime|alloc|b(?:s(?:init|towcs|rtowcs)|towc|len|r(?:towc|len))))\\b"; var c_cppHighlightRules = function() { var keywordControls = ( "break|case|continue|default|do|else|for|goto|if|_Pragma|" + "return|switch|while|catch|operator|try|throw|using" ); var storageType = ( "asm|__asm__|auto|bool|_Bool|char|_Complex|double|enum|float|" + "_Imaginary|int|long|short|signed|struct|typedef|union|unsigned|void|" + "class|wchar_t|template|char16_t|char32_t" ); var storageModifiers = ( "const|extern|register|restrict|static|volatile|inline|private|" + "protected|public|friend|explicit|virtual|export|mutable|typename|" + "constexpr|new|delete|alignas|alignof|decltype|noexcept|thread_local" ); var keywordOperators = ( "and|and_eq|bitand|bitor|compl|not|not_eq|or|or_eq|typeid|xor|xor_eq" + "const_cast|dynamic_cast|reinterpret_cast|static_cast|sizeof|namespace" ); var builtinConstants = ( "NULL|true|false|TRUE|FALSE|nullptr" ); var keywordMapper = this.$keywords = this.createKeywordMapper({ "keyword.control" : keywordControls, "storage.type" : storageType, "storage.modifier" : storageModifiers, "keyword.operator" : keywordOperators, "variable.language": "this", "constant.language": builtinConstants }, "identifier"); var identifierRe = "[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*\\b"; var escapeRe = /\\(?:['"?\\abfnrtv]|[0-7]{1,3}|x[a-fA-F\d]{2}|u[a-fA-F\d]{4}U[a-fA-F\d]{8}|.)/.source; var formatRe = "%" + /(\d+\$)?/.source // field (argument #) + /[#0\- +']*/.source // flags + /[,;:_]?/.source // separator character (AltiVec) + /((-?\d+)|\*(-?\d+\$)?)?/.source // minimum field width + /(\.((-?\d+)|\*(-?\d+\$)?)?)?/.source // precision + /(hh|h|ll|l|j|t|z|q|L|vh|vl|v|hv|hl)?/.source // length modifier + /(\[[^"\]]+\]|[diouxXDOUeEfFgGaACcSspn%])/.source; // conversion type // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "//$", next : "start" }, { token : "comment", regex : "//", next : "singleLineComment" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // character regex : "'(?:" + escapeRe + "|.)?'" }, { token : "string.start", regex : '"', stateName: "qqstring", next: [ { token: "string", regex: /\\\s*$/, next: "qqstring" }, { token: "constant.language.escape", regex: escapeRe }, { token: "constant.language.escape", regex: formatRe }, { token: "string.end", regex: '"|$', next: "start" }, { defaultToken: "string"} ] }, { token : "string.start", regex : 'R"\\(', stateName: "rawString", next: [ { token: "string.end", regex: '\\)"', next: "start" }, { defaultToken: "string"} ] }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?\\b" }, { token : "keyword", // pre-compiler directives regex : "#\\s*(?:include|import|pragma|line|define|undef)\\b", next : "directive" }, { token : "keyword", // special case pre-compiler directive regex : "#\\s*(?:endif|if|ifdef|else|elif|ifndef)\\b" }, { token : "support.function.C99.c", regex : cFunctions }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*" }, { token : "keyword.operator", regex : /--|\+\+|<<=|>>=|>>>=|<>|&&|\|\||\?:|[*%\/+\-&\^|~!<>=]=?/ }, { token : "punctuation.operator", regex : "\\?|\\:|\\,|\\;|\\." }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ], "singleLineComment" : [ { token : "comment", regex : /\\$/, next : "singleLineComment" }, { token : "comment", regex : /$/, next : "start" }, { defaultToken: "comment" } ], "directive" : [ { token : "constant.other.multiline", regex : /\\/ }, { token : "constant.other.multiline", regex : /.*\\/ }, { token : "constant.other", regex : "\\s*<.+?>", next : "start" }, { token : "constant.other", // single line regex : '\\s*["](?:(?:\\\\.)|(?:[^"\\\\]))*?["]', next : "start" }, { token : "constant.other", // single line regex : "\\s*['](?:(?:\\\\.)|(?:[^'\\\\]))*?[']", next : "start" }, // "\" implies multiline, while "/" implies comment { token : "constant.other", regex : /[^\\\/]+/, next : "start" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; oop.inherits(c_cppHighlightRules, TextHighlightRules); exports.c_cppHighlightRules = c_cppHighlightRules; }); ================================================ FILE: lib/ace/mode/cirru.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2014, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CirruHighlightRules = require("./cirru_highlight_rules").CirruHighlightRules; var CoffeeFoldMode = require("./folding/coffee").FoldMode; var Mode = function() { this.HighlightRules = CirruHighlightRules; this.foldingRules = new CoffeeFoldMode(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "--"; this.$id = "ace/mode/cirru"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/cirru_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2014, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; // see http://cirru.org for more about this language var CirruHighlightRules = function() { this.$rules = { start: [{ token: 'constant.numeric', regex: /[\d\.]+/ }, { token: 'comment.line.double-dash', regex: /--/, next: 'comment' }, { token: 'storage.modifier', regex: /\(/ }, { token: 'storage.modifier', regex: /,/, next: 'line' }, { token: 'support.function', regex: /[^\(\)"\s]+/, next: 'line' }, { token: 'string.quoted.double', regex: /"/, next: 'string' }, { token: 'storage.modifier', regex: /\)/ }], comment: [{ token: 'comment.line.double-dash', regex: / +[^\n]+/, next: 'start' }], string: [{ token: 'string.quoted.double', regex: /"/, next: 'line' }, { token: 'constant.character.escape', regex: /\\/, next: 'escape' }, { token: 'string.quoted.double', regex: /[^\\"]+/ }], escape: [{ token: 'constant.character.escape', regex: /./, next: 'string' }], line: [{ token: 'constant.numeric', regex: /[\d\.]+/ }, { token: 'markup.raw', regex: /^\s*/, next: 'start' }, { token: 'storage.modifier', regex: /\$/, next: 'start' }, { token: 'variable.parameter', regex: /[^\(\)"\s]+/ }, { token: 'storage.modifier', regex: /\(/, next: 'start' }, { token: 'storage.modifier', regex: /\)/ }, { token: 'markup.raw', regex: /^ */, next: 'start' }, { token: 'string.quoted.double', regex: /"/, next: 'string' }] }; }; oop.inherits(CirruHighlightRules, TextHighlightRules); exports.CirruHighlightRules = CirruHighlightRules; }); ================================================ FILE: lib/ace/mode/clojure.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var ClojureHighlightRules = require("./clojure_highlight_rules").ClojureHighlightRules; var MatchingParensOutdent = require("./matching_parens_outdent").MatchingParensOutdent; var Mode = function() { this.HighlightRules = ClojureHighlightRules; this.$outdent = new MatchingParensOutdent(); this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.minorIndentFunctions = ["defn", "defn-", "defmacro", "def", "deftest", "testing"]; this.$toIndent = function(str) { return str.split('').map(function(ch) { if (/\s/.exec(ch)) { return ch; } else { return ' '; } }).join(''); }; this.$calculateIndent = function(line, tab) { var baseIndent = this.$getIndent(line); var delta = 0; var isParen, ch; // Walk back from end of line, find matching braces for (var i = line.length - 1; i >= 0; i--) { ch = line[i]; if (ch === '(') { delta--; isParen = true; } else if (ch === '(' || ch === '[' || ch === '{') { delta--; isParen = false; } else if (ch === ')' || ch === ']' || ch === '}') { delta++; } if (delta < 0) { break; } } if (delta < 0 && isParen) { // Were more brackets opened than closed and was a ( left open? i += 1; var iBefore = i; var fn = ''; while (true) { ch = line[i]; if (ch === ' ' || ch === '\t') { if(this.minorIndentFunctions.indexOf(fn) !== -1) { return this.$toIndent(line.substring(0, iBefore - 1) + tab); } else { return this.$toIndent(line.substring(0, i + 1)); } } else if (ch === undefined) { return this.$toIndent(line.substring(0, iBefore - 1) + tab); } fn += line[i]; i++; } } else if(delta < 0 && !isParen) { // Were more brackets openend than closed and was it not a (? return this.$toIndent(line.substring(0, i+1)); } else if(delta > 0) { // Mere more brackets closed than opened? Outdent. baseIndent = baseIndent.substring(0, baseIndent.length - tab.length); return baseIndent; } else { // Were they nicely matched? Just indent like line before. return baseIndent; } }; this.getNextLineIndent = function(state, line, tab) { return this.$calculateIndent(line, tab); }; this.checkOutdent = function(state, line, input) { return this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; this.$id = "ace/mode/clojure"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/clojure_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var ClojureHighlightRules = function() { var builtinFunctions = ( '* *1 *2 *3 *agent* *allow-unresolved-vars* *assert* *clojure-version* ' + '*command-line-args* *compile-files* *compile-path* *e *err* *file* ' + '*flush-on-newline* *in* *macro-meta* *math-context* *ns* *out* ' + '*print-dup* *print-length* *print-level* *print-meta* *print-readably* ' + '*read-eval* *source-path* *use-context-classloader* ' + '*warn-on-reflection* + - -> ->> .. / < <= = ' + '== > > >= >= accessor aclone ' + 'add-classpath add-watch agent agent-errors aget alength alias all-ns ' + 'alter alter-meta! alter-var-root amap ancestors and apply areduce ' + 'array-map aset aset-boolean aset-byte aset-char aset-double aset-float ' + 'aset-int aset-long aset-short assert assoc assoc! assoc-in associative? ' + 'atom await await-for await1 bases bean bigdec bigint binding bit-and ' + 'bit-and-not bit-clear bit-flip bit-not bit-or bit-set bit-shift-left ' + 'bit-shift-right bit-test bit-xor boolean boolean-array booleans ' + 'bound-fn bound-fn* butlast byte byte-array bytes cast char char-array ' + 'char-escape-string char-name-string char? chars chunk chunk-append ' + 'chunk-buffer chunk-cons chunk-first chunk-next chunk-rest chunked-seq? ' + 'class class? clear-agent-errors clojure-version coll? comment commute ' + 'comp comparator compare compare-and-set! compile complement concat cond ' + 'condp conj conj! cons constantly construct-proxy contains? count ' + 'counted? create-ns create-struct cycle dec decimal? declare definline ' + 'defmacro defmethod defmulti defn defn- defonce defstruct delay delay? ' + 'deliver deref derive descendants destructure disj disj! dissoc dissoc! ' + 'distinct distinct? doall doc dorun doseq dosync dotimes doto double ' + 'double-array doubles drop drop-last drop-while empty empty? ensure ' + 'enumeration-seq eval even? every? false? ffirst file-seq filter find ' + 'find-doc find-ns find-var first float float-array float? floats flush ' + 'fn fn? fnext for force format future future-call future-cancel ' + 'future-cancelled? future-done? future? gen-class gen-interface gensym ' + 'get get-in get-method get-proxy-class get-thread-bindings get-validator ' + 'hash hash-map hash-set identical? identity if-let if-not ifn? import ' + 'in-ns inc init-proxy instance? int int-array integer? interleave intern ' + 'interpose into into-array ints io! isa? iterate iterator-seq juxt key ' + 'keys keyword keyword? last lazy-cat lazy-seq let letfn line-seq list ' + 'list* list? load load-file load-reader load-string loaded-libs locking ' + 'long long-array longs loop macroexpand macroexpand-1 make-array ' + 'make-hierarchy map map? mapcat max max-key memfn memoize merge ' + 'merge-with meta method-sig methods min min-key mod name namespace neg? ' + 'newline next nfirst nil? nnext not not-any? not-empty not-every? not= ' + 'ns ns-aliases ns-imports ns-interns ns-map ns-name ns-publics ' + 'ns-refers ns-resolve ns-unalias ns-unmap nth nthnext num number? odd? ' + 'or parents partial partition pcalls peek persistent! pmap pop pop! ' + 'pop-thread-bindings pos? pr pr-str prefer-method prefers ' + 'primitives-classnames print print-ctor print-doc print-dup print-method ' + 'print-namespace-doc print-simple print-special-doc print-str printf ' + 'println println-str prn prn-str promise proxy proxy-call-with-super ' + 'proxy-mappings proxy-name proxy-super push-thread-bindings pvalues quot ' + 'rand rand-int range ratio? rational? rationalize re-find re-groups ' + 're-matcher re-matches re-pattern re-seq read read-line read-string ' + 'reduce ref ref-history-count ref-max-history ref-min-history ref-set ' + 'refer refer-clojure release-pending-sends rem remove remove-method ' + 'remove-ns remove-watch repeat repeatedly replace replicate require ' + 'reset! reset-meta! resolve rest resultset-seq reverse reversible? rseq ' + 'rsubseq second select-keys send send-off seq seq? seque sequence ' + 'sequential? set set-validator! set? short short-array shorts ' + 'shutdown-agents slurp some sort sort-by sorted-map sorted-map-by ' + 'sorted-set sorted-set-by sorted? special-form-anchor special-symbol? ' + 'split-at split-with str stream? string? struct struct-map subs subseq ' + 'subvec supers swap! symbol symbol? sync syntax-symbol-anchor take ' + 'take-last take-nth take-while test the-ns time to-array to-array-2d ' + 'trampoline transient tree-seq true? type unchecked-add unchecked-dec ' + 'unchecked-divide unchecked-inc unchecked-multiply unchecked-negate ' + 'unchecked-remainder unchecked-subtract underive unquote ' + 'unquote-splicing update-in update-proxy use val vals var-get var-set ' + 'var? vary-meta vec vector vector? when when-first when-let when-not ' + 'while with-bindings with-bindings* with-in-str with-loading-context ' + 'with-local-vars with-meta with-open with-out-str with-precision xml-seq ' + 'zero? zipmap' ); var keywords = ('throw try var ' + 'def do fn if let loop monitor-enter monitor-exit new quote recur set!' ); var buildinConstants = ("true false nil"); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "constant.language": buildinConstants, "support.function": builtinFunctions }, "identifier", false, " "); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : ";.*$" }, { token : "keyword", //parens regex : "[\\(|\\)]" }, { token : "keyword", //lists regex : "[\\'\\(]" }, { token : "keyword", //vectors regex : "[\\[|\\]]" }, { token : "keyword", //sets and maps regex : "[\\{|\\}|\\#\\{|\\#\\}]" }, { token : "keyword", // ampersands regex : '[\\&]' }, { token : "keyword", // metadata regex : '[\\#\\^\\{]' }, { token : "keyword", // anonymous fn syntactic sugar regex : '[\\%]' }, { token : "keyword", // deref reader macro regex : '[@]' }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : "constant.language", regex : '[!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+||=|!=|<=|>=|<>|<|>|!|&&]' }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$\\-]*\\b" }, { token : "string", // single line regex : '"', next: "string" }, { token : "constant", // symbol regex : /:[^()\[\]{}'"\^%`,;\s]+/ }, { token : "string.regexp", //Regular Expressions regex : '/#"(?:\\.|(?:\\")|[^""\n])*"/g' } ], "string" : [ { token : "constant.language.escape", regex : "\\\\.|\\\\$" }, { token : "string", regex : '[^"\\\\]+' }, { token : "string", regex : '"', next : "start" } ] }; }; oop.inherits(ClojureHighlightRules, TextHighlightRules); exports.ClojureHighlightRules = ClojureHighlightRules; }); ================================================ FILE: lib/ace/mode/cobol.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CobolHighlightRules = require("./cobol_highlight_rules").CobolHighlightRules; var Mode = function() { this.HighlightRules = CobolHighlightRules; this.$behaviour = this.$defaultBehaviour; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "*"; this.$id = "ace/mode/cobol"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/cobol_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CobolHighlightRules = function() { var keywords = "ACCEPT|MERGE|SUM|ADD||MESSAGE|TABLE|ADVANCING|MODE|TAPE|" + "AFTER|MULTIPLY|TEST|ALL|NEGATIVE|TEXT|ALPHABET|NEXT|THAN|" + "ALSO|NO|THEN|ALTERNATE|NOT|THROUGH|AND|NUMBER|THRU|ANY|OCCURS|" + "TIME|ARE|OF|TO|AREA|OFF|TOP||ASCENDING|OMITTED|TRUE|ASSIGN|ON|TYPE|AT|OPEN|" + "UNIT|AUTHOR|OR|UNTIL|BEFORE|OTHER|UP|BLANK|OUTPUT|USE|BLOCK|PAGE|USING|BOTTOM|" + "PERFORM|VALUE|BY|PIC|VALUES|CALL|PICTURE|WHEN|CANCEL|PLUS|WITH|CD|POINTER|WRITE|" + "CHARACTER|POSITION||ZERO|CLOSE|POSITIVE|ZEROS|COLUMN|PROCEDURE|ZEROES|COMMA|PROGRAM|" + "COMMON|PROGRAM-ID|COMMUNICATION|QUOTE|COMP|RANDOM|COMPUTE|READ|CONTAINS|RECEIVE|CONFIGURATION|" + "RECORD|CONTINUE|REDEFINES|CONTROL|REFERENCE|COPY|REMAINDER|COUNT|REPLACE|DATA|REPORT|DATE|RESERVE|" + "DAY|RESET|DELETE|RETURN|DESTINATION|REWIND|DISABLE|REWRITE|DISPLAY|RIGHT|DIVIDE|RUN|DOWN|SAME|" + "ELSE|SEARCH|ENABLE|SECTION|END|SELECT|ENVIRONMENT|SENTENCE|EQUAL|SET|ERROR|SIGN|EXIT|SEQUENTIAL|" + "EXTERNAL|SIZE|FLASE|SORT|FILE|SOURCE|LENGTH|SPACE|LESS|STANDARD|LIMIT|START|LINE|STOP|LOCK|STRING|LOW-VALUE|SUBTRACT"; var builtinConstants = ( "true|false|null" ); var builtinFunctions = ( "count|min|max|avg|sum|rank|now|coalesce|main" ); var keywordMapper = this.createKeywordMapper({ "support.function": builtinFunctions, "keyword": keywords, "constant.language": builtinConstants }, "identifier", true); this.$rules = { "start" : [ { token : "comment", regex : "\\*.*$" }, { token : "string", // " string regex : '".*?"' }, { token : "string", // ' string regex : "'.*?'" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "\\+|\\-|\\/|\\/\\/|%|<@>|@>|<@|&|\\^|~|<|>|<=|=>|==|!=|<>|=" }, { token : "paren.lparen", regex : "[\\(]" }, { token : "paren.rparen", regex : "[\\)]" }, { token : "text", regex : "\\s+" } ] }; }; oop.inherits(CobolHighlightRules, TextHighlightRules); exports.CobolHighlightRules = CobolHighlightRules; }); ================================================ FILE: lib/ace/mode/coffee/coffee.js ================================================ define(function(require, exports, module) { function define(f) { module.exports = f() }; define.amd = {}; /** * CoffeeScript Compiler v1.9.3 * http://coffeescript.org * * Copyright 2011, Jeremy Ashkenas * Released under the MIT License */ (function(root){var CoffeeScript=function(){function _dereq_(e){return _dereq_[e]}return _dereq_["./helpers"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o;e.starts=function(e,t,n){return t===e.substr(n,t.length)},e.ends=function(e,t,n){var i;return i=t.length,t===e.substr(e.length-i-(n||0),i)},e.repeat=s=function(e,t){var n;for(n="";t>0;)1&t&&(n+=e),t>>>=1,e+=e;return n},e.compact=function(e){var t,n,i,r;for(r=[],t=0,i=e.length;i>t;t++)n=e[t],n&&r.push(n);return r},e.count=function(e,t){var n,i;if(n=i=0,!t.length)return 1/0;for(;i=1+e.indexOf(t,i);)n++;return n},e.merge=function(e,t){return n(n({},e),t)},n=e.extend=function(e,t){var n,i;for(n in t)i=t[n],e[n]=i;return e},e.flatten=i=function(e){var t,n,r,s;for(n=[],r=0,s=e.length;s>r;r++)t=e[r],t instanceof Array?n=n.concat(i(t)):n.push(t);return n},e.del=function(e,t){var n;return n=e[t],delete e[t],n},e.some=null!=(r=Array.prototype.some)?r:function(e){var t,n,i;for(n=0,i=this.length;i>n;n++)if(t=this[n],e(t))return!0;return!1},e.invertLiterate=function(e){var t,n,i;return i=!0,n=function(){var n,r,s,o;for(s=e.split("\n"),o=[],n=0,r=s.length;r>n;n++)t=s[n],i&&/^([ ]{4}|[ ]{0,3}\t)/.test(t)?o.push(t):(i=/^\s*$/.test(t))?o.push(t):o.push("# "+t);return o}(),n.join("\n")},t=function(e,t){return t?{first_line:e.first_line,first_column:e.first_column,last_line:t.last_line,last_column:t.last_column}:e},e.addLocationDataFn=function(e,n){return function(i){return"object"==typeof i&&i.updateLocationDataIfMissing&&i.updateLocationDataIfMissing(t(e,n)),i}},e.locationDataToString=function(e){var t;return"2"in e&&"first_line"in e[2]?t=e[2]:"first_line"in e&&(t=e),t?t.first_line+1+":"+(t.first_column+1)+"-"+(t.last_line+1+":"+(t.last_column+1)):"No location data"},e.baseFileName=function(e,t,n){var i,r;return null==t&&(t=!1),null==n&&(n=!1),r=n?/\\|\//:/\//,i=e.split(r),e=i[i.length-1],t&&e.indexOf(".")>=0?(i=e.split("."),i.pop(),"coffee"===i[i.length-1]&&i.length>1&&i.pop(),i.join(".")):e},e.isCoffee=function(e){return/\.((lit)?coffee|coffee\.md)$/.test(e)},e.isLiterate=function(e){return/\.(litcoffee|coffee\.md)$/.test(e)},e.throwSyntaxError=function(e,t){var n;throw n=new SyntaxError(e),n.location=t,n.toString=o,n.stack=""+n,n},e.updateSyntaxError=function(e,t,n){return e.toString===o&&(e.code||(e.code=t),e.filename||(e.filename=n),e.stack=""+e),e},o=function(){var e,t,n,i,r,o,a,c,h,l,u,p,d,f,m;return this.code&&this.location?(u=this.location,a=u.first_line,o=u.first_column,h=u.last_line,c=u.last_column,null==h&&(h=a),null==c&&(c=o),r=this.filename||"[stdin]",e=this.code.split("\n")[a],m=o,i=a===h?c+1:e.length,l=e.slice(0,m).replace(/[^\s]/g," ")+s("^",i-m),"undefined"!=typeof process&&null!==process&&(n=(null!=(p=process.stdout)?p.isTTY:void 0)&&!(null!=(d=process.env)?d.NODE_DISABLE_COLORS:void 0)),(null!=(f=this.colorful)?f:n)&&(t=function(e){return""+e+""},e=e.slice(0,m)+t(e.slice(m,i))+e.slice(i),l=t(l)),r+":"+(a+1)+":"+(o+1)+": error: "+this.message+"\n"+e+"\n"+l):Error.prototype.toString.call(this)},e.nameWhitespaceCharacter=function(e){switch(e){case" ":return"space";case"\n":return"newline";case"\r":return"carriage return";case" ":return"tab";default:return e}}}.call(this),t.exports}(),_dereq_["./rewriter"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b,k=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1},w=[].slice;for(f=function(e,t,n){var i;return i=[e,t],i.generated=!0,n&&(i.origin=n),i},e.Rewriter=function(){function e(){}return e.prototype.rewrite=function(e){return this.tokens=e,this.removeLeadingNewlines(),this.closeOpenCalls(),this.closeOpenIndexes(),this.normalizeLines(),this.tagPostfixConditionals(),this.addImplicitBracesAndParens(),this.addLocationDataToGeneratedTokens(),this.tokens},e.prototype.scanTokens=function(e){var t,n,i;for(i=this.tokens,t=0;n=i[t];)t+=e.call(this,n,t,i);return!0},e.prototype.detectEnd=function(e,t,n){var i,o,a,c,h;for(h=this.tokens,i=0;c=h[e];){if(0===i&&t.call(this,c,e))return n.call(this,c,e);if(!c||0>i)return n.call(this,c,e-1);o=c[0],k.call(s,o)>=0?i+=1:(a=c[0],k.call(r,a)>=0&&(i-=1)),e+=1}return e-1},e.prototype.removeLeadingNewlines=function(){var e,t,n,i,r;for(i=this.tokens,e=t=0,n=i.length;n>t&&(r=i[e][0],"TERMINATOR"===r);e=++t);return e?this.tokens.splice(0,e):void 0},e.prototype.closeOpenCalls=function(){var e,t;return t=function(e,t){var n;return")"===(n=e[0])||"CALL_END"===n||"OUTDENT"===e[0]&&")"===this.tag(t-1)},e=function(e,t){return this.tokens["OUTDENT"===e[0]?t-1:t][0]="CALL_END"},this.scanTokens(function(n,i){return"CALL_START"===n[0]&&this.detectEnd(i+1,t,e),1})},e.prototype.closeOpenIndexes=function(){var e,t;return t=function(e){var t;return"]"===(t=e[0])||"INDEX_END"===t},e=function(e){return e[0]="INDEX_END"},this.scanTokens(function(n,i){return"INDEX_START"===n[0]&&this.detectEnd(i+1,t,e),1})},e.prototype.indexOfTag=function(){var e,t,n,i,r,s,o;for(t=arguments[0],r=arguments.length>=2?w.call(arguments,1):[],e=0,n=i=0,s=r.length;s>=0?s>i:i>s;n=s>=0?++i:--i){for(;"HERECOMMENT"===this.tag(t+n+e);)e+=2;if(null!=r[n]&&("string"==typeof r[n]&&(r[n]=[r[n]]),o=this.tag(t+n+e),0>k.call(r[n],o)))return-1}return t+n+e-1},e.prototype.looksObjectish=function(e){var t,n;return this.indexOfTag(e,"@",null,":")>-1||this.indexOfTag(e,null,":")>-1?!0:(n=this.indexOfTag(e,s),n>-1&&(t=null,this.detectEnd(n+1,function(e){var t;return t=e[0],k.call(r,t)>=0},function(e,n){return t=n}),":"===this.tag(t+1))?!0:!1)},e.prototype.findTagsBackwards=function(e,t){var n,i,o,a,c,h,l;for(n=[];e>=0&&(n.length||(a=this.tag(e),0>k.call(t,a)&&(c=this.tag(e),0>k.call(s,c)||this.tokens[e].generated)&&(h=this.tag(e),0>k.call(u,h))));)i=this.tag(e),k.call(r,i)>=0&&n.push(this.tag(e)),o=this.tag(e),k.call(s,o)>=0&&n.length&&n.pop(),e-=1;return l=this.tag(e),k.call(t,l)>=0},e.prototype.addImplicitBracesAndParens=function(){var e,t;return e=[],t=null,this.scanTokens(function(i,l,p){var d,m,g,v,y,b,w,T,C,E,F,N,L,x,S,D,R,A,I,_,O,$,j,M,B,V,P,U;if(U=i[0],F=(N=l>0?p[l-1]:[])[0],C=(p.length-1>l?p[l+1]:[])[0],j=function(){return e[e.length-1]},M=l,g=function(e){return l-M+e},v=function(){var e,t;return null!=(e=j())?null!=(t=e[2])?t.ours:void 0:void 0},y=function(){var e;return v()&&"("===(null!=(e=j())?e[0]:void 0)},w=function(){var e;return v()&&"{"===(null!=(e=j())?e[0]:void 0)},b=function(){var e;return v&&"CONTROL"===(null!=(e=j())?e[0]:void 0)},B=function(t){var n;return n=null!=t?t:l,e.push(["(",n,{ours:!0}]),p.splice(n,0,f("CALL_START","(")),null==t?l+=1:void 0},d=function(){return e.pop(),p.splice(l,0,f("CALL_END",")",["","end of input",i[2]])),l+=1},V=function(t,n){var r,s;return null==n&&(n=!0),r=null!=t?t:l,e.push(["{",r,{sameLine:!0,startsLine:n,ours:!0}]),s=new String("{"),s.generated=!0,p.splice(r,0,f("{",s,i)),null==t?l+=1:void 0},m=function(t){return t=null!=t?t:l,e.pop(),p.splice(t,0,f("}","}",i)),l+=1},y()&&("IF"===U||"TRY"===U||"FINALLY"===U||"CATCH"===U||"CLASS"===U||"SWITCH"===U))return e.push(["CONTROL",l,{ours:!0}]),g(1);if("INDENT"===U&&v()){if("=>"!==F&&"->"!==F&&"["!==F&&"("!==F&&","!==F&&"{"!==F&&"TRY"!==F&&"ELSE"!==F&&"="!==F)for(;y();)d();return b()&&e.pop(),e.push([U,l]),g(1)}if(k.call(s,U)>=0)return e.push([U,l]),g(1);if(k.call(r,U)>=0){for(;v();)y()?d():w()?m():e.pop();t=e.pop()}if((k.call(c,U)>=0&&i.spaced||"?"===U&&l>0&&!p[l-1].spaced)&&(k.call(o,C)>=0||k.call(h,C)>=0&&!(null!=(L=p[l+1])?L.spaced:void 0)&&!(null!=(x=p[l+1])?x.newLine:void 0)))return"?"===U&&(U=i[0]="FUNC_EXIST"),B(l+1),g(2);if(k.call(c,U)>=0&&this.indexOfTag(l+1,"INDENT")>-1&&this.looksObjectish(l+2)&&!this.findTagsBackwards(l,["CLASS","EXTENDS","IF","CATCH","SWITCH","LEADING_WHEN","FOR","WHILE","UNTIL"]))return B(l+1),e.push(["INDENT",l+2]),g(3);if(":"===U){for(I=function(){var e;switch(!1){case e=this.tag(l-1),0>k.call(r,e):return t[1];case"@"!==this.tag(l-2):return l-2;default:return l-1}}.call(this);"HERECOMMENT"===this.tag(I-2);)I-=2;return this.insideForDeclaration="FOR"===C,P=0===I||(S=this.tag(I-1),k.call(u,S)>=0)||p[I-1].newLine,j()&&(D=j(),$=D[0],O=D[1],("{"===$||"INDENT"===$&&"{"===this.tag(O-1))&&(P||","===this.tag(I-1)||"{"===this.tag(I-1)))?g(1):(V(I,!!P),g(2))}if(w()&&k.call(u,U)>=0&&(j()[2].sameLine=!1),T="OUTDENT"===F||N.newLine,k.call(a,U)>=0||k.call(n,U)>=0&&T)for(;v();)if(R=j(),$=R[0],O=R[1],A=R[2],_=A.sameLine,P=A.startsLine,y()&&","!==F)d();else if(w()&&!this.insideForDeclaration&&_&&"TERMINATOR"!==U&&":"!==F)m();else{if(!w()||"TERMINATOR"!==U||","===F||P&&this.looksObjectish(l+1))break;if("HERECOMMENT"===C)return g(1);m()}if(!(","!==U||this.looksObjectish(l+1)||!w()||this.insideForDeclaration||"TERMINATOR"===C&&this.looksObjectish(l+2)))for(E="OUTDENT"===C?1:0;w();)m(l+E);return g(1)})},e.prototype.addLocationDataToGeneratedTokens=function(){return this.scanTokens(function(e,t,n){var i,r,s,o,a,c;return e[2]?1:e.generated||e.explicit?("{"===e[0]&&(s=null!=(a=n[t+1])?a[2]:void 0)?(r=s.first_line,i=s.first_column):(o=null!=(c=n[t-1])?c[2]:void 0)?(r=o.last_line,i=o.last_column):r=i=0,e[2]={first_line:r,first_column:i,last_line:r,last_column:i},1):1})},e.prototype.normalizeLines=function(){var e,t,r,s,o;return o=r=s=null,t=function(e,t){var r,s,a,c;return";"!==e[1]&&(r=e[0],k.call(p,r)>=0)&&!("TERMINATOR"===e[0]&&(s=this.tag(t+1),k.call(i,s)>=0))&&!("ELSE"===e[0]&&"THEN"!==o)&&!!("CATCH"!==(a=e[0])&&"FINALLY"!==a||"->"!==o&&"=>"!==o)||(c=e[0],k.call(n,c)>=0&&this.tokens[t-1].newLine)},e=function(e,t){return this.tokens.splice(","===this.tag(t-1)?t-1:t,0,s)},this.scanTokens(function(n,a,c){var h,l,u,p,f,m;if(m=n[0],"TERMINATOR"===m){if("ELSE"===this.tag(a+1)&&"OUTDENT"!==this.tag(a-1))return c.splice.apply(c,[a,1].concat(w.call(this.indentation()))),1;if(u=this.tag(a+1),k.call(i,u)>=0)return c.splice(a,1),0}if("CATCH"===m)for(h=l=1;2>=l;h=++l)if("OUTDENT"===(p=this.tag(a+h))||"TERMINATOR"===p||"FINALLY"===p)return c.splice.apply(c,[a+h,0].concat(w.call(this.indentation()))),2+h;return k.call(d,m)>=0&&"INDENT"!==this.tag(a+1)&&("ELSE"!==m||"IF"!==this.tag(a+1))?(o=m,f=this.indentation(c[a]),r=f[0],s=f[1],"THEN"===o&&(r.fromThen=!0),c.splice(a+1,0,r),this.detectEnd(a+2,t,e),"THEN"===m&&c.splice(a,1),1):1})},e.prototype.tagPostfixConditionals=function(){var e,t,n;return n=null,t=function(e,t){var n,i;return i=e[0],n=this.tokens[t-1][0],"TERMINATOR"===i||"INDENT"===i&&0>k.call(d,n)},e=function(e){return"INDENT"!==e[0]||e.generated&&!e.fromThen?n[0]="POST_"+n[0]:void 0},this.scanTokens(function(i,r){return"IF"!==i[0]?1:(n=i,this.detectEnd(r+1,t,e),1)})},e.prototype.indentation=function(e){var t,n;return t=["INDENT",2],n=["OUTDENT",2],e?(t.generated=n.generated=!0,t.origin=n.origin=e):t.explicit=n.explicit=!0,[t,n]},e.prototype.generate=f,e.prototype.tag=function(e){var t;return null!=(t=this.tokens[e])?t[0]:void 0},e}(),t=[["(",")"],["[","]"],["{","}"],["INDENT","OUTDENT"],["CALL_START","CALL_END"],["PARAM_START","PARAM_END"],["INDEX_START","INDEX_END"],["STRING_START","STRING_END"],["REGEX_START","REGEX_END"]],e.INVERSES=l={},s=[],r=[],m=0,v=t.length;v>m;m++)y=t[m],g=y[0],b=y[1],s.push(l[b]=g),r.push(l[g]=b);i=["CATCH","THEN","ELSE","FINALLY"].concat(r),c=["IDENTIFIER","SUPER",")","CALL_END","]","INDEX_END","@","THIS"],o=["IDENTIFIER","NUMBER","STRING","STRING_START","JS","REGEX","REGEX_START","NEW","PARAM_START","CLASS","IF","TRY","SWITCH","THIS","BOOL","NULL","UNDEFINED","UNARY","YIELD","UNARY_MATH","SUPER","THROW","@","->","=>","[","(","{","--","++"],h=["+","-"],a=["POST_IF","FOR","WHILE","UNTIL","WHEN","BY","LOOP","TERMINATOR"],d=["ELSE","->","=>","TRY","FINALLY","THEN"],p=["TERMINATOR","CATCH","FINALLY","ELSE","OUTDENT","LEADING_WHEN"],u=["TERMINATOR","INDENT","OUTDENT"],n=[".","?.","::","?::"]}.call(this),t.exports}(),_dereq_["./lexer"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b,k,w,T,C,E,F,N,L,x,S,D,R,A,I,_,O,$,j,M,B,V,P,U,G,H,q,X,W,Y,K,z,J,Q,Z,et,tt,nt,it,rt,st,ot,at,ct,ht,lt,ut=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};ot=_dereq_("./rewriter"),P=ot.Rewriter,w=ot.INVERSES,at=_dereq_("./helpers"),nt=at.count,ht=at.starts,tt=at.compact,ct=at.repeat,it=at.invertLiterate,st=at.locationDataToString,lt=at.throwSyntaxError,e.Lexer=S=function(){function e(){}return e.prototype.tokenize=function(e,t){var n,i,r,s;for(null==t&&(t={}),this.literate=t.literate,this.indent=0,this.baseIndent=0,this.indebt=0,this.outdebt=0,this.indents=[],this.ends=[],this.tokens=[],this.chunkLine=t.line||0,this.chunkColumn=t.column||0,e=this.clean(e),r=0;this.chunk=e.slice(r);)if(n=this.identifierToken()||this.commentToken()||this.whitespaceToken()||this.lineToken()||this.stringToken()||this.numberToken()||this.regexToken()||this.jsToken()||this.literalToken(),s=this.getLineAndColumnFromChunk(n),this.chunkLine=s[0],this.chunkColumn=s[1],r+=n,t.untilBalanced&&0===this.ends.length)return{tokens:this.tokens,index:r};return this.closeIndentation(),(i=this.ends.pop())&&this.error("missing "+i.tag,i.origin[2]),t.rewrite===!1?this.tokens:(new P).rewrite(this.tokens)},e.prototype.clean=function(e){return e.charCodeAt(0)===t&&(e=e.slice(1)),e=e.replace(/\r/g,"").replace(z,""),et.test(e)&&(e="\n"+e,this.chunkLine--),this.literate&&(e=it(e)),e},e.prototype.identifierToken=function(){var e,t,n,i,r,c,h,l,u,p,d,f,m,g,y,b;return(l=v.exec(this.chunk))?(h=l[0],r=l[1],t=l[2],c=r.length,u=void 0,"own"===r&&"FOR"===this.tag()?(this.token("OWN",r),r.length):"from"===r&&"YIELD"===this.tag()?(this.token("FROM",r),r.length):(d=this.tokens,p=d[d.length-1],i=t||null!=p&&("."===(f=p[0])||"?."===f||"::"===f||"?::"===f||!p.spaced&&"@"===p[0]),y="IDENTIFIER",!i&&(ut.call(E,r)>=0||ut.call(a,r)>=0)&&(y=r.toUpperCase(),"WHEN"===y&&(m=this.tag(),ut.call(N,m)>=0)?y="LEADING_WHEN":"FOR"===y?this.seenFor=!0:"UNLESS"===y?y="IF":ut.call(J,y)>=0?y="UNARY":ut.call(B,y)>=0&&("INSTANCEOF"!==y&&this.seenFor?(y="FOR"+y,this.seenFor=!1):(y="RELATION","!"===this.value()&&(u=this.tokens.pop(),r="!"+r)))),ut.call(C,r)>=0&&(i?(y="IDENTIFIER",r=new String(r),r.reserved=!0):ut.call(V,r)>=0&&this.error("reserved word '"+r+"'",{length:r.length})),i||(ut.call(s,r)>=0&&(e=r,r=o[r]),y=function(){switch(r){case"!":return"UNARY";case"==":case"!=":return"COMPARE";case"&&":case"||":return"LOGIC";case"true":case"false":return"BOOL";case"break":case"continue":return"STATEMENT";default:return y}}()),b=this.token(y,r,0,c),e&&(b.origin=[y,e,b[2]]),b.variable=!i,u&&(g=[u[2].first_line,u[2].first_column],b[2].first_line=g[0],b[2].first_column=g[1]),t&&(n=h.lastIndexOf(":"),this.token(":",":",n,t.length)),h.length)):0},e.prototype.numberToken=function(){var e,t,n,i,r;return(n=I.exec(this.chunk))?(i=n[0],t=i.length,/^0[BOX]/.test(i)?this.error("radix prefix in '"+i+"' must be lowercase",{offset:1}):/E/.test(i)&&!/^0x/.test(i)?this.error("exponential notation in '"+i+"' must be indicated with a lowercase 'e'",{offset:i.indexOf("E")}):/^0\d*[89]/.test(i)?this.error("decimal literal '"+i+"' must not be prefixed with '0'",{length:t}):/^0\d+/.test(i)&&this.error("octal literal '"+i+"' must be prefixed with '0o'",{length:t}),(r=/^0o([0-7]+)/.exec(i))&&(i="0x"+parseInt(r[1],8).toString(16)),(e=/^0b([01]+)/.exec(i))&&(i="0x"+parseInt(e[1],2).toString(16)),this.token("NUMBER",i,0,t),t):0},e.prototype.stringToken=function(){var e,t,n,i,r,s,o,a,c,h,l,u,m,g,v,y;if(l=(Y.exec(this.chunk)||[])[0],!l)return 0;if(g=function(){switch(l){case"'":return W;case'"':return q;case"'''":return f;case'"""':return p}}(),s=3===l.length,u=this.matchWithInterpolations(g,l),y=u.tokens,r=u.index,e=y.length-1,n=l.charAt(0),s){for(a=null,i=function(){var e,t,n;for(n=[],o=e=0,t=y.length;t>e;o=++e)v=y[o],"NEOSTRING"===v[0]&&n.push(v[1]);return n}().join("#{}");h=d.exec(i);)t=h[1],(null===a||(m=t.length)>0&&a.length>m)&&(a=t);a&&(c=RegExp("^"+a,"gm")),this.mergeInterpolationTokens(y,{delimiter:n},function(t){return function(n,i){return n=t.formatString(n),0===i&&(n=n.replace(F,"")),i===e&&(n=n.replace(K,"")),c&&(n=n.replace(c,"")),n}}(this))}else this.mergeInterpolationTokens(y,{delimiter:n},function(t){return function(n,i){return n=t.formatString(n),n=n.replace(G,function(t,r){return 0===i&&0===r||i===e&&r+t.length===n.length?"":" "})}}(this));return r},e.prototype.commentToken=function(){var e,t,n;return(n=this.chunk.match(c))?(e=n[0],t=n[1],t&&((n=u.exec(e))&&this.error("block comments cannot contain "+n[0],{offset:n.index,length:n[0].length}),t.indexOf("\n")>=0&&(t=t.replace(RegExp("\\n"+ct(" ",this.indent),"g"),"\n")),this.token("HERECOMMENT",t,0,e.length)),e.length):0},e.prototype.jsToken=function(){var e,t;return"`"===this.chunk.charAt(0)&&(e=T.exec(this.chunk))?(this.token("JS",(t=e[0]).slice(1,-1),0,t.length),t.length):0},e.prototype.regexToken=function(){var e,t,n,r,s,o,a,c,h,l,u,p,d;switch(!1){case!(o=M.exec(this.chunk)):this.error("regular expressions cannot begin with "+o[2],{offset:o.index+o[1].length});break;case!(o=this.matchWithInterpolations(m,"///")):d=o.tokens,s=o.index;break;case!(o=$.exec(this.chunk)):if(p=o[0],e=o[1],t=o[2],this.validateEscapes(e,{isRegex:!0,offsetInChunk:1}),s=p.length,h=this.tokens,c=h[h.length-1],c)if(c.spaced&&(l=c[0],ut.call(i,l)>=0)){if(!t||O.test(p))return 0}else if(u=c[0],ut.call(A,u)>=0)return 0;t||this.error("missing / (unclosed regex)");break;default:return 0}switch(r=j.exec(this.chunk.slice(s))[0],n=s+r.length,a=this.makeToken("REGEX",null,0,n),!1){case!!Z.test(r):this.error("invalid regular expression flags "+r,{offset:s,length:r.length});break;case!(p||1===d.length):null==e&&(e=this.formatHeregex(d[0][1])),this.token("REGEX",""+this.makeDelimitedLiteral(e,{delimiter:"/"})+r,0,n,a);break;default:this.token("REGEX_START","(",0,0,a),this.token("IDENTIFIER","RegExp",0,0),this.token("CALL_START","(",0,0),this.mergeInterpolationTokens(d,{delimiter:'"',"double":!0},this.formatHeregex),r&&(this.token(",",",",s,0),this.token("STRING",'"'+r+'"',s,r.length)),this.token(")",")",n,0),this.token("REGEX_END",")",n,0)}return n},e.prototype.lineToken=function(){var e,t,n,i,r;if(!(n=R.exec(this.chunk)))return 0;if(t=n[0],this.seenFor=!1,r=t.length-1-t.lastIndexOf("\n"),i=this.unfinished(),r-this.indebt===this.indent)return i?this.suppressNewlines():this.newlineToken(0),t.length;if(r>this.indent){if(i)return this.indebt=r-this.indent,this.suppressNewlines(),t.length;if(!this.tokens.length)return this.baseIndent=this.indent=r,t.length;e=r-this.indent+this.outdebt,this.token("INDENT",e,t.length-r,r),this.indents.push(e),this.ends.push({tag:"OUTDENT"}),this.outdebt=this.indebt=0,this.indent=r}else this.baseIndent>r?this.error("missing indentation",{offset:t.length}):(this.indebt=0,this.outdentToken(this.indent-r,i,t.length));return t.length},e.prototype.outdentToken=function(e,t,n){var i,r,s,o;for(i=this.indent-e;e>0;)s=this.indents[this.indents.length-1],s?s===this.outdebt?(e-=this.outdebt,this.outdebt=0):this.outdebt>s?(this.outdebt-=s,e-=s):(r=this.indents.pop()+this.outdebt,n&&(o=this.chunk[n],ut.call(y,o)>=0)&&(i-=r-e,e=r),this.outdebt=0,this.pair("OUTDENT"),this.token("OUTDENT",e,0,n),e-=r):e=0;for(r&&(this.outdebt-=e);";"===this.value();)this.tokens.pop();return"TERMINATOR"===this.tag()||t||this.token("TERMINATOR","\n",n,0),this.indent=i,this},e.prototype.whitespaceToken=function(){var e,t,n,i;return(e=et.exec(this.chunk))||(t="\n"===this.chunk.charAt(0))?(i=this.tokens,n=i[i.length-1],n&&(n[e?"spaced":"newLine"]=!0),e?e[0].length:0):0},e.prototype.newlineToken=function(e){for(;";"===this.value();)this.tokens.pop();return"TERMINATOR"!==this.tag()&&this.token("TERMINATOR","\n",e,0),this},e.prototype.suppressNewlines=function(){return"\\"===this.value()&&this.tokens.pop(),this},e.prototype.literalToken=function(){var e,t,n,s,o,a,c,u,p,d;if((e=_.exec(this.chunk))?(d=e[0],r.test(d)&&this.tagParameters()):d=this.chunk.charAt(0),u=d,n=this.tokens,t=n[n.length-1],"="===d&&t&&(!t[1].reserved&&(s=t[1],ut.call(C,s)>=0)&&(t.origin&&(t=t.origin),this.error("reserved word '"+t[1]+"' can't be assigned",t[2])),"||"===(o=t[1])||"&&"===o))return t[0]="COMPOUND_ASSIGN",t[1]+="=",d.length;if(";"===d)this.seenFor=!1,u="TERMINATOR";else if(ut.call(D,d)>=0)u="MATH";else if(ut.call(h,d)>=0)u="COMPARE";else if(ut.call(l,d)>=0)u="COMPOUND_ASSIGN";else if(ut.call(J,d)>=0)u="UNARY";else if(ut.call(Q,d)>=0)u="UNARY_MATH";else if(ut.call(U,d)>=0)u="SHIFT";else if(ut.call(x,d)>=0||"?"===d&&(null!=t?t.spaced:void 0))u="LOGIC";else if(t&&!t.spaced)if("("===d&&(a=t[0],ut.call(i,a)>=0))"?"===t[0]&&(t[0]="FUNC_EXIST"),u="CALL_START";else if("["===d&&(c=t[0],ut.call(b,c)>=0))switch(u="INDEX_START",t[0]){case"?":t[0]="INDEX_SOAK"}switch(p=this.makeToken(u,d),d){case"(":case"{":case"[":this.ends.push({tag:w[d],origin:p});break;case")":case"}":case"]":this.pair(d)}return this.tokens.push(p),d.length},e.prototype.tagParameters=function(){var e,t,n,i;if(")"!==this.tag())return this;for(t=[],i=this.tokens,e=i.length,i[--e][0]="PARAM_END";n=i[--e];)switch(n[0]){case")":t.push(n);break;case"(":case"CALL_START":if(!t.length)return"("===n[0]?(n[0]="PARAM_START",this):this;t.pop()}return this},e.prototype.closeIndentation=function(){return this.outdentToken(this.indent)},e.prototype.matchWithInterpolations=function(t,n){var i,r,s,o,a,c,h,l,u,p,d,f,m,g,v;if(v=[],l=n.length,this.chunk.slice(0,l)!==n)return null;for(m=this.chunk.slice(l);;){if(g=t.exec(m)[0],this.validateEscapes(g,{isRegex:"/"===n.charAt(0),offsetInChunk:l}),v.push(this.makeToken("NEOSTRING",g,l)),m=m.slice(g.length),l+=g.length,"#{"!==m.slice(0,2))break;p=this.getLineAndColumnFromChunk(l+1),c=p[0],r=p[1],d=(new e).tokenize(m.slice(1),{line:c,column:r,untilBalanced:!0}),h=d.tokens,o=d.index,o+=1,u=h[0],i=h[h.length-1],u[0]=u[1]="(",i[0]=i[1]=")",i.origin=["","end of interpolation",i[2]],"TERMINATOR"===(null!=(f=h[1])?f[0]:void 0)&&h.splice(1,1),v.push(["TOKENS",h]),m=m.slice(o),l+=o}return m.slice(0,n.length)!==n&&this.error("missing "+n,{length:n.length}),s=v[0],a=v[v.length-1],s[2].first_column-=n.length,a[2].last_column+=n.length,0===a[1].length&&(a[2].last_column-=1),{tokens:v,index:l+n.length}},e.prototype.mergeInterpolationTokens=function(e,t,n){var i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y;for(e.length>1&&(u=this.token("STRING_START","(",0,0)),s=this.tokens.length,o=a=0,h=e.length;h>a;o=++a){switch(g=e[o],m=g[0],y=g[1],m){case"TOKENS":if(2===y.length)continue;l=y[0],v=y;break;case"NEOSTRING":if(i=n(g[1],o),0===i.length){if(0!==o)continue;r=this.tokens.length}2===o&&null!=r&&this.tokens.splice(r,2),g[0]="STRING",g[1]=this.makeDelimitedLiteral(i,t),l=g,v=[g]}this.tokens.length>s&&(p=this.token("+","+"),p[2]={first_line:l[2].first_line,first_column:l[2].first_column,last_line:l[2].first_line,last_column:l[2].first_column}),(d=this.tokens).push.apply(d,v)}return u?(c=e[e.length-1],u.origin=["STRING",null,{first_line:u[2].first_line,first_column:u[2].first_column,last_line:c[2].last_line,last_column:c[2].last_column}],f=this.token("STRING_END",")"),f[2]={first_line:c[2].last_line,first_column:c[2].last_column,last_line:c[2].last_line,last_column:c[2].last_column}):void 0},e.prototype.pair=function(e){var t,n,i,r,s;return i=this.ends,n=i[i.length-1],e!==(s=null!=n?n.tag:void 0)?("OUTDENT"!==s&&this.error("unmatched "+e),r=this.indents,t=r[r.length-1],this.outdentToken(t,!0),this.pair(e)):this.ends.pop()},e.prototype.getLineAndColumnFromChunk=function(e){var t,n,i,r,s;return 0===e?[this.chunkLine,this.chunkColumn]:(s=e>=this.chunk.length?this.chunk:this.chunk.slice(0,+(e-1)+1||9e9),i=nt(s,"\n"),t=this.chunkColumn,i>0?(r=s.split("\n"),n=r[r.length-1],t=n.length):t+=s.length,[this.chunkLine+i,t])},e.prototype.makeToken=function(e,t,n,i){var r,s,o,a,c;return null==n&&(n=0),null==i&&(i=t.length),s={},o=this.getLineAndColumnFromChunk(n),s.first_line=o[0],s.first_column=o[1],r=Math.max(0,i-1),a=this.getLineAndColumnFromChunk(n+r),s.last_line=a[0],s.last_column=a[1],c=[e,t,s]},e.prototype.token=function(e,t,n,i,r){var s;return s=this.makeToken(e,t,n,i),r&&(s.origin=r),this.tokens.push(s),s},e.prototype.tag=function(){var e,t;return e=this.tokens,t=e[e.length-1],null!=t?t[0]:void 0},e.prototype.value=function(){var e,t;return e=this.tokens,t=e[e.length-1],null!=t?t[1]:void 0},e.prototype.unfinished=function(){var e;return L.test(this.chunk)||"\\"===(e=this.tag())||"."===e||"?."===e||"?::"===e||"UNARY"===e||"MATH"===e||"UNARY_MATH"===e||"+"===e||"-"===e||"YIELD"===e||"**"===e||"SHIFT"===e||"RELATION"===e||"COMPARE"===e||"LOGIC"===e||"THROW"===e||"EXTENDS"===e},e.prototype.formatString=function(e){return e.replace(X,"$1")},e.prototype.formatHeregex=function(e){return e.replace(g,"$1$2")},e.prototype.validateEscapes=function(e,t){var n,i,r,s,o,a,c,h;return null==t&&(t={}),s=k.exec(e),!s||(s[0],n=s[1],a=s[2],i=s[3],h=s[4],t.isRegex&&a&&"0"!==a.charAt(0))?void 0:(o=a?"octal escape sequences are not allowed":"invalid escape sequence",r="\\"+(a||i||h),this.error(o+" "+r,{offset:(null!=(c=t.offsetInChunk)?c:0)+s.index+n.length,length:r.length}))},e.prototype.makeDelimitedLiteral=function(e,t){var n;return null==t&&(t={}),""===e&&"/"===t.delimiter&&(e="(?:)"),n=RegExp("(\\\\\\\\)|(\\\\0(?=[1-7]))|\\\\?("+t.delimiter+")|\\\\?(?:(\\n)|(\\r)|(\\u2028)|(\\u2029))|(\\\\.)","g"),e=e.replace(n,function(e,n,i,r,s,o,a,c,h){switch(!1){case!n:return t.double?n+n:n;case!i:return"\\x00";case!r:return"\\"+r;case!s:return"\\n";case!o:return"\\r";case!a:return"\\u2028";case!c:return"\\u2029";case!h:return t.double?"\\"+h:h}}),""+t.delimiter+e+t.delimiter},e.prototype.error=function(e,t){var n,i,r,s,o,a;return null==t&&(t={}),r="first_line"in t?t:(o=this.getLineAndColumnFromChunk(null!=(s=t.offset)?s:0),i=o[0],n=o[1],o,{first_line:i,first_column:n,last_column:n+(null!=(a=t.length)?a:1)-1}),lt(e,r)},e}(),E=["true","false","null","this","new","delete","typeof","in","instanceof","return","throw","break","continue","debugger","yield","if","else","switch","for","while","do","try","catch","finally","class","extends","super"],a=["undefined","then","unless","until","loop","of","by","when"],o={and:"&&",or:"||",is:"==",isnt:"!=",not:"!",yes:"true",no:"false",on:"true",off:"false"},s=function(){var e;e=[];for(rt in o)e.push(rt);return e}(),a=a.concat(s),V=["case","default","function","var","void","with","const","let","enum","export","import","native","implements","interface","package","private","protected","public","static"],H=["arguments","eval","yield*"],C=E.concat(V).concat(H),e.RESERVED=V.concat(E).concat(a).concat(H),e.STRICT_PROSCRIBED=H,t=65279,v=/^(?!\d)((?:(?!\s)[$\w\x7f-\uffff])+)([^\n\S]*:(?!:))?/,I=/^0b[01]+|^0o[0-7]+|^0x[\da-f]+|^\d*\.?\d+(?:e[+-]?\d+)?/i,_=/^(?:[-=]>|[-+*\/%<>&|^!?=]=|>>>=?|([-+:])\1|([&|<>*\/%])\2=?|\?(\.|::)|\.{2,3})/,et=/^[^\n\S]+/,c=/^###([^#][\s\S]*?)(?:###[^\n\S]*|###$)|^(?:\s*#(?!##[^#]).*)+/,r=/^[-=]>/,R=/^(?:\n[^\n\S]*)+/,T=/^`[^\\`]*(?:\\.[^\\`]*)*`/,Y=/^(?:'''|"""|'|")/,W=/^(?:[^\\']|\\[\s\S])*/,q=/^(?:[^\\"#]|\\[\s\S]|\#(?!\{))*/,f=/^(?:[^\\']|\\[\s\S]|'(?!''))*/,p=/^(?:[^\\"#]|\\[\s\S]|"(?!"")|\#(?!\{))*/,X=/((?:\\\\)+)|\\[^\S\n]*\n\s*/g,G=/\s*\n\s*/g,d=/\n+([^\n\S]*)(?=\S)/g,$=/^\/(?!\/)((?:[^[\/\n\\]|\\[^\n]|\[(?:\\[^\n]|[^\]\n\\])*\])*)(\/)?/,j=/^\w*/,Z=/^(?!.*(.).*\1)[imgy]*$/,m=/^(?:[^\\\/#]|\\[\s\S]|\/(?!\/\/)|\#(?!\{))*/,g=/((?:\\\\)+)|\\(\s)|\s+(?:#.*)?/g,M=/^(\/|\/{3}\s*)(\*)/,O=/^\/=?\s/,u=/\*\//,L=/^\s*(?:,|\??\.(?![.\d])|::)/,k=/((?:^|[^\\])(?:\\\\)*)\\(?:(0[0-7]|[1-7])|(x(?![\da-fA-F]{2}).{0,2})|(u(?![\da-fA-F]{4}).{0,4}))/,F=/^[^\n\S]*\n/,K=/\n[^\n\S]*$/,z=/\s+$/,l=["-=","+=","/=","*=","%=","||=","&&=","?=","<<=",">>=",">>>=","&=","^=","|=","**=","//=","%%="],J=["NEW","TYPEOF","DELETE","DO"],Q=["!","~"],x=["&&","||","&","|","^"],U=["<<",">>",">>>"],h=["==","!=","<",">","<=",">="],D=["*","/","%","//","%%"],B=["IN","OF","INSTANCEOF"],n=["TRUE","FALSE"],i=["IDENTIFIER",")","]","?","@","THIS","SUPER"],b=i.concat(["NUMBER","STRING","STRING_END","REGEX","REGEX_END","BOOL","NULL","UNDEFINED","}","::"]),A=b.concat(["++","--"]),N=["INDENT","OUTDENT","TERMINATOR"],y=[")","}","]"]}.call(this),t.exports}(),_dereq_["./parser"]=function(){var e={},t={exports:e},n=function(){function e(){this.yy={}}var t=function(e,t,n,i){for(n=n||{},i=e.length;i--;n[e[i]]=t);return n},n=[1,20],i=[1,75],r=[1,71],s=[1,76],o=[1,77],a=[1,73],c=[1,74],h=[1,50],l=[1,52],u=[1,53],p=[1,54],d=[1,55],f=[1,45],m=[1,46],g=[1,27],v=[1,60],y=[1,61],b=[1,70],k=[1,43],w=[1,26],T=[1,58],C=[1,59],E=[1,57],F=[1,38],N=[1,44],L=[1,56],x=[1,65],S=[1,66],D=[1,67],R=[1,68],A=[1,42],I=[1,64],_=[1,29],O=[1,30],$=[1,31],j=[1,32],M=[1,33],B=[1,34],V=[1,35],P=[1,78],U=[1,6,26,34,108],G=[1,88],H=[1,81],q=[1,80],X=[1,79],W=[1,82],Y=[1,83],K=[1,84],z=[1,85],J=[1,86],Q=[1,87],Z=[1,91],et=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],tt=[1,97],nt=[1,98],it=[1,99],rt=[1,100],st=[1,102],ot=[1,103],at=[1,96],ct=[2,112],ht=[1,6,25,26,34,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],lt=[2,79],ut=[1,108],pt=[2,58],dt=[1,112],ft=[1,117],mt=[1,118],gt=[1,120],vt=[1,6,25,26,34,46,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],yt=[2,76],bt=[1,6,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],kt=[1,155],wt=[1,157],Tt=[1,152],Ct=[1,6,25,26,34,46,55,60,63,72,73,74,75,77,79,80,84,86,90,91,92,97,99,108,110,111,112,116,117,132,135,136,139,140,141,142,143,144,145,146,147,148],Et=[2,95],Ft=[1,6,25,26,34,49,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],Nt=[1,6,25,26,34,46,49,55,60,63,72,73,74,75,77,79,80,84,86,90,91,92,97,99,108,110,111,112,116,117,123,124,132,135,136,139,140,141,142,143,144,145,146,147,148],Lt=[1,206],xt=[1,205],St=[1,6,25,26,34,38,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],Dt=[2,56],Rt=[1,216],At=[6,25,26,55,60],It=[6,25,26,46,55,60,63],_t=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,142,144,145,146,147],Ot=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132],$t=[72,73,74,75,77,80,90,91],jt=[1,235],Mt=[2,133],Bt=[1,6,25,26,34,46,55,60,63,72,73,74,75,77,79,80,84,90,91,92,97,99,108,110,111,112,116,117,123,124,132,135,136,141,142,143,144,145,146,147],Vt=[1,244],Pt=[6,25,26,60,92,97],Ut=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,117,132],Gt=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,111,117,132],Ht=[123,124],qt=[60,123,124],Xt=[1,255],Wt=[6,25,26,60,84],Yt=[6,25,26,49,60,84],Kt=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,144,145,146,147],zt=[11,28,30,32,33,36,37,40,41,42,43,44,51,52,53,57,58,79,82,85,89,94,95,96,102,106,107,110,112,114,116,125,131,133,134,135,136,137,139,140],Jt=[2,122],Qt=[6,25,26],Zt=[2,57],en=[1,268],tn=[1,269],nn=[1,6,25,26,34,55,60,63,79,84,92,97,99,104,105,108,110,111,112,116,117,127,129,132,135,136,141,142,143,144,145,146,147],rn=[26,127,129],sn=[1,6,26,34,55,60,63,79,84,92,97,99,108,111,117,132],on=[2,71],an=[1,291],cn=[1,292],hn=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,127,132,135,136,141,142,143,144,145,146,147],ln=[1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,112,116,117,132],un=[1,303],pn=[1,304],dn=[6,25,26,60],fn=[1,6,25,26,34,55,60,63,79,84,92,97,99,104,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],mn=[25,60],gn={trace:function(){},yy:{},symbols_:{error:2,Root:3,Body:4,Line:5,TERMINATOR:6,Expression:7,Statement:8,Return:9,Comment:10,STATEMENT:11,Value:12,Invocation:13,Code:14,Operation:15,Assign:16,If:17,Try:18,While:19,For:20,Switch:21,Class:22,Throw:23,Block:24,INDENT:25,OUTDENT:26,Identifier:27,IDENTIFIER:28,AlphaNumeric:29,NUMBER:30,String:31,STRING:32,STRING_START:33,STRING_END:34,Regex:35,REGEX:36,REGEX_START:37,REGEX_END:38,Literal:39,JS:40,DEBUGGER:41,UNDEFINED:42,NULL:43,BOOL:44,Assignable:45,"=":46,AssignObj:47,ObjAssignable:48,":":49,ThisProperty:50,RETURN:51,HERECOMMENT:52,PARAM_START:53,ParamList:54,PARAM_END:55,FuncGlyph:56,"->":57,"=>":58,OptComma:59,",":60,Param:61,ParamVar:62,"...":63,Array:64,Object:65,Splat:66,SimpleAssignable:67,Accessor:68,Parenthetical:69,Range:70,This:71,".":72,"?.":73,"::":74,"?::":75,Index:76,INDEX_START:77,IndexValue:78,INDEX_END:79,INDEX_SOAK:80,Slice:81,"{":82,AssignList:83,"}":84,CLASS:85,EXTENDS:86,OptFuncExist:87,Arguments:88,SUPER:89,FUNC_EXIST:90,CALL_START:91,CALL_END:92,ArgList:93,THIS:94,"@":95,"[":96,"]":97,RangeDots:98,"..":99,Arg:100,SimpleArgs:101,TRY:102,Catch:103,FINALLY:104,CATCH:105,THROW:106,"(":107,")":108,WhileSource:109,WHILE:110,WHEN:111,UNTIL:112,Loop:113,LOOP:114,ForBody:115,FOR:116,BY:117,ForStart:118,ForSource:119,ForVariables:120,OWN:121,ForValue:122,FORIN:123,FOROF:124,SWITCH:125,Whens:126,ELSE:127,When:128,LEADING_WHEN:129,IfBlock:130,IF:131,POST_IF:132,UNARY:133,UNARY_MATH:134,"-":135,"+":136,YIELD:137,FROM:138,"--":139,"++":140,"?":141,MATH:142,"**":143,SHIFT:144,COMPARE:145,LOGIC:146,RELATION:147,COMPOUND_ASSIGN:148,$accept:0,$end:1},terminals_:{2:"error",6:"TERMINATOR",11:"STATEMENT",25:"INDENT",26:"OUTDENT",28:"IDENTIFIER",30:"NUMBER",32:"STRING",33:"STRING_START",34:"STRING_END",36:"REGEX",37:"REGEX_START",38:"REGEX_END",40:"JS",41:"DEBUGGER",42:"UNDEFINED",43:"NULL",44:"BOOL",46:"=",49:":",51:"RETURN",52:"HERECOMMENT",53:"PARAM_START",55:"PARAM_END",57:"->",58:"=>",60:",",63:"...",72:".",73:"?.",74:"::",75:"?::",77:"INDEX_START",79:"INDEX_END",80:"INDEX_SOAK",82:"{",84:"}",85:"CLASS",86:"EXTENDS",89:"SUPER",90:"FUNC_EXIST",91:"CALL_START",92:"CALL_END",94:"THIS",95:"@",96:"[",97:"]",99:"..",102:"TRY",104:"FINALLY",105:"CATCH",106:"THROW",107:"(",108:")",110:"WHILE",111:"WHEN",112:"UNTIL",114:"LOOP",116:"FOR",117:"BY",121:"OWN",123:"FORIN",124:"FOROF",125:"SWITCH",127:"ELSE",129:"LEADING_WHEN",131:"IF",132:"POST_IF",133:"UNARY",134:"UNARY_MATH",135:"-",136:"+",137:"YIELD",138:"FROM",139:"--",140:"++",141:"?",142:"MATH",143:"**",144:"SHIFT",145:"COMPARE",146:"LOGIC",147:"RELATION",148:"COMPOUND_ASSIGN"},productions_:[0,[3,0],[3,1],[4,1],[4,3],[4,2],[5,1],[5,1],[8,1],[8,1],[8,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[7,1],[24,2],[24,3],[27,1],[29,1],[29,1],[31,1],[31,3],[35,1],[35,3],[39,1],[39,1],[39,1],[39,1],[39,1],[39,1],[39,1],[16,3],[16,4],[16,5],[47,1],[47,3],[47,5],[47,1],[48,1],[48,1],[48,1],[9,2],[9,1],[10,1],[14,5],[14,2],[56,1],[56,1],[59,0],[59,1],[54,0],[54,1],[54,3],[54,4],[54,6],[61,1],[61,2],[61,3],[61,1],[62,1],[62,1],[62,1],[62,1],[66,2],[67,1],[67,2],[67,2],[67,1],[45,1],[45,1],[45,1],[12,1],[12,1],[12,1],[12,1],[12,1],[68,2],[68,2],[68,2],[68,2],[68,1],[68,1],[76,3],[76,2],[78,1],[78,1],[65,4],[83,0],[83,1],[83,3],[83,4],[83,6],[22,1],[22,2],[22,3],[22,4],[22,2],[22,3],[22,4],[22,5],[13,3],[13,3],[13,1],[13,2],[87,0],[87,1],[88,2],[88,4],[71,1],[71,1],[50,2],[64,2],[64,4],[98,1],[98,1],[70,5],[81,3],[81,2],[81,2],[81,1],[93,1],[93,3],[93,4],[93,4],[93,6],[100,1],[100,1],[100,1],[101,1],[101,3],[18,2],[18,3],[18,4],[18,5],[103,3],[103,3],[103,2],[23,2],[69,3],[69,5],[109,2],[109,4],[109,2],[109,4],[19,2],[19,2],[19,2],[19,1],[113,2],[113,2],[20,2],[20,2],[20,2],[115,2],[115,4],[115,2],[118,2],[118,3],[122,1],[122,1],[122,1],[122,1],[120,1],[120,3],[119,2],[119,2],[119,4],[119,4],[119,4],[119,6],[119,6],[21,5],[21,7],[21,4],[21,6],[126,1],[126,2],[128,3],[128,4],[130,3],[130,5],[17,1],[17,3],[17,3],[17,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,2],[15,2],[15,2],[15,2],[15,2],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,3],[15,5],[15,4],[15,3]],performAction:function(e,t,n,i,r,s,o){var a=s.length-1; switch(r){case 1:return this.$=i.addLocationDataFn(o[a],o[a])(new i.Block);case 2:return this.$=s[a];case 3:this.$=i.addLocationDataFn(o[a],o[a])(i.Block.wrap([s[a]]));break;case 4:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-2].push(s[a]));break;case 5:this.$=s[a-1];break;case 6:case 7:case 8:case 9:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:case 19:case 20:case 21:case 22:case 27:case 32:case 34:case 45:case 46:case 47:case 48:case 56:case 57:case 67:case 68:case 69:case 70:case 75:case 76:case 79:case 83:case 89:case 133:case 134:case 136:case 166:case 167:case 183:case 189:this.$=s[a];break;case 10:case 25:case 26:case 28:case 30:case 33:case 35:this.$=i.addLocationDataFn(o[a],o[a])(new i.Literal(s[a]));break;case 23:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Block);break;case 24:case 31:case 90:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-1]);break;case 29:case 146:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Parens(s[a-1]));break;case 36:this.$=i.addLocationDataFn(o[a],o[a])(new i.Undefined);break;case 37:this.$=i.addLocationDataFn(o[a],o[a])(new i.Null);break;case 38:this.$=i.addLocationDataFn(o[a],o[a])(new i.Bool(s[a]));break;case 39:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Assign(s[a-2],s[a]));break;case 40:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Assign(s[a-3],s[a]));break;case 41:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Assign(s[a-4],s[a-1]));break;case 42:case 72:case 77:case 78:case 80:case 81:case 82:case 168:case 169:this.$=i.addLocationDataFn(o[a],o[a])(new i.Value(s[a]));break;case 43:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Assign(i.addLocationDataFn(o[a-2])(new i.Value(s[a-2])),s[a],"object"));break;case 44:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Assign(i.addLocationDataFn(o[a-4])(new i.Value(s[a-4])),s[a-1],"object"));break;case 49:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Return(s[a]));break;case 50:this.$=i.addLocationDataFn(o[a],o[a])(new i.Return);break;case 51:this.$=i.addLocationDataFn(o[a],o[a])(new i.Comment(s[a]));break;case 52:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Code(s[a-3],s[a],s[a-1]));break;case 53:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Code([],s[a],s[a-1]));break;case 54:this.$=i.addLocationDataFn(o[a],o[a])("func");break;case 55:this.$=i.addLocationDataFn(o[a],o[a])("boundfunc");break;case 58:case 95:this.$=i.addLocationDataFn(o[a],o[a])([]);break;case 59:case 96:case 128:case 170:this.$=i.addLocationDataFn(o[a],o[a])([s[a]]);break;case 60:case 97:case 129:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-2].concat(s[a]));break;case 61:case 98:case 130:this.$=i.addLocationDataFn(o[a-3],o[a])(s[a-3].concat(s[a]));break;case 62:case 99:case 132:this.$=i.addLocationDataFn(o[a-5],o[a])(s[a-5].concat(s[a-2]));break;case 63:this.$=i.addLocationDataFn(o[a],o[a])(new i.Param(s[a]));break;case 64:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Param(s[a-1],null,!0));break;case 65:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Param(s[a-2],s[a]));break;case 66:case 135:this.$=i.addLocationDataFn(o[a],o[a])(new i.Expansion);break;case 71:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Splat(s[a-1]));break;case 73:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a-1].add(s[a]));break;case 74:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Value(s[a-1],[].concat(s[a])));break;case 84:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Access(s[a]));break;case 85:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Access(s[a],"soak"));break;case 86:this.$=i.addLocationDataFn(o[a-1],o[a])([i.addLocationDataFn(o[a-1])(new i.Access(new i.Literal("prototype"))),i.addLocationDataFn(o[a])(new i.Access(s[a]))]);break;case 87:this.$=i.addLocationDataFn(o[a-1],o[a])([i.addLocationDataFn(o[a-1])(new i.Access(new i.Literal("prototype"),"soak")),i.addLocationDataFn(o[a])(new i.Access(s[a]))]);break;case 88:this.$=i.addLocationDataFn(o[a],o[a])(new i.Access(new i.Literal("prototype")));break;case 91:this.$=i.addLocationDataFn(o[a-1],o[a])(i.extend(s[a],{soak:!0}));break;case 92:this.$=i.addLocationDataFn(o[a],o[a])(new i.Index(s[a]));break;case 93:this.$=i.addLocationDataFn(o[a],o[a])(new i.Slice(s[a]));break;case 94:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Obj(s[a-2],s[a-3].generated));break;case 100:this.$=i.addLocationDataFn(o[a],o[a])(new i.Class);break;case 101:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Class(null,null,s[a]));break;case 102:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Class(null,s[a]));break;case 103:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Class(null,s[a-1],s[a]));break;case 104:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Class(s[a]));break;case 105:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Class(s[a-1],null,s[a]));break;case 106:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Class(s[a-2],s[a]));break;case 107:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Class(s[a-3],s[a-1],s[a]));break;case 108:case 109:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Call(s[a-2],s[a],s[a-1]));break;case 110:this.$=i.addLocationDataFn(o[a],o[a])(new i.Call("super",[new i.Splat(new i.Literal("arguments"))]));break;case 111:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Call("super",s[a]));break;case 112:this.$=i.addLocationDataFn(o[a],o[a])(!1);break;case 113:this.$=i.addLocationDataFn(o[a],o[a])(!0);break;case 114:this.$=i.addLocationDataFn(o[a-1],o[a])([]);break;case 115:case 131:this.$=i.addLocationDataFn(o[a-3],o[a])(s[a-2]);break;case 116:case 117:this.$=i.addLocationDataFn(o[a],o[a])(new i.Value(new i.Literal("this")));break;case 118:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Value(i.addLocationDataFn(o[a-1])(new i.Literal("this")),[i.addLocationDataFn(o[a])(new i.Access(s[a]))],"this"));break;case 119:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Arr([]));break;case 120:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Arr(s[a-2]));break;case 121:this.$=i.addLocationDataFn(o[a],o[a])("inclusive");break;case 122:this.$=i.addLocationDataFn(o[a],o[a])("exclusive");break;case 123:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Range(s[a-3],s[a-1],s[a-2]));break;case 124:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Range(s[a-2],s[a],s[a-1]));break;case 125:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Range(s[a-1],null,s[a]));break;case 126:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Range(null,s[a],s[a-1]));break;case 127:this.$=i.addLocationDataFn(o[a],o[a])(new i.Range(null,null,s[a]));break;case 137:this.$=i.addLocationDataFn(o[a-2],o[a])([].concat(s[a-2],s[a]));break;case 138:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Try(s[a]));break;case 139:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Try(s[a-1],s[a][0],s[a][1]));break;case 140:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Try(s[a-2],null,null,s[a]));break;case 141:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Try(s[a-3],s[a-2][0],s[a-2][1],s[a]));break;case 142:this.$=i.addLocationDataFn(o[a-2],o[a])([s[a-1],s[a]]);break;case 143:this.$=i.addLocationDataFn(o[a-2],o[a])([i.addLocationDataFn(o[a-1])(new i.Value(s[a-1])),s[a]]);break;case 144:this.$=i.addLocationDataFn(o[a-1],o[a])([null,s[a]]);break;case 145:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Throw(s[a]));break;case 147:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Parens(s[a-2]));break;case 148:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(s[a]));break;case 149:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.While(s[a-2],{guard:s[a]}));break;case 150:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(s[a],{invert:!0}));break;case 151:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.While(s[a-2],{invert:!0,guard:s[a]}));break;case 152:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a-1].addBody(s[a]));break;case 153:case 154:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a].addBody(i.addLocationDataFn(o[a-1])(i.Block.wrap([s[a-1]]))));break;case 155:this.$=i.addLocationDataFn(o[a],o[a])(s[a]);break;case 156:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(i.addLocationDataFn(o[a-1])(new i.Literal("true"))).addBody(s[a]));break;case 157:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.While(i.addLocationDataFn(o[a-1])(new i.Literal("true"))).addBody(i.addLocationDataFn(o[a])(i.Block.wrap([s[a]]))));break;case 158:case 159:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.For(s[a-1],s[a]));break;case 160:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.For(s[a],s[a-1]));break;case 161:this.$=i.addLocationDataFn(o[a-1],o[a])({source:i.addLocationDataFn(o[a])(new i.Value(s[a]))});break;case 162:this.$=i.addLocationDataFn(o[a-3],o[a])({source:i.addLocationDataFn(o[a-2])(new i.Value(s[a-2])),step:s[a]});break;case 163:this.$=i.addLocationDataFn(o[a-1],o[a])(function(){return s[a].own=s[a-1].own,s[a].name=s[a-1][0],s[a].index=s[a-1][1],s[a]}());break;case 164:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a]);break;case 165:this.$=i.addLocationDataFn(o[a-2],o[a])(function(){return s[a].own=!0,s[a]}());break;case 171:this.$=i.addLocationDataFn(o[a-2],o[a])([s[a-2],s[a]]);break;case 172:this.$=i.addLocationDataFn(o[a-1],o[a])({source:s[a]});break;case 173:this.$=i.addLocationDataFn(o[a-1],o[a])({source:s[a],object:!0});break;case 174:this.$=i.addLocationDataFn(o[a-3],o[a])({source:s[a-2],guard:s[a]});break;case 175:this.$=i.addLocationDataFn(o[a-3],o[a])({source:s[a-2],guard:s[a],object:!0});break;case 176:this.$=i.addLocationDataFn(o[a-3],o[a])({source:s[a-2],step:s[a]});break;case 177:this.$=i.addLocationDataFn(o[a-5],o[a])({source:s[a-4],guard:s[a-2],step:s[a]});break;case 178:this.$=i.addLocationDataFn(o[a-5],o[a])({source:s[a-4],step:s[a-2],guard:s[a]});break;case 179:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Switch(s[a-3],s[a-1]));break;case 180:this.$=i.addLocationDataFn(o[a-6],o[a])(new i.Switch(s[a-5],s[a-3],s[a-1]));break;case 181:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Switch(null,s[a-1]));break;case 182:this.$=i.addLocationDataFn(o[a-5],o[a])(new i.Switch(null,s[a-3],s[a-1]));break;case 184:this.$=i.addLocationDataFn(o[a-1],o[a])(s[a-1].concat(s[a]));break;case 185:this.$=i.addLocationDataFn(o[a-2],o[a])([[s[a-1],s[a]]]);break;case 186:this.$=i.addLocationDataFn(o[a-3],o[a])([[s[a-2],s[a-1]]]);break;case 187:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.If(s[a-1],s[a],{type:s[a-2]}));break;case 188:this.$=i.addLocationDataFn(o[a-4],o[a])(s[a-4].addElse(i.addLocationDataFn(o[a-2],o[a])(new i.If(s[a-1],s[a],{type:s[a-2]}))));break;case 190:this.$=i.addLocationDataFn(o[a-2],o[a])(s[a-2].addElse(s[a]));break;case 191:case 192:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.If(s[a],i.addLocationDataFn(o[a-2])(i.Block.wrap([s[a-2]])),{type:s[a-1],statement:!0}));break;case 193:case 194:case 197:case 198:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op(s[a-1],s[a]));break;case 195:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("-",s[a]));break;case 196:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("+",s[a]));break;case 199:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op(s[a-2].concat(s[a-1]),s[a]));break;case 200:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("--",s[a]));break;case 201:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("++",s[a]));break;case 202:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("--",s[a-1],null,!0));break;case 203:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Op("++",s[a-1],null,!0));break;case 204:this.$=i.addLocationDataFn(o[a-1],o[a])(new i.Existence(s[a-1]));break;case 205:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op("+",s[a-2],s[a]));break;case 206:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op("-",s[a-2],s[a]));break;case 207:case 208:case 209:case 210:case 211:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Op(s[a-1],s[a-2],s[a]));break;case 212:this.$=i.addLocationDataFn(o[a-2],o[a])(function(){return"!"===s[a-1].charAt(0)?new i.Op(s[a-1].slice(1),s[a-2],s[a]).invert():new i.Op(s[a-1],s[a-2],s[a])}());break;case 213:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Assign(s[a-2],s[a],s[a-1]));break;case 214:this.$=i.addLocationDataFn(o[a-4],o[a])(new i.Assign(s[a-4],s[a-1],s[a-3]));break;case 215:this.$=i.addLocationDataFn(o[a-3],o[a])(new i.Assign(s[a-3],s[a],s[a-2]));break;case 216:this.$=i.addLocationDataFn(o[a-2],o[a])(new i.Extends(s[a-2],s[a]))}},table:[{1:[2,1],3:1,4:2,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{1:[3]},{1:[2,2],6:P},t(U,[2,3]),t(U,[2,6],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(U,[2,7],{118:69,109:92,115:93,110:x,112:S,116:R,132:Z}),t(et,[2,11],{87:94,68:95,76:101,72:tt,73:nt,74:it,75:rt,77:st,80:ot,90:at,91:ct}),t(et,[2,12],{76:101,87:104,68:105,72:tt,73:nt,74:it,75:rt,77:st,80:ot,90:at,91:ct}),t(et,[2,13]),t(et,[2,14]),t(et,[2,15]),t(et,[2,16]),t(et,[2,17]),t(et,[2,18]),t(et,[2,19]),t(et,[2,20]),t(et,[2,21]),t(et,[2,22]),t(et,[2,8]),t(et,[2,9]),t(et,[2,10]),t(ht,lt,{46:[1,106]}),t(ht,[2,80]),t(ht,[2,81]),t(ht,[2,82]),t(ht,[2,83]),t([1,6,25,26,34,38,55,60,63,72,73,74,75,77,79,80,84,90,92,97,99,108,110,111,112,116,117,132,135,136,141,142,143,144,145,146,147],[2,110],{88:107,91:ut}),t([6,25,55,60],pt,{54:109,61:110,62:111,27:113,50:114,64:115,65:116,28:i,63:dt,82:b,95:ft,96:mt}),{24:119,25:gt},{7:121,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:123,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:124,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:125,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:127,8:126,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,138:[1,128],139:B,140:V},{12:130,13:131,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:132,50:63,64:47,65:48,67:129,69:23,70:24,71:25,82:b,89:w,94:T,95:C,96:E,107:L},{12:130,13:131,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:132,50:63,64:47,65:48,67:133,69:23,70:24,71:25,82:b,89:w,94:T,95:C,96:E,107:L},t(vt,yt,{86:[1,137],139:[1,134],140:[1,135],148:[1,136]}),t(et,[2,189],{127:[1,138]}),{24:139,25:gt},{24:140,25:gt},t(et,[2,155]),{24:141,25:gt},{7:142,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,143],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(bt,[2,100],{39:22,69:23,70:24,71:25,64:47,65:48,29:49,35:51,27:62,50:63,31:72,12:130,13:131,45:132,24:144,67:146,25:gt,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,82:b,86:[1,145],89:w,94:T,95:C,96:E,107:L}),{7:147,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,141,142,143,144,145,146,147],[2,50],{12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,9:18,10:19,45:21,39:22,69:23,70:24,71:25,56:28,67:36,130:37,109:39,113:40,115:41,64:47,65:48,29:49,35:51,27:62,50:63,118:69,31:72,8:122,7:148,11:n,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,51:f,52:m,53:g,57:v,58:y,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,114:D,125:A,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V}),t(et,[2,51]),t(vt,[2,77]),t(vt,[2,78]),t(ht,[2,32]),t(ht,[2,33]),t(ht,[2,34]),t(ht,[2,35]),t(ht,[2,36]),t(ht,[2,37]),t(ht,[2,38]),{4:149,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,150],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:151,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:153,94:T,95:C,96:E,97:Tt,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(ht,[2,116]),t(ht,[2,117],{27:158,28:i}),{25:[2,54]},{25:[2,55]},t(Ct,[2,72]),t(Ct,[2,75]),{7:159,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:160,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:161,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:163,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,24:162,25:gt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{27:168,28:i,50:169,64:170,65:171,70:164,82:b,95:ft,96:E,120:165,121:[1,166],122:167},{119:172,123:[1,173],124:[1,174]},t([6,25,60,84],Et,{31:72,83:175,47:176,48:177,10:178,27:179,29:180,50:181,28:i,30:r,32:s,33:o,52:m,95:ft}),t(Ft,[2,26]),t(Ft,[2,27]),t(ht,[2,30]),{12:130,13:182,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:132,50:63,64:47,65:48,67:183,69:23,70:24,71:25,82:b,89:w,94:T,95:C,96:E,107:L},t(Nt,[2,25]),t(Ft,[2,28]),{4:184,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(U,[2,5],{7:4,8:5,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,9:18,10:19,45:21,39:22,69:23,70:24,71:25,56:28,67:36,130:37,109:39,113:40,115:41,64:47,65:48,29:49,35:51,27:62,50:63,118:69,31:72,5:185,11:n,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,51:f,52:m,53:g,57:v,58:y,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,110:x,112:S,114:D,116:R,125:A,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V}),t(et,[2,204]),{7:186,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:187,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:188,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:189,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:190,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:191,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:192,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:193,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:194,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,154]),t(et,[2,159]),{7:195,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,153]),t(et,[2,158]),{88:196,91:ut},t(Ct,[2,73]),{91:[2,113]},{27:197,28:i},{27:198,28:i},t(Ct,[2,88],{27:199,28:i}),{27:200,28:i},t(Ct,[2,89]),{7:202,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:Lt,64:47,65:48,67:36,69:23,70:24,71:25,78:201,81:203,82:b,85:k,89:w,94:T,95:C,96:E,98:204,99:xt,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{76:207,77:st,80:ot},{88:208,91:ut},t(Ct,[2,74]),{6:[1,210],7:209,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,211],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(St,[2,111]),{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,92:[1,212],93:213,94:T,95:C,96:E,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([6,25],Dt,{59:217,55:[1,215],60:Rt}),t(At,[2,59]),t(At,[2,63],{46:[1,219],63:[1,218]}),t(At,[2,66]),t(It,[2,67]),t(It,[2,68]),t(It,[2,69]),t(It,[2,70]),{27:158,28:i},{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:153,94:T,95:C,96:E,97:Tt,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,53]),{4:221,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,26:[1,220],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,135,136,142,143,144,145,146,147],[2,193],{118:69,109:89,115:90,141:X}),{109:92,110:x,112:S,115:93,116:R,118:69,132:Z},t(_t,[2,194],{118:69,109:89,115:90,141:X,143:Y}),t(_t,[2,195],{118:69,109:89,115:90,141:X,143:Y}),t(_t,[2,196],{118:69,109:89,115:90,141:X,143:Y}),t(et,[2,197],{118:69,109:92,115:93}),t(Ot,[2,198],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:222,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,200],{72:yt,73:yt,74:yt,75:yt,77:yt,80:yt,90:yt,91:yt}),{68:95,72:tt,73:nt,74:it,75:rt,76:101,77:st,80:ot,87:94,90:at,91:ct},{68:105,72:tt,73:nt,74:it,75:rt,76:101,77:st,80:ot,87:104,90:at,91:ct},t($t,lt),t(et,[2,201],{72:yt,73:yt,74:yt,75:yt,77:yt,80:yt,90:yt,91:yt}),t(et,[2,202]),t(et,[2,203]),{6:[1,225],7:223,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,224],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:226,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{24:227,25:gt,131:[1,228]},t(et,[2,138],{103:229,104:[1,230],105:[1,231]}),t(et,[2,152]),t(et,[2,160]),{25:[1,232],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{126:233,128:234,129:jt},t(et,[2,101]),{7:236,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(bt,[2,104],{24:237,25:gt,72:yt,73:yt,74:yt,75:yt,77:yt,80:yt,90:yt,91:yt,86:[1,238]}),t(Ot,[2,145],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,49],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{6:P,108:[1,239]},{4:240,5:3,7:4,8:5,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([6,25,60,97],Mt,{118:69,109:89,115:90,98:241,63:[1,242],99:xt,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Bt,[2,119]),t([6,25,97],Dt,{59:243,60:Vt}),t(Pt,[2,128]),{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:245,94:T,95:C,96:E,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Pt,[2,134]),t(Pt,[2,135]),t(Nt,[2,118]),{24:246,25:gt,109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Ut,[2,148],{118:69,109:89,115:90,110:x,111:[1,247],112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ut,[2,150],{118:69,109:89,115:90,110:x,111:[1,248],112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,156]),t(Gt,[2,157],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,132,135,136,141,142,143,144,145,146,147],[2,161],{117:[1,249]}),t(Ht,[2,164]),{27:168,28:i,50:169,64:170,65:171,82:b,95:ft,96:mt,120:250,122:167},t(Ht,[2,170],{60:[1,251]}),t(qt,[2,166]),t(qt,[2,167]),t(qt,[2,168]),t(qt,[2,169]),t(et,[2,163]),{7:252,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:253,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([6,25,84],Dt,{59:254,60:Xt}),t(Wt,[2,96]),t(Wt,[2,42],{49:[1,256]}),t(Wt,[2,45]),t(Yt,[2,46]),t(Yt,[2,47]),t(Yt,[2,48]),{38:[1,257],68:105,72:tt,73:nt,74:it,75:rt,76:101,77:st,80:ot,87:104,90:at,91:ct},t($t,yt),{6:P,34:[1,258]},t(U,[2,4]),t(Kt,[2,205],{118:69,109:89,115:90,141:X,142:W,143:Y}),t(Kt,[2,206],{118:69,109:89,115:90,141:X,142:W,143:Y}),t(_t,[2,207],{118:69,109:89,115:90,141:X,143:Y}),t(_t,[2,208],{118:69,109:89,115:90,141:X,143:Y}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,144,145,146,147],[2,209],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,145,146],[2,210],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,147:Q}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,146],[2,211],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,147:Q}),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,117,132,145,146,147],[2,212],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K}),t(Gt,[2,192],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Gt,[2,191],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(St,[2,108]),t(Ct,[2,84]),t(Ct,[2,85]),t(Ct,[2,86]),t(Ct,[2,87]),{79:[1,259]},{63:Lt,79:[2,92],98:260,99:xt,109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{79:[2,93]},{7:261,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,79:[2,127],82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(zt,[2,121]),t(zt,Jt),t(Ct,[2,91]),t(St,[2,109]),t(Ot,[2,39],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:262,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:263,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(St,[2,114]),t([6,25,92],Dt,{59:264,60:Vt}),t(Pt,Mt,{118:69,109:89,115:90,63:[1,265],110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{56:266,57:v,58:y},t(Qt,Zt,{62:111,27:113,50:114,64:115,65:116,61:267,28:i,63:dt,82:b,95:ft,96:mt}),{6:en,25:tn},t(At,[2,64]),{7:270,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(nn,[2,23]),{6:P,26:[1,271]},t(Ot,[2,199],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,213],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:272,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:273,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Ot,[2,216],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,190]),{7:274,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,139],{104:[1,275]}),{24:276,25:gt},{24:279,25:gt,27:277,28:i,65:278,82:b},{126:280,128:234,129:jt},{26:[1,281],127:[1,282],128:283,129:jt},t(rn,[2,183]),{7:285,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,101:284,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(sn,[2,102],{118:69,109:89,115:90,24:286,25:gt,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,105]),{7:287,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(ht,[2,146]),{6:P,26:[1,288]},{7:289,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t([11,28,30,32,33,36,37,40,41,42,43,44,51,52,53,57,58,82,85,89,94,95,96,102,106,107,110,112,114,116,125,131,133,134,135,136,137,139,140],Jt,{6:on,25:on,60:on,97:on}),{6:an,25:cn,97:[1,290]},t([6,25,26,92,97],Zt,{12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,9:18,10:19,45:21,39:22,69:23,70:24,71:25,56:28,67:36,130:37,109:39,113:40,115:41,64:47,65:48,29:49,35:51,27:62,50:63,118:69,31:72,8:122,66:156,7:214,100:293,11:n,28:i,30:r,32:s,33:o,36:a,37:c,40:h,41:l,42:u,43:p,44:d,51:f,52:m,53:g,57:v,58:y,63:wt,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,110:x,112:S,114:D,116:R,125:A,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V}),t(Qt,Dt,{59:294,60:Vt}),t(hn,[2,187]),{7:295,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:296,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:297,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Ht,[2,165]),{27:168,28:i,50:169,64:170,65:171,82:b,95:ft,96:mt,122:298},t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,112,116,132],[2,172],{118:69,109:89,115:90,111:[1,299],117:[1,300],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(ln,[2,173],{118:69,109:89,115:90,111:[1,301],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{6:un,25:pn,84:[1,302]},t([6,25,26,84],Zt,{31:72,48:177,10:178,27:179,29:180,50:181,47:305,28:i,30:r,32:s,33:o,52:m,95:ft}),{7:306,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:[1,307],27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(ht,[2,31]),t(Ft,[2,29]),t(Ct,[2,90]),{7:308,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,79:[2,125],82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{79:[2,126],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Ot,[2,40],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{26:[1,309],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{6:an,25:cn,92:[1,310]},t(Pt,on),{24:311,25:gt},t(At,[2,60]),{27:113,28:i,50:114,61:312,62:111,63:dt,64:115,65:116,82:b,95:ft,96:mt},t(dn,pt,{61:110,62:111,27:113,50:114,64:115,65:116,54:313,28:i,63:dt,82:b,95:ft,96:mt}),t(At,[2,65],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(nn,[2,24]),{26:[1,314],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Ot,[2,215],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{24:315,25:gt,109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{24:316,25:gt},t(et,[2,140]),{24:317,25:gt},{24:318,25:gt},t(fn,[2,144]),{26:[1,319],127:[1,320],128:283,129:jt},t(et,[2,181]),{24:321,25:gt},t(rn,[2,184]),{24:322,25:gt,60:[1,323]},t(mn,[2,136],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(et,[2,103]),t(sn,[2,106],{118:69,109:89,115:90,24:324,25:gt,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{108:[1,325]},{97:[1,326],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(Bt,[2,120]),{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,100:327,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:214,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,25:kt,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,63:wt,64:47,65:48,66:156,67:36,69:23,70:24,71:25,82:b,85:k,89:w,93:328,94:T,95:C,96:E,100:154,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Pt,[2,129]),{6:an,25:cn,26:[1,329]},t(Gt,[2,149],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Gt,[2,151],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Gt,[2,162],{118:69,109:89,115:90,110:x,112:S,116:R,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ht,[2,171]),{7:330,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:331,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:332,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(Bt,[2,94]),{10:178,27:179,28:i,29:180,30:r,31:72,32:s,33:o,47:333,48:177,50:181,52:m,95:ft},t(dn,Et,{31:72,47:176,48:177,10:178,27:179,29:180,50:181,83:334,28:i,30:r,32:s,33:o,52:m,95:ft}),t(Wt,[2,97]),t(Wt,[2,43],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{7:335,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{79:[2,124],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},t(et,[2,41]),t(St,[2,115]),t(et,[2,52]),t(At,[2,61]),t(Qt,Dt,{59:336,60:Rt}),t(et,[2,214]),t(hn,[2,188]),t(et,[2,141]),t(fn,[2,142]),t(fn,[2,143]),t(et,[2,179]),{24:337,25:gt},{26:[1,338]},t(rn,[2,185],{6:[1,339]}),{7:340,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},t(et,[2,107]),t(ht,[2,147]),t(ht,[2,123]),t(Pt,[2,130]),t(Qt,Dt,{59:341,60:Vt}),t(Pt,[2,131]),t([1,6,25,26,34,55,60,63,79,84,92,97,99,108,110,111,112,116,132],[2,174],{118:69,109:89,115:90,117:[1,342],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(ln,[2,176],{118:69,109:89,115:90,111:[1,343],135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,175],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Wt,[2,98]),t(Qt,Dt,{59:344,60:Xt}),{26:[1,345],109:89,110:x,112:S,115:90,116:R,118:69,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q},{6:en,25:tn,26:[1,346]},{26:[1,347]},t(et,[2,182]),t(rn,[2,186]),t(mn,[2,137],{118:69,109:89,115:90,110:x,112:S,116:R,132:G,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),{6:an,25:cn,26:[1,348]},{7:349,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{7:350,8:122,9:18,10:19,11:n,12:6,13:7,14:8,15:9,16:10,17:11,18:12,19:13,20:14,21:15,22:16,23:17,27:62,28:i,29:49,30:r,31:72,32:s,33:o,35:51,36:a,37:c,39:22,40:h,41:l,42:u,43:p,44:d,45:21,50:63,51:f,52:m,53:g,56:28,57:v,58:y,64:47,65:48,67:36,69:23,70:24,71:25,82:b,85:k,89:w,94:T,95:C,96:E,102:F,106:N,107:L,109:39,110:x,112:S,113:40,114:D,115:41,116:R,118:69,125:A,130:37,131:I,133:_,134:O,135:$,136:j,137:M,139:B,140:V},{6:un,25:pn,26:[1,351]},t(Wt,[2,44]),t(At,[2,62]),t(et,[2,180]),t(Pt,[2,132]),t(Ot,[2,177],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Ot,[2,178],{118:69,109:89,115:90,135:H,136:q,141:X,142:W,143:Y,144:K,145:z,146:J,147:Q}),t(Wt,[2,99])],defaultActions:{60:[2,54],61:[2,55],96:[2,113],203:[2,93]},parseError:function(e,t){if(!t.recoverable)throw Error(e); this.trace(e)},parse:function(e){function t(){var e;return e=f.lex()||p,"number"!=typeof e&&(e=n.symbols_[e]||e),e}var n=this,i=[0],r=[null],s=[],o=this.table,a="",c=0,h=0,l=0,u=2,p=1,d=s.slice.call(arguments,1),f=Object.create(this.lexer),m={yy:{}};for(var g in this.yy)Object.prototype.hasOwnProperty.call(this.yy,g)&&(m.yy[g]=this.yy[g]);f.setInput(e,m.yy),m.yy.lexer=f,m.yy.parser=this,f.yylloc===void 0&&(f.yylloc={});var v=f.yylloc;s.push(v);var y=f.options&&f.options.ranges;this.parseError="function"==typeof m.yy.parseError?m.yy.parseError:Object.getPrototypeOf(this).parseError;for(var b,k,w,T,C,E,F,N,L,x={};;){if(w=i[i.length-1],this.defaultActions[w]?T=this.defaultActions[w]:((null===b||b===void 0)&&(b=t()),T=o[w]&&o[w][b]),T===void 0||!T.length||!T[0]){var S="";L=[];for(E in o[w])this.terminals_[E]&&E>u&&L.push("'"+this.terminals_[E]+"'");S=f.showPosition?"Parse error on line "+(c+1)+":\n"+f.showPosition()+"\nExpecting "+L.join(", ")+", got '"+(this.terminals_[b]||b)+"'":"Parse error on line "+(c+1)+": Unexpected "+(b==p?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(S,{text:f.match,token:this.terminals_[b]||b,line:f.yylineno,loc:v,expected:L})}if(T[0]instanceof Array&&T.length>1)throw Error("Parse Error: multiple actions possible at state: "+w+", token: "+b);switch(T[0]){case 1:i.push(b),r.push(f.yytext),s.push(f.yylloc),i.push(T[1]),b=null,k?(b=k,k=null):(h=f.yyleng,a=f.yytext,c=f.yylineno,v=f.yylloc,l>0&&l--);break;case 2:if(F=this.productions_[T[1]][1],x.$=r[r.length-F],x._$={first_line:s[s.length-(F||1)].first_line,last_line:s[s.length-1].last_line,first_column:s[s.length-(F||1)].first_column,last_column:s[s.length-1].last_column},y&&(x._$.range=[s[s.length-(F||1)].range[0],s[s.length-1].range[1]]),C=this.performAction.apply(x,[a,h,c,m.yy,T[1],r,s].concat(d)),C!==void 0)return C;F&&(i=i.slice(0,2*-1*F),r=r.slice(0,-1*F),s=s.slice(0,-1*F)),i.push(this.productions_[T[1]][0]),r.push(x.$),s.push(x._$),N=o[i[i.length-2]][i[i.length-1]],i.push(N);break;case 3:return!0}}return!0}};return e.prototype=gn,gn.Parser=e,new e}();return _dereq_!==void 0&&e!==void 0&&(e.parser=n,e.Parser=n.Parser,e.parse=function(){return n.parse.apply(n,arguments)},e.main=function(t){t[1]||(console.log("Usage: "+t[0]+" FILE"),process.exit(1));var n=_dereq_("fs").readFileSync(_dereq_("path").normalize(t[1]),"utf8");return e.parser.parse(n)},t!==void 0&&_dereq_.main===t&&e.main(process.argv.slice(1))),t.exports}(),_dereq_["./scope"]=function(){var e={},t={exports:e};return function(){var t,n=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};e.Scope=t=function(){function e(e,t,n,i){var r,s;this.parent=e,this.expressions=t,this.method=n,this.referencedVars=i,this.variables=[{name:"arguments",type:"arguments"}],this.positions={},this.parent||(this.utilities={}),this.root=null!=(r=null!=(s=this.parent)?s.root:void 0)?r:this}return e.prototype.add=function(e,t,n){return this.shared&&!n?this.parent.add(e,t,n):Object.prototype.hasOwnProperty.call(this.positions,e)?this.variables[this.positions[e]].type=t:this.positions[e]=this.variables.push({name:e,type:t})-1},e.prototype.namedMethod=function(){var e;return(null!=(e=this.method)?e.name:void 0)||!this.parent?this.method:this.parent.namedMethod()},e.prototype.find=function(e){return this.check(e)?!0:(this.add(e,"var"),!1)},e.prototype.parameter=function(e){return this.shared&&this.parent.check(e,!0)?void 0:this.add(e,"param")},e.prototype.check=function(e){var t;return!!(this.type(e)||(null!=(t=this.parent)?t.check(e):void 0))},e.prototype.temporary=function(e,t,n){return null==n&&(n=!1),n?(t+parseInt(e,36)).toString(36).replace(/\d/g,"a"):e+(t||"")},e.prototype.type=function(e){var t,n,i,r;for(i=this.variables,t=0,n=i.length;n>t;t++)if(r=i[t],r.name===e)return r.type;return null},e.prototype.freeVariable=function(e,t){var i,r,s;for(null==t&&(t={}),i=0;;){if(s=this.temporary(e,i,t.single),!(this.check(s)||n.call(this.root.referencedVars,s)>=0))break;i++}return(null!=(r=t.reserve)?r:!0)&&this.add(s,"var",!0),s},e.prototype.assign=function(e,t){return this.add(e,{value:t,assigned:!0},!0),this.hasAssignments=!0},e.prototype.hasDeclarations=function(){return!!this.declaredVariables().length},e.prototype.declaredVariables=function(){var e;return function(){var t,n,i,r;for(i=this.variables,r=[],t=0,n=i.length;n>t;t++)e=i[t],"var"===e.type&&r.push(e.name);return r}.call(this).sort()},e.prototype.assignedVariables=function(){var e,t,n,i,r;for(n=this.variables,i=[],e=0,t=n.length;t>e;e++)r=n[e],r.type.assigned&&i.push(r.name+" = "+r.type.value);return i},e}()}.call(this),t.exports}(),_dereq_["./nodes"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b,k,w,T,C,E,F,N,L,x,S,D,R,A,I,_,O,$,j,M,B,V,P,U,G,H,q,X,W,Y,K,z,J,Q,Z,et,tt,nt,it,rt,st,ot,at,ct,ht,lt,ut,pt,dt,ft,mt,gt,vt,yt,bt,kt=function(e,t){function n(){this.constructor=e}for(var i in t)wt.call(t,i)&&(e[i]=t[i]);return n.prototype=t.prototype,e.prototype=new n,e.__super__=t.prototype,e},wt={}.hasOwnProperty,Tt=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1},Ct=[].slice;Error.stackTraceLimit=1/0,P=_dereq_("./scope").Scope,dt=_dereq_("./lexer"),$=dt.RESERVED,V=dt.STRICT_PROSCRIBED,ft=_dereq_("./helpers"),et=ft.compact,rt=ft.flatten,it=ft.extend,lt=ft.merge,tt=ft.del,gt=ft.starts,nt=ft.ends,mt=ft.some,Z=ft.addLocationDataFn,ht=ft.locationDataToString,vt=ft.throwSyntaxError,e.extend=it,e.addLocationDataFn=Z,Q=function(){return!0},D=function(){return!1},X=function(){return this},S=function(){return this.negated=!this.negated,this},e.CodeFragment=h=function(){function e(e,t){var n;this.code=""+t,this.locationData=null!=e?e.locationData:void 0,this.type=(null!=e?null!=(n=e.constructor)?n.name:void 0:void 0)||"unknown"}return e.prototype.toString=function(){return""+this.code+(this.locationData?": "+ht(this.locationData):"")},e}(),st=function(e){var t;return function(){var n,i,r;for(r=[],n=0,i=e.length;i>n;n++)t=e[n],r.push(t.code);return r}().join("")},e.Base=r=function(){function e(){}return e.prototype.compile=function(e,t){return st(this.compileToFragments(e,t))},e.prototype.compileToFragments=function(e,t){var n;return e=it({},e),t&&(e.level=t),n=this.unfoldSoak(e)||this,n.tab=e.indent,e.level!==L&&n.isStatement(e)?n.compileClosure(e):n.compileNode(e)},e.prototype.compileClosure=function(e){var n,i,r,a,h,l,u;return(a=this.jumps())&&a.error("cannot use a pure statement in an expression"),e.sharedScope=!0,r=new c([],s.wrap([this])),n=[],((i=this.contains(at))||this.contains(ct))&&(n=[new x("this")],i?(h="apply",n.push(new x("arguments"))):h="call",r=new z(r,[new t(new x(h))])),l=new o(r,n).compileNode(e),(r.isGenerator||(null!=(u=r.base)?u.isGenerator:void 0))&&(l.unshift(this.makeCode("(yield* ")),l.push(this.makeCode(")"))),l},e.prototype.cache=function(e,t,n){var r,s,o;return r=null!=n?n(this):this.isComplex(),r?(s=new x(e.scope.freeVariable("ref")),o=new i(s,this),t?[o.compileToFragments(e,t),[this.makeCode(s.value)]]:[o,s]):(s=t?this.compileToFragments(e,t):this,[s,s])},e.prototype.cacheToCodeFragments=function(e){return[st(e[0]),st(e[1])]},e.prototype.makeReturn=function(e){var t;return t=this.unwrapAll(),e?new o(new x(e+".push"),[t]):new M(t)},e.prototype.contains=function(e){var t;return t=void 0,this.traverseChildren(!1,function(n){return e(n)?(t=n,!1):void 0}),t},e.prototype.lastNonComment=function(e){var t;for(t=e.length;t--;)if(!(e[t]instanceof l))return e[t];return null},e.prototype.toString=function(e,t){var n;return null==e&&(e=""),null==t&&(t=this.constructor.name),n="\n"+e+t,this.soak&&(n+="?"),this.eachChild(function(t){return n+=t.toString(e+q)}),n},e.prototype.eachChild=function(e){var t,n,i,r,s,o,a,c;if(!this.children)return this;for(a=this.children,i=0,s=a.length;s>i;i++)if(t=a[i],this[t])for(c=rt([this[t]]),r=0,o=c.length;o>r;r++)if(n=c[r],e(n)===!1)return this;return this},e.prototype.traverseChildren=function(e,t){return this.eachChild(function(n){var i;return i=t(n),i!==!1?n.traverseChildren(e,t):void 0})},e.prototype.invert=function(){return new I("!",this)},e.prototype.unwrapAll=function(){var e;for(e=this;e!==(e=e.unwrap()););return e},e.prototype.children=[],e.prototype.isStatement=D,e.prototype.jumps=D,e.prototype.isComplex=Q,e.prototype.isChainable=D,e.prototype.isAssignable=D,e.prototype.unwrap=X,e.prototype.unfoldSoak=D,e.prototype.assigns=D,e.prototype.updateLocationDataIfMissing=function(e){return this.locationData?this:(this.locationData=e,this.eachChild(function(t){return t.updateLocationDataIfMissing(e)}))},e.prototype.error=function(e){return vt(e,this.locationData)},e.prototype.makeCode=function(e){return new h(this,e)},e.prototype.wrapInBraces=function(e){return[].concat(this.makeCode("("),e,this.makeCode(")"))},e.prototype.joinFragmentArrays=function(e,t){var n,i,r,s,o;for(n=[],r=s=0,o=e.length;o>s;r=++s)i=e[r],r&&n.push(this.makeCode(t)),n=n.concat(i);return n},e}(),e.Block=s=function(e){function t(e){this.expressions=et(rt(e||[]))}return kt(t,e),t.prototype.children=["expressions"],t.prototype.push=function(e){return this.expressions.push(e),this},t.prototype.pop=function(){return this.expressions.pop()},t.prototype.unshift=function(e){return this.expressions.unshift(e),this},t.prototype.unwrap=function(){return 1===this.expressions.length?this.expressions[0]:this},t.prototype.isEmpty=function(){return!this.expressions.length},t.prototype.isStatement=function(e){var t,n,i,r;for(r=this.expressions,n=0,i=r.length;i>n;n++)if(t=r[n],t.isStatement(e))return!0;return!1},t.prototype.jumps=function(e){var t,n,i,r,s;for(s=this.expressions,n=0,r=s.length;r>n;n++)if(t=s[n],i=t.jumps(e))return i},t.prototype.makeReturn=function(e){var t,n;for(n=this.expressions.length;n--;)if(t=this.expressions[n],!(t instanceof l)){this.expressions[n]=t.makeReturn(e),t instanceof M&&!t.expression&&this.expressions.splice(n,1);break}return this},t.prototype.compileToFragments=function(e,n){return null==e&&(e={}),e.scope?t.__super__.compileToFragments.call(this,e,n):this.compileRoot(e)},t.prototype.compileNode=function(e){var n,i,r,s,o,a,c,h,l;for(this.tab=e.indent,l=e.level===L,i=[],h=this.expressions,s=o=0,a=h.length;a>o;s=++o)c=h[s],c=c.unwrapAll(),c=c.unfoldSoak(e)||c,c instanceof t?i.push(c.compileNode(e)):l?(c.front=!0,r=c.compileToFragments(e),c.isStatement(e)||(r.unshift(this.makeCode(""+this.tab)),r.push(this.makeCode(";"))),i.push(r)):i.push(c.compileToFragments(e,E));return l?this.spaced?[].concat(this.joinFragmentArrays(i,"\n\n"),this.makeCode("\n")):this.joinFragmentArrays(i,"\n"):(n=i.length?this.joinFragmentArrays(i,", "):[this.makeCode("void 0")],i.length>1&&e.level>=E?this.wrapInBraces(n):n)},t.prototype.compileRoot=function(e){var t,n,i,r,s,o,a,c,h,u,p;for(e.indent=e.bare?"":q,e.level=L,this.spaced=!0,e.scope=new P(null,this,null,null!=(h=e.referencedVars)?h:[]),u=e.locals||[],r=0,s=u.length;s>r;r++)o=u[r],e.scope.parameter(o);return a=[],e.bare||(c=function(){var e,n,r,s;for(r=this.expressions,s=[],i=e=0,n=r.length;n>e&&(t=r[i],t.unwrap()instanceof l);i=++e)s.push(t);return s}.call(this),p=this.expressions.slice(c.length),this.expressions=c,c.length&&(a=this.compileNode(lt(e,{indent:""})),a.push(this.makeCode("\n"))),this.expressions=p),n=this.compileWithDeclarations(e),e.bare?n:[].concat(a,this.makeCode("(function() {\n"),n,this.makeCode("\n}).call(this);\n"))},t.prototype.compileWithDeclarations=function(e){var t,n,i,r,s,o,a,c,h,u,p,d,f,m;for(r=[],c=[],h=this.expressions,s=o=0,a=h.length;a>o&&(i=h[s],i=i.unwrap(),i instanceof l||i instanceof x);s=++o);return e=lt(e,{level:L}),s&&(d=this.expressions.splice(s,9e9),u=[this.spaced,!1],m=u[0],this.spaced=u[1],p=[this.compileNode(e),m],r=p[0],this.spaced=p[1],this.expressions=d),c=this.compileNode(e),f=e.scope,f.expressions===this&&(n=e.scope.hasDeclarations(),t=f.hasAssignments,n||t?(s&&r.push(this.makeCode("\n")),r.push(this.makeCode(this.tab+"var ")),n&&r.push(this.makeCode(f.declaredVariables().join(", "))),t&&(n&&r.push(this.makeCode(",\n"+(this.tab+q))),r.push(this.makeCode(f.assignedVariables().join(",\n"+(this.tab+q))))),r.push(this.makeCode(";\n"+(this.spaced?"\n":"")))):r.length&&c.length&&r.push(this.makeCode("\n"))),r.concat(c)},t.wrap=function(e){return 1===e.length&&e[0]instanceof t?e[0]:new t(e)},t}(r),e.Literal=x=function(e){function t(e){this.value=e}return kt(t,e),t.prototype.makeReturn=function(){return this.isStatement()?this:t.__super__.makeReturn.apply(this,arguments)},t.prototype.isAssignable=function(){return g.test(this.value)},t.prototype.isStatement=function(){var e;return"break"===(e=this.value)||"continue"===e||"debugger"===e},t.prototype.isComplex=D,t.prototype.assigns=function(e){return e===this.value},t.prototype.jumps=function(e){return"break"!==this.value||(null!=e?e.loop:void 0)||(null!=e?e.block:void 0)?"continue"!==this.value||(null!=e?e.loop:void 0)?void 0:this:this},t.prototype.compileNode=function(e){var t,n,i;return n="this"===this.value?(null!=(i=e.scope.method)?i.bound:void 0)?e.scope.method.context:this.value:this.value.reserved?'"'+this.value+'"':this.value,t=this.isStatement()?""+this.tab+n+";":n,[this.makeCode(t)]},t.prototype.toString=function(){return' "'+this.value+'"'},t}(r),e.Undefined=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return kt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(e){return[this.makeCode(e.level>=T?"(void 0)":"void 0")]},t}(r),e.Null=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return kt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(){return[this.makeCode("null")]},t}(r),e.Bool=function(e){function t(e){this.val=e}return kt(t,e),t.prototype.isAssignable=D,t.prototype.isComplex=D,t.prototype.compileNode=function(){return[this.makeCode(this.val)]},t}(r),e.Return=M=function(e){function t(e){this.expression=e}return kt(t,e),t.prototype.children=["expression"],t.prototype.isStatement=Q,t.prototype.makeReturn=X,t.prototype.jumps=X,t.prototype.compileToFragments=function(e,n){var i,r;return i=null!=(r=this.expression)?r.makeReturn():void 0,!i||i instanceof t?t.__super__.compileToFragments.call(this,e,n):i.compileToFragments(e,n)},t.prototype.compileNode=function(e){var t,n,i;return t=[],n=null!=(i=this.expression)?"function"==typeof i.isYieldReturn?i.isYieldReturn():void 0:void 0,n||t.push(this.makeCode(this.tab+("return"+(this.expression?" ":"")))),this.expression&&(t=t.concat(this.expression.compileToFragments(e,N))),n||t.push(this.makeCode(";")),t},t}(r),e.Value=z=function(e){function t(e,n,i){return!n&&e instanceof t?e:(this.base=e,this.properties=n||[],i&&(this[i]=!0),this)}return kt(t,e),t.prototype.children=["base","properties"],t.prototype.add=function(e){return this.properties=this.properties.concat(e),this},t.prototype.hasProperties=function(){return!!this.properties.length},t.prototype.bareLiteral=function(e){return!this.properties.length&&this.base instanceof e},t.prototype.isArray=function(){return this.bareLiteral(n)},t.prototype.isRange=function(){return this.bareLiteral(j)},t.prototype.isComplex=function(){return this.hasProperties()||this.base.isComplex()},t.prototype.isAssignable=function(){return this.hasProperties()||this.base.isAssignable()},t.prototype.isSimpleNumber=function(){return this.bareLiteral(x)&&B.test(this.base.value)},t.prototype.isString=function(){return this.bareLiteral(x)&&y.test(this.base.value)},t.prototype.isRegex=function(){return this.bareLiteral(x)&&v.test(this.base.value)},t.prototype.isAtomic=function(){var e,t,n,i;for(i=this.properties.concat(this.base),e=0,t=i.length;t>e;e++)if(n=i[e],n.soak||n instanceof o)return!1;return!0},t.prototype.isNotCallable=function(){return this.isSimpleNumber()||this.isString()||this.isRegex()||this.isArray()||this.isRange()||this.isSplice()||this.isObject()},t.prototype.isStatement=function(e){return!this.properties.length&&this.base.isStatement(e)},t.prototype.assigns=function(e){return!this.properties.length&&this.base.assigns(e)},t.prototype.jumps=function(e){return!this.properties.length&&this.base.jumps(e)},t.prototype.isObject=function(e){return this.properties.length?!1:this.base instanceof A&&(!e||this.base.generated)},t.prototype.isSplice=function(){var e,t;return t=this.properties,e=t[t.length-1],e instanceof U},t.prototype.looksStatic=function(e){var t;return this.base.value===e&&1===this.properties.length&&"prototype"!==(null!=(t=this.properties[0].name)?t.value:void 0)},t.prototype.unwrap=function(){return this.properties.length?this:this.base},t.prototype.cacheReference=function(e){var n,r,s,o,a;return a=this.properties,s=a[a.length-1],2>this.properties.length&&!this.base.isComplex()&&!(null!=s?s.isComplex():void 0)?[this,this]:(n=new t(this.base,this.properties.slice(0,-1)),n.isComplex()&&(r=new x(e.scope.freeVariable("base")),n=new t(new O(new i(r,n)))),s?(s.isComplex()&&(o=new x(e.scope.freeVariable("name")),s=new w(new i(o,s.index)),o=new w(o)),[n.add(s),new t(r||n.base,[o||s])]):[n,r])},t.prototype.compileNode=function(e){var t,n,i,r,s;for(this.base.front=this.front,s=this.properties,t=this.base.compileToFragments(e,s.length?T:null),(this.base instanceof O||s.length)&&B.test(st(t))&&t.push(this.makeCode(".")),n=0,i=s.length;i>n;n++)r=s[n],t.push.apply(t,r.compileToFragments(e));return t},t.prototype.unfoldSoak=function(e){return null!=this.unfoldedSoak?this.unfoldedSoak:this.unfoldedSoak=function(n){return function(){var r,s,o,a,c,h,l,p,d,f;if(o=n.base.unfoldSoak(e))return(p=o.body.properties).push.apply(p,n.properties),o;for(d=n.properties,s=a=0,c=d.length;c>a;s=++a)if(h=d[s],h.soak)return h.soak=!1,r=new t(n.base,n.properties.slice(0,s)),f=new t(n.base,n.properties.slice(s)),r.isComplex()&&(l=new x(e.scope.freeVariable("ref")),r=new O(new i(l,r)),f.base=l),new b(new u(r),f,{soak:!0});return!1}}(this)()},t}(r),e.Comment=l=function(e){function t(e){this.comment=e}return kt(t,e),t.prototype.isStatement=Q,t.prototype.makeReturn=X,t.prototype.compileNode=function(e,t){var n,i;return i=this.comment.replace(/^(\s*)#(?=\s)/gm,"$1 *"),n="/*"+ut(i,this.tab)+(Tt.call(i,"\n")>=0?"\n"+this.tab:"")+" */",(t||e.level)===L&&(n=e.indent+n),[this.makeCode("\n"),this.makeCode(n)]},t}(r),e.Call=o=function(e){function n(e,t,n){this.args=null!=t?t:[],this.soak=n,this.isNew=!1,this.isSuper="super"===e,this.variable=this.isSuper?null:e,e instanceof z&&e.isNotCallable()&&e.error("literal is not a function")}return kt(n,e),n.prototype.children=["variable","args"],n.prototype.newInstance=function(){var e,t;return e=(null!=(t=this.variable)?t.base:void 0)||this.variable,e instanceof n&&!e.isNew?e.newInstance():this.isNew=!0,this},n.prototype.superReference=function(e){var n,r,s,o,a,c,h,l;return a=e.scope.namedMethod(),(null!=a?a.klass:void 0)?(o=a.klass,c=a.name,l=a.variable,o.isComplex()&&(s=new x(e.scope.parent.freeVariable("base")),r=new z(new O(new i(s,o))),l.base=r,l.properties.splice(0,o.properties.length)),(c.isComplex()||c instanceof w&&c.index.isAssignable())&&(h=new x(e.scope.parent.freeVariable("name")),c=new w(new i(h,c.index)),l.properties.pop(),l.properties.push(c)),n=[new t(new x("__super__"))],a["static"]&&n.push(new t(new x("constructor"))),n.push(null!=h?new w(h):c),new z(null!=s?s:o,n).compile(e)):(null!=a?a.ctor:void 0)?a.name+".__super__.constructor":this.error("cannot call super outside of an instance method.")},n.prototype.superThis=function(e){var t;return t=e.scope.method,t&&!t.klass&&t.context||"this"},n.prototype.unfoldSoak=function(e){var t,i,r,s,o,a,c,h,l;if(this.soak){if(this.variable){if(i=yt(e,this,"variable"))return i;c=new z(this.variable).cacheReference(e),s=c[0],l=c[1]}else s=new x(this.superReference(e)),l=new z(s);return l=new n(l,this.args),l.isNew=this.isNew,s=new x("typeof "+s.compile(e)+' === "function"'),new b(s,new z(l),{soak:!0})}for(t=this,a=[];;)if(t.variable instanceof n)a.push(t),t=t.variable;else{if(!(t.variable instanceof z))break;if(a.push(t),!((t=t.variable.base)instanceof n))break}for(h=a.reverse(),r=0,o=h.length;o>r;r++)t=h[r],i&&(t.variable instanceof n?t.variable=i:t.variable.base=i),i=yt(e,t,"variable");return i},n.prototype.compileNode=function(e){var t,n,i,r,s,o,a,c,h,l;if(null!=(h=this.variable)&&(h.front=this.front),r=G.compileSplattedArray(e,this.args,!0),r.length)return this.compileSplat(e,r);for(i=[],l=this.args,n=o=0,a=l.length;a>o;n=++o)t=l[n],n&&i.push(this.makeCode(", ")),i.push.apply(i,t.compileToFragments(e,E));return s=[],this.isSuper?(c=this.superReference(e)+(".call("+this.superThis(e)),i.length&&(c+=", "),s.push(this.makeCode(c))):(this.isNew&&s.push(this.makeCode("new ")),s.push.apply(s,this.variable.compileToFragments(e,T)),s.push(this.makeCode("("))),s.push.apply(s,i),s.push(this.makeCode(")")),s},n.prototype.compileSplat=function(e,t){var n,i,r,s,o,a;return this.isSuper?[].concat(this.makeCode(this.superReference(e)+".apply("+this.superThis(e)+", "),t,this.makeCode(")")):this.isNew?(s=this.tab+q,[].concat(this.makeCode("(function(func, args, ctor) {\n"+s+"ctor.prototype = func.prototype;\n"+s+"var child = new ctor, result = func.apply(child, args);\n"+s+"return Object(result) === result ? result : child;\n"+this.tab+"})("),this.variable.compileToFragments(e,E),this.makeCode(", "),t,this.makeCode(", function(){})"))):(n=[],i=new z(this.variable),(o=i.properties.pop())&&i.isComplex()?(a=e.scope.freeVariable("ref"),n=n.concat(this.makeCode("("+a+" = "),i.compileToFragments(e,E),this.makeCode(")"),o.compileToFragments(e))):(r=i.compileToFragments(e,T),B.test(st(r))&&(r=this.wrapInBraces(r)),o?(a=st(r),r.push.apply(r,o.compileToFragments(e))):a="null",n=n.concat(r)),n=n.concat(this.makeCode(".apply("+a+", "),t,this.makeCode(")")))},n}(r),e.Extends=d=function(e){function t(e,t){this.child=e,this.parent=t}return kt(t,e),t.prototype.children=["child","parent"],t.prototype.compileToFragments=function(e){return new o(new z(new x(bt("extend",e))),[this.child,this.parent]).compileToFragments(e)},t}(r),e.Access=t=function(e){function t(e,t){this.name=e,this.name.asKey=!0,this.soak="soak"===t}return kt(t,e),t.prototype.children=["name"],t.prototype.compileToFragments=function(e){var t;return t=this.name.compileToFragments(e),g.test(st(t))?t.unshift(this.makeCode(".")):(t.unshift(this.makeCode("[")),t.push(this.makeCode("]"))),t},t.prototype.isComplex=D,t}(r),e.Index=w=function(e){function t(e){this.index=e}return kt(t,e),t.prototype.children=["index"],t.prototype.compileToFragments=function(e){return[].concat(this.makeCode("["),this.index.compileToFragments(e,N),this.makeCode("]"))},t.prototype.isComplex=function(){return this.index.isComplex()},t}(r),e.Range=j=function(e){function t(e,t,n){this.from=e,this.to=t,this.exclusive="exclusive"===n,this.equals=this.exclusive?"":"="}return kt(t,e),t.prototype.children=["from","to"],t.prototype.compileVariables=function(e){var t,n,i,r,s,o;return e=lt(e,{top:!0}),t=tt(e,"isComplex"),n=this.cacheToCodeFragments(this.from.cache(e,E,t)),this.fromC=n[0],this.fromVar=n[1],i=this.cacheToCodeFragments(this.to.cache(e,E,t)),this.toC=i[0],this.toVar=i[1],(o=tt(e,"step"))&&(r=this.cacheToCodeFragments(o.cache(e,E,t)),this.step=r[0],this.stepVar=r[1]),s=[this.fromVar.match(R),this.toVar.match(R)],this.fromNum=s[0],this.toNum=s[1],this.stepVar?this.stepNum=this.stepVar.match(R):void 0},t.prototype.compileNode=function(e){var t,n,i,r,s,o,a,c,h,l,u,p,d,f;return this.fromVar||this.compileVariables(e),e.index?(a=this.fromNum&&this.toNum,s=tt(e,"index"),o=tt(e,"name"),h=o&&o!==s,f=s+" = "+this.fromC,this.toC!==this.toVar&&(f+=", "+this.toC),this.step!==this.stepVar&&(f+=", "+this.step),l=[s+" <"+this.equals,s+" >"+this.equals],c=l[0],r=l[1],n=this.stepNum?pt(this.stepNum[0])>0?c+" "+this.toVar:r+" "+this.toVar:a?(u=[pt(this.fromNum[0]),pt(this.toNum[0])],i=u[0],d=u[1],u,d>=i?c+" "+d:r+" "+d):(t=this.stepVar?this.stepVar+" > 0":this.fromVar+" <= "+this.toVar,t+" ? "+c+" "+this.toVar+" : "+r+" "+this.toVar),p=this.stepVar?s+" += "+this.stepVar:a?h?d>=i?"++"+s:"--"+s:d>=i?s+"++":s+"--":h?t+" ? ++"+s+" : --"+s:t+" ? "+s+"++ : "+s+"--",h&&(f=o+" = "+f),h&&(p=o+" = "+p),[this.makeCode(f+"; "+n+"; "+p)]):this.compileArray(e)},t.prototype.compileArray=function(e){var t,n,i,r,s,o,a,c,h,l,u,p,d;return this.fromNum&&this.toNum&&20>=Math.abs(this.fromNum-this.toNum)?(h=function(){p=[];for(var e=l=+this.fromNum,t=+this.toNum;t>=l?t>=e:e>=t;t>=l?e++:e--)p.push(e);return p}.apply(this),this.exclusive&&h.pop(),[this.makeCode("["+h.join(", ")+"]")]):(o=this.tab+q,s=e.scope.freeVariable("i",{single:!0}),u=e.scope.freeVariable("results"),c="\n"+o+u+" = [];",this.fromNum&&this.toNum?(e.index=s,n=st(this.compileNode(e))):(d=s+" = "+this.fromC+(this.toC!==this.toVar?", "+this.toC:""),i=this.fromVar+" <= "+this.toVar,n="var "+d+"; "+i+" ? "+s+" <"+this.equals+" "+this.toVar+" : "+s+" >"+this.equals+" "+this.toVar+"; "+i+" ? "+s+"++ : "+s+"--"),a="{ "+u+".push("+s+"); }\n"+o+"return "+u+";\n"+e.indent,r=function(e){return null!=e?e.contains(at):void 0},(r(this.from)||r(this.to))&&(t=", arguments"),[this.makeCode("(function() {"+c+"\n"+o+"for ("+n+")"+a+"}).apply(this"+(null!=t?t:"")+")")])},t}(r),e.Slice=U=function(e){function t(e){this.range=e,t.__super__.constructor.call(this)}return kt(t,e),t.prototype.children=["range"],t.prototype.compileNode=function(e){var t,n,i,r,s,o,a;return s=this.range,o=s.to,i=s.from,r=i&&i.compileToFragments(e,N)||[this.makeCode("0")],o&&(t=o.compileToFragments(e,N),n=st(t),(this.range.exclusive||-1!==+n)&&(a=", "+(this.range.exclusive?n:B.test(n)?""+(+n+1):(t=o.compileToFragments(e,T),"+"+st(t)+" + 1 || 9e9")))),[this.makeCode(".slice("+st(r)+(a||"")+")")]},t}(r),e.Obj=A=function(e){function n(e,t){this.generated=null!=t?t:!1,this.objects=this.properties=e||[]}return kt(n,e),n.prototype.children=["properties"],n.prototype.compileNode=function(e){var n,r,s,o,a,c,h,u,p,d,f,m,g,v,y,b,k,w,T,C,E;if(T=this.properties,this.generated)for(h=0,g=T.length;g>h;h++)b=T[h],b instanceof z&&b.error("cannot have an implicit value in an implicit object");for(r=p=0,v=T.length;v>p&&(w=T[r],!((w.variable||w).base instanceof O));r=++p);for(s=T.length>r,a=e.indent+=q,m=this.lastNonComment(this.properties),n=[],s&&(k=e.scope.freeVariable("obj"),n.push(this.makeCode("(\n"+a+k+" = "))),n.push(this.makeCode("{"+(0===T.length||0===r?"}":"\n"))),o=f=0,y=T.length;y>f;o=++f)w=T[o],o===r&&(0!==o&&n.push(this.makeCode("\n"+a+"}")),n.push(this.makeCode(",\n"))),u=o===T.length-1||o===r-1?"":w===m||w instanceof l?"\n":",\n",c=w instanceof l?"":a,s&&r>o&&(c+=q),w instanceof i&&w.variable instanceof z&&w.variable.hasProperties()&&w.variable.error("invalid object key"),w instanceof z&&w["this"]&&(w=new i(w.properties[0].name,w,"object")),w instanceof l||(r>o?(w instanceof i||(w=new i(w,w,"object")),(w.variable.base||w.variable).asKey=!0):(w instanceof i?(d=w.variable,E=w.value):(C=w.base.cache(e),d=C[0],E=C[1]),w=new i(new z(new x(k),[new t(d)]),E))),c&&n.push(this.makeCode(c)),n.push.apply(n,w.compileToFragments(e,L)),u&&n.push(this.makeCode(u));return s?n.push(this.makeCode(",\n"+a+k+"\n"+this.tab+")")):0!==T.length&&n.push(this.makeCode("\n"+this.tab+"}")),this.front&&!s?this.wrapInBraces(n):n},n.prototype.assigns=function(e){var t,n,i,r;for(r=this.properties,t=0,n=r.length;n>t;t++)if(i=r[t],i.assigns(e))return!0;return!1},n}(r),e.Arr=n=function(e){function t(e){this.objects=e||[]}return kt(t,e),t.prototype.children=["objects"],t.prototype.compileNode=function(e){var t,n,i,r,s,o,a;if(!this.objects.length)return[this.makeCode("[]")];if(e.indent+=q,t=G.compileSplattedArray(e,this.objects),t.length)return t;for(t=[],n=function(){var t,n,i,r;for(i=this.objects,r=[],t=0,n=i.length;n>t;t++)a=i[t],r.push(a.compileToFragments(e,E));return r}.call(this),r=s=0,o=n.length;o>s;r=++s)i=n[r],r&&t.push(this.makeCode(", ")),t.push.apply(t,i);return st(t).indexOf("\n")>=0?(t.unshift(this.makeCode("[\n"+e.indent)),t.push(this.makeCode("\n"+this.tab+"]"))):(t.unshift(this.makeCode("[")),t.push(this.makeCode("]"))),t},t.prototype.assigns=function(e){var t,n,i,r;for(r=this.objects,t=0,n=r.length;n>t;t++)if(i=r[t],i.assigns(e))return!0;return!1},t}(r),e.Class=a=function(e){function n(e,t,n){this.variable=e,this.parent=t,this.body=null!=n?n:new s,this.boundFuncs=[],this.body.classBody=!0}return kt(n,e),n.prototype.children=["variable","parent","body"],n.prototype.determineName=function(){var e,n,i;return this.variable?(n=this.variable.properties,i=n[n.length-1],e=i?i instanceof t&&i.name.value:this.variable.base.value,Tt.call(V,e)>=0&&this.variable.error("class variable name may not be "+e),e&&(e=g.test(e)&&e)):null},n.prototype.setContext=function(e){return this.body.traverseChildren(!1,function(t){return t.classBody?!1:t instanceof x&&"this"===t.value?t.value=e:t instanceof c&&t.bound?t.context=e:void 0})},n.prototype.addBoundFunctions=function(e){var n,i,r,s,o;for(o=this.boundFuncs,i=0,r=o.length;r>i;i++)n=o[i],s=new z(new x("this"),[new t(n)]).compile(e),this.ctor.body.unshift(new x(s+" = "+bt("bind",e)+"("+s+", this)"))},n.prototype.addProperties=function(e,n,r){var s,o,a,h,l,u;return u=e.base.properties.slice(0),h=function(){var e;for(e=[];o=u.shift();)o instanceof i&&(a=o.variable.base,delete o.context,l=o.value,"constructor"===a.value?(this.ctor&&o.error("cannot define more than one constructor in a class"),l.bound&&o.error("cannot define a constructor as a bound function"),l instanceof c?o=this.ctor=l:(this.externalCtor=r.classScope.freeVariable("class"),o=new i(new x(this.externalCtor),l))):o.variable["this"]?l["static"]=!0:(s=a.isComplex()?new w(a):new t(a),o.variable=new z(new x(n),[new t(new x("prototype")),s]),l instanceof c&&l.bound&&(this.boundFuncs.push(a),l.bound=!1))),e.push(o);return e}.call(this),et(h)},n.prototype.walkBody=function(e,t){return this.traverseChildren(!1,function(r){return function(o){var a,c,h,l,u,p,d;if(a=!0,o instanceof n)return!1;if(o instanceof s){for(d=c=o.expressions,h=l=0,u=d.length;u>l;h=++l)p=d[h],p instanceof i&&p.variable.looksStatic(e)?p.value["static"]=!0:p instanceof z&&p.isObject(!0)&&(a=!1,c[h]=r.addProperties(p,e,t));o.expressions=c=rt(c)}return a&&!(o instanceof n)}}(this))},n.prototype.hoistDirectivePrologue=function(){var e,t,n;for(t=0,e=this.body.expressions;(n=e[t])&&n instanceof l||n instanceof z&&n.isString();)++t;return this.directives=e.splice(0,t)},n.prototype.ensureConstructor=function(e){return this.ctor||(this.ctor=new c,this.externalCtor?this.ctor.body.push(new x(this.externalCtor+".apply(this, arguments)")):this.parent&&this.ctor.body.push(new x(e+".__super__.constructor.apply(this, arguments)")),this.ctor.body.makeReturn(),this.body.expressions.unshift(this.ctor)),this.ctor.ctor=this.ctor.name=e,this.ctor.klass=null,this.ctor.noReturn=!0},n.prototype.compileNode=function(e){var t,n,r,a,h,l,u,p,f;return(a=this.body.jumps())&&a.error("Class bodies cannot contain pure statements"),(n=this.body.contains(at))&&n.error("Class bodies shouldn't reference arguments"),u=this.determineName()||"_Class",u.reserved&&(u="_"+u),l=new x(u),r=new c([],s.wrap([this.body])),t=[],e.classScope=r.makeScope(e.scope),this.hoistDirectivePrologue(),this.setContext(u),this.walkBody(u,e),this.ensureConstructor(u),this.addBoundFunctions(e),this.body.spaced=!0,this.body.expressions.push(l),this.parent&&(f=new x(e.classScope.freeVariable("superClass",{reserve:!1})),this.body.expressions.unshift(new d(l,f)),r.params.push(new _(f)),t.push(this.parent)),(p=this.body.expressions).unshift.apply(p,this.directives),h=new O(new o(r,t)),this.variable&&(h=new i(this.variable,h)),h.compileToFragments(e)},n}(r),e.Assign=i=function(e){function n(e,t,n,i){var r,s,o;this.variable=e,this.value=t,this.context=n,this.param=i&&i.param,this.subpattern=i&&i.subpattern,o=s=this.variable.unwrapAll().value,r=Tt.call(V,o)>=0,r&&"object"!==this.context&&this.variable.error('variable name may not be "'+s+'"')}return kt(n,e),n.prototype.children=["variable","value"],n.prototype.isStatement=function(e){return(null!=e?e.level:void 0)===L&&null!=this.context&&Tt.call(this.context,"?")>=0 },n.prototype.assigns=function(e){return this["object"===this.context?"value":"variable"].assigns(e)},n.prototype.unfoldSoak=function(e){return yt(e,this,"variable")},n.prototype.compileNode=function(e){var t,n,i,r,s,o,a,h,l,u,p,d,f,m;if(i=this.variable instanceof z){if(this.variable.isArray()||this.variable.isObject())return this.compilePatternMatch(e);if(this.variable.isSplice())return this.compileSplice(e);if("||="===(h=this.context)||"&&="===h||"?="===h)return this.compileConditional(e);if("**="===(l=this.context)||"//="===l||"%%="===l)return this.compileSpecialMath(e)}return this.value instanceof c&&(this.value["static"]?(this.value.klass=this.variable.base,this.value.name=this.variable.properties[0],this.value.variable=this.variable):(null!=(u=this.variable.properties)?u.length:void 0)>=2&&(p=this.variable.properties,o=p.length>=3?Ct.call(p,0,r=p.length-2):(r=0,[]),a=p[r++],s=p[r++],"prototype"===(null!=(d=a.name)?d.value:void 0)&&(this.value.klass=new z(this.variable.base,o),this.value.name=s,this.value.variable=this.variable))),this.context||(m=this.variable.unwrapAll(),m.isAssignable()||this.variable.error('"'+this.variable.compile(e)+'" cannot be assigned'),("function"==typeof m.hasProperties?m.hasProperties():void 0)||(this.param?e.scope.add(m.value,"var"):e.scope.find(m.value))),f=this.value.compileToFragments(e,E),n=this.variable.compileToFragments(e,E),"object"===this.context?n.concat(this.makeCode(": "),f):(t=n.concat(this.makeCode(" "+(this.context||"=")+" "),f),E>=e.level?t:this.wrapInBraces(t))},n.prototype.compilePatternMatch=function(e){var i,r,s,o,a,c,h,l,u,d,f,m,v,y,b,k,T,C,N,S,D,R,A,I,_,j,M,B;if(I=e.level===L,j=this.value,y=this.variable.base.objects,!(b=y.length))return s=j.compileToFragments(e),e.level>=F?this.wrapInBraces(s):s;if(l=this.variable.isObject(),I&&1===b&&!((v=y[0])instanceof G))return v instanceof n?(T=v,C=T.variable,h=C.base,v=T.value):h=l?v["this"]?v.properties[0].name:v:new x(0),i=g.test(h.unwrap().value||0),j=new z(j),j.properties.push(new(i?t:w)(h)),N=v.unwrap().value,Tt.call($,N)>=0&&v.error("assignment to a reserved word: "+v.compile(e)),new n(v,j,null,{param:this.param}).compileToFragments(e,L);for(M=j.compileToFragments(e,E),B=st(M),r=[],o=!1,(!g.test(B)||this.variable.assigns(B))&&(r.push([this.makeCode((k=e.scope.freeVariable("ref"))+" = ")].concat(Ct.call(M))),M=[this.makeCode(k)],B=k),c=d=0,f=y.length;f>d;c=++d){if(v=y[c],h=c,l&&(v instanceof n?(S=v,D=S.variable,h=D.base,v=S.value):v.base instanceof O?(R=new z(v.unwrapAll()).cacheReference(e),v=R[0],h=R[1]):h=v["this"]?v.properties[0].name:v),!o&&v instanceof G)m=v.name.unwrap().value,v=v.unwrap(),_=b+" <= "+B+".length ? "+bt("slice",e)+".call("+B+", "+c,(A=b-c-1)?(u=e.scope.freeVariable("i",{single:!0}),_+=", "+u+" = "+B+".length - "+A+") : ("+u+" = "+c+", [])"):_+=") : []",_=new x(_),o=u+"++";else{if(!o&&v instanceof p){(A=b-c-1)&&(1===A?o=B+".length - 1":(u=e.scope.freeVariable("i",{single:!0}),_=new x(u+" = "+B+".length - "+A),o=u+"++",r.push(_.compileToFragments(e,E))));continue}m=v.unwrap().value,(v instanceof G||v instanceof p)&&v.error("multiple splats/expansions are disallowed in an assignment"),"number"==typeof h?(h=new x(o||h),i=!1):i=l&&g.test(h.unwrap().value||0),_=new z(new x(B),[new(i?t:w)(h)])}null!=m&&Tt.call($,m)>=0&&v.error("assignment to a reserved word: "+v.compile(e)),r.push(new n(v,_,null,{param:this.param,subpattern:!0}).compileToFragments(e,E))}return I||this.subpattern||r.push(M),a=this.joinFragmentArrays(r,", "),E>e.level?a:this.wrapInBraces(a)},n.prototype.compileConditional=function(e){var t,i,r,s;return r=this.variable.cacheReference(e),i=r[0],s=r[1],!i.properties.length&&i.base instanceof x&&"this"!==i.base.value&&!e.scope.check(i.base.value)&&this.variable.error('the variable "'+i.base.value+"\" can't be assigned with "+this.context+" because it has not been declared before"),Tt.call(this.context,"?")>=0?(e.isExistentialEquals=!0,new b(new u(i),s,{type:"if"}).addElse(new n(s,this.value,"=")).compileToFragments(e)):(t=new I(this.context.slice(0,-1),i,new n(s,this.value,"=")).compileToFragments(e),E>=e.level?t:this.wrapInBraces(t))},n.prototype.compileSpecialMath=function(e){var t,i,r;return i=this.variable.cacheReference(e),t=i[0],r=i[1],new n(t,new I(this.context.slice(0,-1),r,this.value)).compileToFragments(e)},n.prototype.compileSplice=function(e){var t,n,i,r,s,o,a,c,h,l,u,p;return a=this.variable.properties.pop().range,i=a.from,l=a.to,n=a.exclusive,o=this.variable.compile(e),i?(c=this.cacheToCodeFragments(i.cache(e,F)),r=c[0],s=c[1]):r=s="0",l?i instanceof z&&i.isSimpleNumber()&&l instanceof z&&l.isSimpleNumber()?(l=l.compile(e)-s,n||(l+=1)):(l=l.compile(e,T)+" - "+s,n||(l+=" + 1")):l="9e9",h=this.value.cache(e,E),u=h[0],p=h[1],t=[].concat(this.makeCode("[].splice.apply("+o+", ["+r+", "+l+"].concat("),u,this.makeCode(")), "),p),e.level>L?this.wrapInBraces(t):t},n}(r),e.Code=c=function(e){function t(e,t,n){this.params=e||[],this.body=t||new s,this.bound="boundfunc"===n,this.isGenerator=!!this.body.contains(function(e){var t;return e instanceof I&&("yield"===(t=e.operator)||"yield*"===t)})}return kt(t,e),t.prototype.children=["params","body"],t.prototype.isStatement=function(){return!!this.ctor},t.prototype.jumps=D,t.prototype.makeScope=function(e){return new P(e,this.body,this)},t.prototype.compileNode=function(e){var r,a,c,h,l,u,d,f,m,g,v,y,k,w,C,E,F,N,L,S,D,R,A,O,$,j,M,B,V,P,U,G,H;if(this.bound&&(null!=(A=e.scope.method)?A.bound:void 0)&&(this.context=e.scope.method.context),this.bound&&!this.context)return this.context="_this",H=new t([new _(new x(this.context))],new s([this])),a=new o(H,[new x("this")]),a.updateLocationDataIfMissing(this.locationData),a.compileNode(e);for(e.scope=tt(e,"classScope")||this.makeScope(e.scope),e.scope.shared=tt(e,"sharedScope"),e.indent+=q,delete e.bare,delete e.isExistentialEquals,L=[],h=[],O=this.params,u=0,m=O.length;m>u;u++)N=O[u],N instanceof p||e.scope.parameter(N.asReference(e));for($=this.params,d=0,g=$.length;g>d;d++)if(N=$[d],N.splat||N instanceof p){for(j=this.params,f=0,v=j.length;v>f;f++)F=j[f],F instanceof p||!F.name.value||e.scope.add(F.name.value,"var",!0);V=new i(new z(new n(function(){var t,n,i,r;for(i=this.params,r=[],n=0,t=i.length;t>n;n++)F=i[n],r.push(F.asReference(e));return r}.call(this))),new z(new x("arguments")));break}for(M=this.params,E=0,y=M.length;y>E;E++)N=M[E],N.isComplex()?(U=R=N.asReference(e),N.value&&(U=new I("?",R,N.value)),h.push(new i(new z(N.name),U,"=",{param:!0}))):(R=N,N.value&&(C=new x(R.name.value+" == null"),U=new i(new z(N.name),N.value,"="),h.push(new b(C,U)))),V||L.push(R);for(G=this.body.isEmpty(),V&&h.unshift(V),h.length&&(B=this.body.expressions).unshift.apply(B,h),l=S=0,k=L.length;k>S;l=++S)F=L[l],L[l]=F.compileToFragments(e),e.scope.parameter(st(L[l]));for(P=[],this.eachParamName(function(e,t){return Tt.call(P,e)>=0&&t.error("multiple parameters named "+e),P.push(e)}),G||this.noReturn||this.body.makeReturn(),c="function",this.isGenerator&&(c+="*"),this.ctor&&(c+=" "+this.name),c+="(",r=[this.makeCode(c)],l=D=0,w=L.length;w>D;l=++D)F=L[l],l&&r.push(this.makeCode(", ")),r.push.apply(r,F);return r.push(this.makeCode(") {")),this.body.isEmpty()||(r=r.concat(this.makeCode("\n"),this.body.compileWithDeclarations(e),this.makeCode("\n"+this.tab))),r.push(this.makeCode("}")),this.ctor?[this.makeCode(this.tab)].concat(Ct.call(r)):this.front||e.level>=T?this.wrapInBraces(r):r},t.prototype.eachParamName=function(e){var t,n,i,r,s;for(r=this.params,s=[],t=0,n=r.length;n>t;t++)i=r[t],s.push(i.eachName(e));return s},t.prototype.traverseChildren=function(e,n){return e?t.__super__.traverseChildren.call(this,e,n):void 0},t}(r),e.Param=_=function(e){function t(e,t,n){var i,r;this.name=e,this.value=t,this.splat=n,r=i=this.name.unwrapAll().value,Tt.call(V,r)>=0&&this.name.error('parameter name "'+i+'" is not allowed')}return kt(t,e),t.prototype.children=["name","value"],t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e,E)},t.prototype.asReference=function(e){var t,n;return this.reference?this.reference:(n=this.name,n["this"]?(t=n.properties[0].name.value,t.reserved&&(t="_"+t),n=new x(e.scope.freeVariable(t))):n.isComplex()&&(n=new x(e.scope.freeVariable("arg"))),n=new z(n),this.splat&&(n=new G(n)),n.updateLocationDataIfMissing(this.locationData),this.reference=n)},t.prototype.isComplex=function(){return this.name.isComplex()},t.prototype.eachName=function(e,t){var n,r,s,o,a,c;if(null==t&&(t=this.name),n=function(t){return e("@"+t.properties[0].name.value,t)},t instanceof x)return e(t.value,t);if(t instanceof z)return n(t);for(c=t.objects,r=0,s=c.length;s>r;r++)a=c[r],a instanceof i?this.eachName(e,a.value.unwrap()):a instanceof G?(o=a.name.unwrap(),e(o.value,o)):a instanceof z?a.isArray()||a.isObject()?this.eachName(e,a.base):a["this"]?n(a):e(a.base.value,a.base):a instanceof p||a.error("illegal parameter "+a.compile())},t}(r),e.Splat=G=function(e){function t(e){this.name=e.compile?e:new x(e)}return kt(t,e),t.prototype.children=["name"],t.prototype.isAssignable=Q,t.prototype.assigns=function(e){return this.name.assigns(e)},t.prototype.compileToFragments=function(e){return this.name.compileToFragments(e)},t.prototype.unwrap=function(){return this.name},t.compileSplattedArray=function(e,n,i){var r,s,o,a,c,h,l,u,p,d,f;for(l=-1;(f=n[++l])&&!(f instanceof t););if(l>=n.length)return[];if(1===n.length)return f=n[0],c=f.compileToFragments(e,E),i?c:[].concat(f.makeCode(bt("slice",e)+".call("),c,f.makeCode(")"));for(r=n.slice(l),h=u=0,d=r.length;d>u;h=++u)f=r[h],o=f.compileToFragments(e,E),r[h]=f instanceof t?[].concat(f.makeCode(bt("slice",e)+".call("),o,f.makeCode(")")):[].concat(f.makeCode("["),o,f.makeCode("]"));return 0===l?(f=n[0],a=f.joinFragmentArrays(r.slice(1),", "),r[0].concat(f.makeCode(".concat("),a,f.makeCode(")"))):(s=function(){var t,i,r,s;for(r=n.slice(0,l),s=[],t=0,i=r.length;i>t;t++)f=r[t],s.push(f.compileToFragments(e,E));return s}(),s=n[0].joinFragmentArrays(s,", "),a=n[l].joinFragmentArrays(r,", "),p=n[n.length-1],[].concat(n[0].makeCode("["),s,n[l].makeCode("].concat("),a,p.makeCode(")")))},t}(r),e.Expansion=p=function(e){function t(){return t.__super__.constructor.apply(this,arguments)}return kt(t,e),t.prototype.isComplex=D,t.prototype.compileNode=function(){return this.error("Expansion must be used inside a destructuring assignment or parameter list")},t.prototype.asReference=function(){return this},t.prototype.eachName=function(){},t}(r),e.While=J=function(e){function t(e,t){this.condition=(null!=t?t.invert:void 0)?e.invert():e,this.guard=null!=t?t.guard:void 0}return kt(t,e),t.prototype.children=["condition","guard","body"],t.prototype.isStatement=Q,t.prototype.makeReturn=function(e){return e?t.__super__.makeReturn.apply(this,arguments):(this.returns=!this.jumps({loop:!0}),this)},t.prototype.addBody=function(e){return this.body=e,this},t.prototype.jumps=function(){var e,t,n,i,r;if(e=this.body.expressions,!e.length)return!1;for(t=0,i=e.length;i>t;t++)if(r=e[t],n=r.jumps({loop:!0}))return n;return!1},t.prototype.compileNode=function(e){var t,n,i,r;return e.indent+=q,r="",n=this.body,n.isEmpty()?n=this.makeCode(""):(this.returns&&(n.makeReturn(i=e.scope.freeVariable("results")),r=""+this.tab+i+" = [];\n"),this.guard&&(n.expressions.length>1?n.expressions.unshift(new b(new O(this.guard).invert(),new x("continue"))):this.guard&&(n=s.wrap([new b(this.guard,n)]))),n=[].concat(this.makeCode("\n"),n.compileToFragments(e,L),this.makeCode("\n"+this.tab))),t=[].concat(this.makeCode(r+this.tab+"while ("),this.condition.compileToFragments(e,N),this.makeCode(") {"),n,this.makeCode("}")),this.returns&&t.push(this.makeCode("\n"+this.tab+"return "+i+";")),t},t}(r),e.Op=I=function(e){function n(e,t,n,i){if("in"===e)return new k(t,n);if("do"===e)return this.generateDo(t);if("new"===e){if(t instanceof o&&!t["do"]&&!t.isNew)return t.newInstance();(t instanceof c&&t.bound||t["do"])&&(t=new O(t))}return this.operator=r[e]||e,this.first=t,this.second=n,this.flip=!!i,this}var r,s;return kt(n,e),r={"==":"===","!=":"!==",of:"in",yieldfrom:"yield*"},s={"!==":"===","===":"!=="},n.prototype.children=["first","second"],n.prototype.isSimpleNumber=D,n.prototype.isYield=function(){var e;return"yield"===(e=this.operator)||"yield*"===e},n.prototype.isYieldReturn=function(){return this.isYield()&&this.first instanceof M},n.prototype.isUnary=function(){return!this.second},n.prototype.isComplex=function(){var e;return!(this.isUnary()&&("+"===(e=this.operator)||"-"===e)&&this.first instanceof z&&this.first.isSimpleNumber())},n.prototype.isChainable=function(){var e;return"<"===(e=this.operator)||">"===e||">="===e||"<="===e||"==="===e||"!=="===e},n.prototype.invert=function(){var e,t,i,r,o;if(this.isChainable()&&this.first.isChainable()){for(e=!0,t=this;t&&t.operator;)e&&(e=t.operator in s),t=t.first;if(!e)return new O(this).invert();for(t=this;t&&t.operator;)t.invert=!t.invert,t.operator=s[t.operator],t=t.first;return this}return(r=s[this.operator])?(this.operator=r,this.first.unwrap()instanceof n&&this.first.invert(),this):this.second?new O(this).invert():"!"===this.operator&&(i=this.first.unwrap())instanceof n&&("!"===(o=i.operator)||"in"===o||"instanceof"===o)?i:new n("!",this)},n.prototype.unfoldSoak=function(e){var t;return("++"===(t=this.operator)||"--"===t||"delete"===t)&&yt(e,this,"first")},n.prototype.generateDo=function(e){var t,n,r,s,a,h,l,u;for(h=[],n=e instanceof i&&(l=e.value.unwrap())instanceof c?l:e,u=n.params||[],r=0,s=u.length;s>r;r++)a=u[r],a.value?(h.push(a.value),delete a.value):h.push(a);return t=new o(e,h),t["do"]=!0,t},n.prototype.compileNode=function(e){var t,n,i,r,s,o;if(n=this.isChainable()&&this.first.isChainable(),n||(this.first.front=this.front),"delete"===this.operator&&e.scope.check(this.first.unwrapAll().value)&&this.error("delete operand may not be argument or var"),("--"===(r=this.operator)||"++"===r)&&(s=this.first.unwrapAll().value,Tt.call(V,s)>=0)&&this.error('cannot increment/decrement "'+this.first.unwrapAll().value+'"'),this.isYield())return this.compileYield(e);if(this.isUnary())return this.compileUnary(e);if(n)return this.compileChain(e);switch(this.operator){case"?":return this.compileExistence(e);case"**":return this.compilePower(e);case"//":return this.compileFloorDivision(e);case"%%":return this.compileModulo(e);default:return i=this.first.compileToFragments(e,F),o=this.second.compileToFragments(e,F),t=[].concat(i,this.makeCode(" "+this.operator+" "),o),F>=e.level?t:this.wrapInBraces(t)}},n.prototype.compileChain=function(e){var t,n,i,r;return i=this.first.second.cache(e),this.first.second=i[0],r=i[1],n=this.first.compileToFragments(e,F),t=n.concat(this.makeCode(" "+(this.invert?"&&":"||")+" "),r.compileToFragments(e),this.makeCode(" "+this.operator+" "),this.second.compileToFragments(e,F)),this.wrapInBraces(t)},n.prototype.compileExistence=function(e){var t,n;return this.first.isComplex()?(n=new x(e.scope.freeVariable("ref")),t=new O(new i(n,this.first))):(t=this.first,n=t),new b(new u(t),n,{type:"if"}).addElse(this.second).compileToFragments(e)},n.prototype.compileUnary=function(e){var t,i,r;return i=[],t=this.operator,i.push([this.makeCode(t)]),"!"===t&&this.first instanceof u?(this.first.negated=!this.first.negated,this.first.compileToFragments(e)):e.level>=T?new O(this).compileToFragments(e):(r="+"===t||"-"===t,("new"===t||"typeof"===t||"delete"===t||r&&this.first instanceof n&&this.first.operator===t)&&i.push([this.makeCode(" ")]),(r&&this.first instanceof n||"new"===t&&this.first.isStatement(e))&&(this.first=new O(this.first)),i.push(this.first.compileToFragments(e,F)),this.flip&&i.reverse(),this.joinFragmentArrays(i,""))},n.prototype.compileYield=function(e){var t,n;return n=[],t=this.operator,null==e.scope.parent&&this.error("yield statements must occur within a function generator."),Tt.call(Object.keys(this.first),"expression")>=0&&!(this.first instanceof W)?this.isYieldReturn()?n.push(this.first.compileToFragments(e,L)):null!=this.first.expression&&n.push(this.first.expression.compileToFragments(e,F)):(n.push([this.makeCode("("+t+" ")]),n.push(this.first.compileToFragments(e,F)),n.push([this.makeCode(")")])),this.joinFragmentArrays(n,"")},n.prototype.compilePower=function(e){var n;return n=new z(new x("Math"),[new t(new x("pow"))]),new o(n,[this.first,this.second]).compileToFragments(e)},n.prototype.compileFloorDivision=function(e){var i,r;return r=new z(new x("Math"),[new t(new x("floor"))]),i=new n("/",this.first,this.second),new o(r,[i]).compileToFragments(e)},n.prototype.compileModulo=function(e){var t;return t=new z(new x(bt("modulo",e))),new o(t,[this.first,this.second]).compileToFragments(e)},n.prototype.toString=function(e){return n.__super__.toString.call(this,e,this.constructor.name+" "+this.operator)},n}(r),e.In=k=function(e){function t(e,t){this.object=e,this.array=t}return kt(t,e),t.prototype.children=["object","array"],t.prototype.invert=S,t.prototype.compileNode=function(e){var t,n,i,r,s;if(this.array instanceof z&&this.array.isArray()&&this.array.base.objects.length){for(s=this.array.base.objects,n=0,i=s.length;i>n;n++)if(r=s[n],r instanceof G){t=!0;break}if(!t)return this.compileOrTest(e)}return this.compileLoopTest(e)},t.prototype.compileOrTest=function(e){var t,n,i,r,s,o,a,c,h,l,u,p;for(c=this.object.cache(e,F),u=c[0],a=c[1],h=this.negated?[" !== "," && "]:[" === "," || "],t=h[0],n=h[1],p=[],l=this.array.base.objects,i=s=0,o=l.length;o>s;i=++s)r=l[i],i&&p.push(this.makeCode(n)),p=p.concat(i?a:u,this.makeCode(t),r.compileToFragments(e,T));return F>e.level?p:this.wrapInBraces(p)},t.prototype.compileLoopTest=function(e){var t,n,i,r;return i=this.object.cache(e,E),r=i[0],n=i[1],t=[].concat(this.makeCode(bt("indexOf",e)+".call("),this.array.compileToFragments(e,E),this.makeCode(", "),n,this.makeCode(") "+(this.negated?"< 0":">= 0"))),st(r)===st(n)?t:(t=r.concat(this.makeCode(", "),t),E>e.level?t:this.wrapInBraces(t))},t.prototype.toString=function(e){return t.__super__.toString.call(this,e,this.constructor.name+(this.negated?"!":""))},t}(r),e.Try=Y=function(e){function t(e,t,n,i){this.attempt=e,this.errorVariable=t,this.recovery=n,this.ensure=i}return kt(t,e),t.prototype.children=["attempt","recovery","ensure"],t.prototype.isStatement=Q,t.prototype.jumps=function(e){var t;return this.attempt.jumps(e)||(null!=(t=this.recovery)?t.jumps(e):void 0)},t.prototype.makeReturn=function(e){return this.attempt&&(this.attempt=this.attempt.makeReturn(e)),this.recovery&&(this.recovery=this.recovery.makeReturn(e)),this},t.prototype.compileNode=function(e){var t,n,r,s;return e.indent+=q,s=this.attempt.compileToFragments(e,L),t=this.recovery?(r=new x("_error"),this.errorVariable?this.recovery.unshift(new i(this.errorVariable,r)):void 0,[].concat(this.makeCode(" catch ("),r.compileToFragments(e),this.makeCode(") {\n"),this.recovery.compileToFragments(e,L),this.makeCode("\n"+this.tab+"}"))):this.ensure||this.recovery?[]:[this.makeCode(" catch (_error) {}")],n=this.ensure?[].concat(this.makeCode(" finally {\n"),this.ensure.compileToFragments(e,L),this.makeCode("\n"+this.tab+"}")):[],[].concat(this.makeCode(this.tab+"try {\n"),s,this.makeCode("\n"+this.tab+"}"),t,n)},t}(r),e.Throw=W=function(e){function t(e){this.expression=e}return kt(t,e),t.prototype.children=["expression"],t.prototype.isStatement=Q,t.prototype.jumps=D,t.prototype.makeReturn=X,t.prototype.compileNode=function(e){return[].concat(this.makeCode(this.tab+"throw "),this.expression.compileToFragments(e),this.makeCode(";"))},t}(r),e.Existence=u=function(e){function t(e){this.expression=e}return kt(t,e),t.prototype.children=["expression"],t.prototype.invert=S,t.prototype.compileNode=function(e){var t,n,i,r;return this.expression.front=this.front,i=this.expression.compile(e,F),g.test(i)&&!e.scope.check(i)?(r=this.negated?["===","||"]:["!==","&&"],t=r[0],n=r[1],i="typeof "+i+" "+t+' "undefined" '+n+" "+i+" "+t+" null"):i=i+" "+(this.negated?"==":"!=")+" null",[this.makeCode(C>=e.level?i:"("+i+")")]},t}(r),e.Parens=O=function(e){function t(e){this.body=e}return kt(t,e),t.prototype.children=["body"],t.prototype.unwrap=function(){return this.body},t.prototype.isComplex=function(){return this.body.isComplex()},t.prototype.compileNode=function(e){var t,n,i;return n=this.body.unwrap(),n instanceof z&&n.isAtomic()?(n.front=this.front,n.compileToFragments(e)):(i=n.compileToFragments(e,N),t=F>e.level&&(n instanceof I||n instanceof o||n instanceof f&&n.returns),t?i:this.wrapInBraces(i))},t}(r),e.For=f=function(e){function t(e,t){var n;this.source=t.source,this.guard=t.guard,this.step=t.step,this.name=t.name,this.index=t.index,this.body=s.wrap([e]),this.own=!!t.own,this.object=!!t.object,this.object&&(n=[this.index,this.name],this.name=n[0],this.index=n[1]),this.index instanceof z&&this.index.error("index cannot be a pattern matching expression"),this.range=this.source instanceof z&&this.source.base instanceof j&&!this.source.properties.length,this.pattern=this.name instanceof z,this.range&&this.index&&this.index.error("indexes do not apply to range loops"),this.range&&this.pattern&&this.name.error("cannot pattern match over range loops"),this.own&&!this.object&&this.name.error("cannot use own with for-in"),this.returns=!1}return kt(t,e),t.prototype.children=["body","source","guard","step"],t.prototype.compileNode=function(e){var t,n,r,o,a,c,h,l,u,p,d,f,m,v,y,k,w,T,C,F,N,S,D,A,I,_,$,j,B,V,P,U,G,H;return t=s.wrap([this.body]),D=t.expressions,T=D[D.length-1],(null!=T?T.jumps():void 0)instanceof M&&(this.returns=!1),B=this.range?this.source.base:this.source,j=e.scope,this.pattern||(F=this.name&&this.name.compile(e,E)),v=this.index&&this.index.compile(e,E),F&&!this.pattern&&j.find(F),v&&j.find(v),this.returns&&($=j.freeVariable("results")),y=this.object&&v||j.freeVariable("i",{single:!0}),k=this.range&&F||v||y,w=k!==y?k+" = ":"",this.step&&!this.range&&(A=this.cacheToCodeFragments(this.step.cache(e,E,ot)),V=A[0],U=A[1],P=U.match(R)),this.pattern&&(F=y),H="",d="",h="",f=this.tab+q,this.range?p=B.compileToFragments(lt(e,{index:y,name:F,step:this.step,isComplex:ot})):(G=this.source.compile(e,E),!F&&!this.own||g.test(G)||(h+=""+this.tab+(S=j.freeVariable("ref"))+" = "+G+";\n",G=S),F&&!this.pattern&&(N=F+" = "+G+"["+k+"]"),this.object||(V!==U&&(h+=""+this.tab+V+";\n"),this.step&&P&&(u=0>pt(P[0]))||(C=j.freeVariable("len")),a=""+w+y+" = 0, "+C+" = "+G+".length",c=""+w+y+" = "+G+".length - 1",r=y+" < "+C,o=y+" >= 0",this.step?(P?u&&(r=o,a=c):(r=U+" > 0 ? "+r+" : "+o,a="("+U+" > 0 ? ("+a+") : "+c+")"),m=y+" += "+U):m=""+(k!==y?"++"+y:y+"++"),p=[this.makeCode(a+"; "+r+"; "+w+m)])),this.returns&&(I=""+this.tab+$+" = [];\n",_="\n"+this.tab+"return "+$+";",t.makeReturn($)),this.guard&&(t.expressions.length>1?t.expressions.unshift(new b(new O(this.guard).invert(),new x("continue"))):this.guard&&(t=s.wrap([new b(this.guard,t)]))),this.pattern&&t.expressions.unshift(new i(this.name,new x(G+"["+k+"]"))),l=[].concat(this.makeCode(h),this.pluckDirectCall(e,t)),N&&(H="\n"+f+N+";"),this.object&&(p=[this.makeCode(k+" in "+G)],this.own&&(d="\n"+f+"if (!"+bt("hasProp",e)+".call("+G+", "+k+")) continue;")),n=t.compileToFragments(lt(e,{indent:f}),L),n&&n.length>0&&(n=[].concat(this.makeCode("\n"),n,this.makeCode("\n"))),[].concat(l,this.makeCode(""+(I||"")+this.tab+"for ("),p,this.makeCode(") {"+d+H),n,this.makeCode(this.tab+"}"+(_||"")))},t.prototype.pluckDirectCall=function(e,t){var n,r,s,a,h,l,u,p,d,f,m,g,v,y,b,k;for(r=[],d=t.expressions,h=l=0,u=d.length;u>l;h=++l)s=d[h],s=s.unwrapAll(),s instanceof o&&(k=null!=(f=s.variable)?f.unwrapAll():void 0,(k instanceof c||k instanceof z&&(null!=(m=k.base)?m.unwrapAll():void 0)instanceof c&&1===k.properties.length&&("call"===(g=null!=(v=k.properties[0].name)?v.value:void 0)||"apply"===g))&&(a=(null!=(y=k.base)?y.unwrapAll():void 0)||k,p=new x(e.scope.freeVariable("fn")),n=new z(p),k.base&&(b=[n,k],k.base=b[0],n=b[1]),t.expressions[h]=new o(n,s.args),r=r.concat(this.makeCode(this.tab),new i(p,a).compileToFragments(e,L),this.makeCode(";\n"))));return r},t}(J),e.Switch=H=function(e){function t(e,t,n){this.subject=e,this.cases=t,this.otherwise=n}return kt(t,e),t.prototype.children=["subject","cases","otherwise"],t.prototype.isStatement=Q,t.prototype.jumps=function(e){var t,n,i,r,s,o,a,c;for(null==e&&(e={block:!0}),o=this.cases,i=0,s=o.length;s>i;i++)if(a=o[i],n=a[0],t=a[1],r=t.jumps(e))return r;return null!=(c=this.otherwise)?c.jumps(e):void 0},t.prototype.makeReturn=function(e){var t,n,i,r,o;for(r=this.cases,t=0,n=r.length;n>t;t++)i=r[t],i[1].makeReturn(e);return e&&(this.otherwise||(this.otherwise=new s([new x("void 0")]))),null!=(o=this.otherwise)&&o.makeReturn(e),this},t.prototype.compileNode=function(e){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g;for(c=e.indent+q,h=e.indent=c+q,o=[].concat(this.makeCode(this.tab+"switch ("),this.subject?this.subject.compileToFragments(e,N):this.makeCode("false"),this.makeCode(") {\n")),f=this.cases,a=l=0,p=f.length;p>l;a=++l){for(m=f[a],r=m[0],t=m[1],g=rt([r]),u=0,d=g.length;d>u;u++)i=g[u],this.subject||(i=i.invert()),o=o.concat(this.makeCode(c+"case "),i.compileToFragments(e,N),this.makeCode(":\n"));if((n=t.compileToFragments(e,L)).length>0&&(o=o.concat(n,this.makeCode("\n"))),a===this.cases.length-1&&!this.otherwise)break;s=this.lastNonComment(t.expressions),s instanceof M||s instanceof x&&s.jumps()&&"debugger"!==s.value||o.push(i.makeCode(h+"break;\n"))}return this.otherwise&&this.otherwise.expressions.length&&o.push.apply(o,[this.makeCode(c+"default:\n")].concat(Ct.call(this.otherwise.compileToFragments(e,L)),[this.makeCode("\n")])),o.push(this.makeCode(this.tab+"}")),o},t}(r),e.If=b=function(e){function t(e,t,n){this.body=t,null==n&&(n={}),this.condition="unless"===n.type?e.invert():e,this.elseBody=null,this.isChain=!1,this.soak=n.soak}return kt(t,e),t.prototype.children=["condition","body","elseBody"],t.prototype.bodyNode=function(){var e;return null!=(e=this.body)?e.unwrap():void 0},t.prototype.elseBodyNode=function(){var e;return null!=(e=this.elseBody)?e.unwrap():void 0},t.prototype.addElse=function(e){return this.isChain?this.elseBodyNode().addElse(e):(this.isChain=e instanceof t,this.elseBody=this.ensureBlock(e),this.elseBody.updateLocationDataIfMissing(e.locationData)),this},t.prototype.isStatement=function(e){var t;return(null!=e?e.level:void 0)===L||this.bodyNode().isStatement(e)||(null!=(t=this.elseBodyNode())?t.isStatement(e):void 0)},t.prototype.jumps=function(e){var t;return this.body.jumps(e)||(null!=(t=this.elseBody)?t.jumps(e):void 0)},t.prototype.compileNode=function(e){return this.isStatement(e)?this.compileStatement(e):this.compileExpression(e)},t.prototype.makeReturn=function(e){return e&&(this.elseBody||(this.elseBody=new s([new x("void 0")]))),this.body&&(this.body=new s([this.body.makeReturn(e)])),this.elseBody&&(this.elseBody=new s([this.elseBody.makeReturn(e)])),this},t.prototype.ensureBlock=function(e){return e instanceof s?e:new s([e])},t.prototype.compileStatement=function(e){var n,i,r,s,o,a,c;return r=tt(e,"chainChild"),(o=tt(e,"isExistentialEquals"))?new t(this.condition.invert(),this.elseBodyNode(),{type:"if"}).compileToFragments(e):(c=e.indent+q,s=this.condition.compileToFragments(e,N),i=this.ensureBlock(this.body).compileToFragments(lt(e,{indent:c})),a=[].concat(this.makeCode("if ("),s,this.makeCode(") {\n"),i,this.makeCode("\n"+this.tab+"}")),r||a.unshift(this.makeCode(this.tab)),this.elseBody?(n=a.concat(this.makeCode(" else ")),this.isChain?(e.chainChild=!0,n=n.concat(this.elseBody.unwrap().compileToFragments(e,L))):n=n.concat(this.makeCode("{\n"),this.elseBody.compileToFragments(lt(e,{indent:c}),L),this.makeCode("\n"+this.tab+"}")),n):a)},t.prototype.compileExpression=function(e){var t,n,i,r;return i=this.condition.compileToFragments(e,C),n=this.bodyNode().compileToFragments(e,E),t=this.elseBodyNode()?this.elseBodyNode().compileToFragments(e,E):[this.makeCode("void 0")],r=i.concat(this.makeCode(" ? "),n,this.makeCode(" : "),t),e.level>=C?this.wrapInBraces(r):r},t.prototype.unfoldSoak=function(){return this.soak&&this},t}(r),K={extend:function(e){return"function(child, parent) { for (var key in parent) { if ("+bt("hasProp",e)+".call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }"},bind:function(){return"function(fn, me){ return function(){ return fn.apply(me, arguments); }; }"},indexOf:function(){return"[].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }"},modulo:function(){return"function(a, b) { return (+a % (b = +b) + b) % b; }"},hasProp:function(){return"{}.hasOwnProperty"},slice:function(){return"[].slice"}},L=1,N=2,E=3,C=4,F=5,T=6,q=" ",g=/^(?!\d)[$\w\x7f-\uffff]+$/,B=/^[+-]?\d+$/,m=/^[+-]?0x[\da-f]+/i,R=/^[+-]?(?:0x[\da-f]+|\d*\.?\d+(?:e[+-]?\d+)?)$/i,y=/^['"]/,v=/^\//,bt=function(e,t){var n,i;return i=t.scope.root,e in i.utilities?i.utilities[e]:(n=i.freeVariable(e),i.assign(n,K[e](t)),i.utilities[e]=n)},ut=function(e,t){return e=e.replace(/\n/g,"$&"+t),e.replace(/\s+$/,"")},pt=function(e){return null==e?0:e.match(m)?parseInt(e,16):parseFloat(e)},at=function(e){return e instanceof x&&"arguments"===e.value&&!e.asKey},ct=function(e){return e instanceof x&&"this"===e.value&&!e.asKey||e instanceof c&&e.bound||e instanceof o&&e.isSuper},ot=function(e){return e.isComplex()||("function"==typeof e.isAssignable?e.isAssignable():void 0)},yt=function(e,t,n){var i;if(i=t[n].unfoldSoak(e))return t[n]=i.body,i.body=new z(t),i}}.call(this),t.exports}(),_dereq_["./sourcemap"]=function(){var e={},t={exports:e};return function(){var e,n;e=function(){function e(e){this.line=e,this.columns=[]}return e.prototype.add=function(e,t,n){var i,r;return r=t[0],i=t[1],null==n&&(n={}),this.columns[e]&&n.noReplace?void 0:this.columns[e]={line:this.line,column:e,sourceLine:r,sourceColumn:i}},e.prototype.sourceLocation=function(e){for(var t;!((t=this.columns[e])||0>=e);)e--;return t&&[t.sourceLine,t.sourceColumn]},e}(),n=function(){function t(){this.lines=[]}var n,i,r,s;return t.prototype.add=function(t,n,i){var r,s,o,a;return null==i&&(i={}),o=n[0],s=n[1],a=(r=this.lines)[o]||(r[o]=new e(o)),a.add(s,t,i)},t.prototype.sourceLocation=function(e){var t,n,i;for(n=e[0],t=e[1];!((i=this.lines[n])||0>=n);)n--;return i&&i.sourceLocation(t)},t.prototype.generate=function(e,t){var n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v;for(null==e&&(e={}),null==t&&(t=null),v=0,s=0,a=0,o=0,d=!1,n="",f=this.lines,u=i=0,c=f.length;c>i;u=++i)if(l=f[u])for(m=l.columns,r=0,h=m.length;h>r;r++)if(p=m[r]){for(;p.line>v;)s=0,d=!1,n+=";",v++;d&&(n+=",",d=!1),n+=this.encodeVlq(p.column-s),s=p.column,n+=this.encodeVlq(0),n+=this.encodeVlq(p.sourceLine-a),a=p.sourceLine,n+=this.encodeVlq(p.sourceColumn-o),o=p.sourceColumn,d=!0}return g={version:3,file:e.generatedFile||"",sourceRoot:e.sourceRoot||"",sources:e.sourceFiles||[""],names:[],mappings:n},e.inline&&(g.sourcesContent=[t]),JSON.stringify(g,null,2)},r=5,i=1<e?1:0,a=(Math.abs(e)<<1)+o;a||!t;)n=a&s,a>>=r,a&&(n|=i),t+=this.encodeBase64(n);return t},n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t.prototype.encodeBase64=function(e){return n[e]||function(){throw Error("Cannot Base64 encode value: "+e)}()},t}(),t.exports=n}.call(this),t.exports}(),_dereq_["./coffee-script"]=function(){var e={},t={exports:e};return function(){var t,n,i,r,s,o,a,c,h,l,u,p,d,f,m,g,v,y,b={}.hasOwnProperty,k=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};if(a=_dereq_("fs"),v=_dereq_("vm"),f=_dereq_("path"),t=_dereq_("./lexer").Lexer,d=_dereq_("./parser").parser,h=_dereq_("./helpers"),n=_dereq_("./sourcemap"),e.VERSION="1.9.3",e.FILE_EXTENSIONS=[".coffee",".litcoffee",".coffee.md"],e.helpers=h,y=function(e){return function(t,n){var i;null==n&&(n={});try{return e.call(this,t,n) }catch(r){if(i=r,"string"!=typeof t)throw i;throw h.updateSyntaxError(i,t,n.filename)}}},e.compile=r=y(function(e,t){var i,r,s,o,a,c,l,u,f,m,g,v,y,b,k;for(v=h.merge,o=h.extend,t=o({},t),t.sourceMap&&(g=new n),k=p.tokenize(e,t),t.referencedVars=function(){var e,t,n;for(n=[],e=0,t=k.length;t>e;e++)b=k[e],b.variable&&n.push(b[1]);return n}(),c=d.parse(k).compileToFragments(t),s=0,t.header&&(s+=1),t.shiftLine&&(s+=1),r=0,f="",u=0,m=c.length;m>u;u++)a=c[u],t.sourceMap&&(a.locationData&&!/^[;\s]*$/.test(a.code)&&g.add([a.locationData.first_line,a.locationData.first_column],[s,r],{noReplace:!0}),y=h.count(a.code,"\n"),s+=y,y?r=a.code.length-(a.code.lastIndexOf("\n")+1):r+=a.code.length),f+=a.code;return t.header&&(l="Generated by CoffeeScript "+this.VERSION,f="// "+l+"\n"+f),t.sourceMap?(i={js:f},i.sourceMap=g,i.v3SourceMap=g.generate(t,e),i):f}),e.tokens=y(function(e,t){return p.tokenize(e,t)}),e.nodes=y(function(e,t){return"string"==typeof e?d.parse(p.tokenize(e,t)):d.parse(e)}),e.run=function(e,t){var n,i,s,o;return null==t&&(t={}),s=_dereq_.main,s.filename=process.argv[1]=t.filename?a.realpathSync(t.filename):".",s.moduleCache&&(s.moduleCache={}),i=t.filename?f.dirname(a.realpathSync(t.filename)):a.realpathSync("."),s.paths=_dereq_("module")._nodeModulePaths(i),(!h.isCoffee(s.filename)||_dereq_.extensions)&&(n=r(e,t),e=null!=(o=n.js)?o:n),s._compile(e,s.filename)},e.eval=function(e,t){var n,i,s,o,a,c,h,l,u,p,d,m,g,y,k,w,T;if(null==t&&(t={}),e=e.trim()){if(o=null!=(m=v.Script.createContext)?m:v.createContext,c=null!=(g=v.isContext)?g:function(){return t.sandbox instanceof o().constructor},o){if(null!=t.sandbox){if(c(t.sandbox))w=t.sandbox;else{w=o(),y=t.sandbox;for(l in y)b.call(y,l)&&(T=y[l],w[l]=T)}w.global=w.root=w.GLOBAL=w}else w=global;if(w.__filename=t.filename||"eval",w.__dirname=f.dirname(w.__filename),w===global&&!w.module&&!w.require){for(n=_dereq_("module"),w.module=i=new n(t.modulename||"eval"),w.require=s=function(e){return n._load(e,i,!0)},i.filename=w.__filename,k=Object.getOwnPropertyNames(_dereq_),a=0,u=k.length;u>a;a++)d=k[a],"paths"!==d&&(s[d]=_dereq_[d]);s.paths=i.paths=n._nodeModulePaths(process.cwd()),s.resolve=function(e){return n._resolveFilename(e,i)}}}p={};for(l in t)b.call(t,l)&&(T=t[l],p[l]=T);return p.bare=!0,h=r(e,p),w===global?v.runInThisContext(h):v.runInContext(h,w)}},e.register=function(){return _dereq_("./register")},_dereq_.extensions)for(m=this.FILE_EXTENSIONS,l=0,u=m.length;u>l;l++)s=m[l],null==(i=_dereq_.extensions)[s]&&(i[s]=function(){throw Error("Use CoffeeScript.register() or require the coffee-script/register module to require "+s+" files.")});e._compileFile=function(e,t){var n,i,s,o;null==t&&(t=!1),s=a.readFileSync(e,"utf8"),o=65279===s.charCodeAt(0)?s.substring(1):s;try{n=r(o,{filename:e,sourceMap:t,literate:h.isLiterate(e)})}catch(c){throw i=c,h.updateSyntaxError(i,o,e)}return n},p=new t,d.lexer={lex:function(){var e,t;return t=d.tokens[this.pos++],t?(e=t[0],this.yytext=t[1],this.yylloc=t[2],d.errorToken=t.origin||t,this.yylineno=this.yylloc.first_line):e="",e},setInput:function(e){return d.tokens=e,this.pos=0},upcomingInput:function(){return""}},d.yy=_dereq_("./nodes"),d.yy.parseError=function(e,t){var n,i,r,s,o,a;return o=t.token,s=d.errorToken,a=d.tokens,i=s[0],r=s[1],n=s[2],r=function(){switch(!1){case s!==a[a.length-1]:return"end of input";case"INDENT"!==i&&"OUTDENT"!==i:return"indentation";case"IDENTIFIER"!==i&&"NUMBER"!==i&&"STRING"!==i&&"STRING_START"!==i&&"REGEX"!==i&&"REGEX_START"!==i:return i.replace(/_START$/,"").toLowerCase();default:return h.nameWhitespaceCharacter(r)}}(),h.throwSyntaxError("unexpected "+r,n)},o=function(e,t){var n,i,r,s,o,a,c,h,l,u,p,d;return s=void 0,r="",e.isNative()?r="native":(e.isEval()?(s=e.getScriptNameOrSourceURL(),s||(r=e.getEvalOrigin()+", ")):s=e.getFileName(),s||(s=""),h=e.getLineNumber(),i=e.getColumnNumber(),u=t(s,h,i),r=u?s+":"+u[0]+":"+u[1]:s+":"+h+":"+i),o=e.getFunctionName(),a=e.isConstructor(),c=!(e.isToplevel()||a),c?(l=e.getMethodName(),d=e.getTypeName(),o?(p=n="",d&&o.indexOf(d)&&(p=d+"."),l&&o.indexOf("."+l)!==o.length-l.length-1&&(n=" [as "+l+"]"),""+p+o+n+" ("+r+")"):d+"."+(l||"")+" ("+r+")"):a?"new "+(o||"")+" ("+r+")":o?o+" ("+r+")":r},g={},c=function(t){var n,i;if(g[t])return g[t];if(i=null!=f?f.extname(t):void 0,!(0>k.call(e.FILE_EXTENSIONS,i)))return n=e._compileFile(t,!0),g[t]=n.sourceMap},Error.prepareStackTrace=function(t,n){var i,r,s;return s=function(e,t,n){var i,r;return r=c(e),r&&(i=r.sourceLocation([t-1,n-1])),i?[i[0]+1,i[1]+1]:null},r=function(){var t,r,a;for(a=[],t=0,r=n.length;r>t&&(i=n[t],i.getFunction()!==e.run);t++)a.push(" at "+o(i,s));return a}(),""+t+"\n"+r.join("\n")+"\n"}}.call(this),t.exports}(),_dereq_["./browser"]=function(){var exports={},module={exports:exports};return function(){var CoffeeScript,compile,runScripts,indexOf=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};CoffeeScript=_dereq_("./coffee-script"),CoffeeScript.require=_dereq_,compile=CoffeeScript.compile,CoffeeScript.eval=function(code,options){return null==options&&(options={}),null==options.bare&&(options.bare=!0),eval(compile(code,options))},CoffeeScript.run=function(e,t){return null==t&&(t={}),t.bare=!0,t.shiftLine=!0,Function(compile(e,t))()},"undefined"!=typeof window&&null!==window&&("undefined"!=typeof btoa&&null!==btoa&&"undefined"!=typeof JSON&&null!==JSON&&"undefined"!=typeof unescape&&null!==unescape&&"undefined"!=typeof encodeURIComponent&&null!==encodeURIComponent&&(compile=function(e,t){var n,i,r;return null==t&&(t={}),t.sourceMap=!0,t.inline=!0,i=CoffeeScript.compile(e,t),n=i.js,r=i.v3SourceMap,n+"\n//# sourceMappingURL=data:application/json;base64,"+btoa(unescape(encodeURIComponent(r)))+"\n//# sourceURL=coffeescript"}),CoffeeScript.load=function(e,t,n,i){var r;return null==n&&(n={}),null==i&&(i=!1),n.sourceFiles=[e],r=window.ActiveXObject?new window.ActiveXObject("Microsoft.XMLHTTP"):new window.XMLHttpRequest,r.open("GET",e,!0),"overrideMimeType"in r&&r.overrideMimeType("text/plain"),r.onreadystatechange=function(){var s,o;if(4===r.readyState){if(0!==(o=r.status)&&200!==o)throw Error("Could not load "+e);if(s=[r.responseText,n],i||CoffeeScript.run.apply(CoffeeScript,s),t)return t(s)}},r.send(null)},runScripts=function(){var e,t,n,i,r,s,o,a,c,h,l;for(l=window.document.getElementsByTagName("script"),t=["text/coffeescript","text/literate-coffeescript"],e=function(){var e,n,i,r;for(r=[],e=0,n=l.length;n>e;e++)c=l[e],i=c.type,indexOf.call(t,i)>=0&&r.push(c);return r}(),s=0,n=function(){var t;return t=e[s],t instanceof Array?(CoffeeScript.run.apply(CoffeeScript,t),s++,n()):void 0},i=function(i,r){var s,o;return s={literate:i.type===t[1]},o=i.src||i.getAttribute("data-src"),o?CoffeeScript.load(o,function(t){return e[r]=t,n()},s,!0):(s.sourceFiles=["embedded"],e[r]=[i.innerHTML,s])},r=o=0,a=e.length;a>o;r=++o)h=e[r],i(h,r);return n()},window.addEventListener?window.addEventListener("DOMContentLoaded",runScripts,!1):window.attachEvent("onload",runScripts))}.call(this),module.exports}(),_dereq_["./coffee-script"]}();"function"==typeof define&&define.amd?define(function(){return CoffeeScript}):root.CoffeeScript=CoffeeScript})(this); }); ================================================ FILE: lib/ace/mode/coffee/parser_test.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ if (typeof process !== "undefined") { require("amd-loader"); } define(function(require, exports, module) { "use strict"; var assert = require("../../test/assertions"); var coffee = require("./coffee"); function assertLocation(e, sl, sc, el, ec) { var l = e.location; assert.equal( l.first_line + ":" + l.first_column + "->" + l.last_line + ":" + l.last_column, sl + ":" + sc + "->" + el + ":" + ec ); } function parse(str) { try { coffee.compile(str); } catch (e) { return e; } } module.exports = { "test parse valid coffee script": function() { coffee.compile("square = (x) -> x * x"); }, "test parse invalid coffee script": function() { var e = parse("a = 12 f"); assert.equal(e.message, "unexpected identifier"); assertLocation(e, 0, 7, 0, 7); }, "test parse missing bracket": function() { var e = parse("a = 12 f {\n\n"); assert.equal(e.message, "missing }"); assertLocation(e, 0, 9, 0, 9); }, "test unexpected indent": function() { var e = parse("a\n a\n"); assert.equal(e.message, "unexpected indentation"); assertLocation(e, 1, 0, 1, 1); }, "test invalid destructuring": function() { var e = parse("\n{b: 5} = {}"); assert.equal(e.message, '"5" cannot be assigned'); assertLocation(e, 1, 4, 1, 4); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/mode/coffee.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var Rules = require("./coffee_highlight_rules").CoffeeHighlightRules; var Outdent = require("./matching_brace_outdent").MatchingBraceOutdent; var FoldMode = require("./folding/coffee").FoldMode; var Range = require("../range").Range; var TextMode = require("./text").Mode; var WorkerClient = require("../worker/worker_client").WorkerClient; var oop = require("../lib/oop"); function Mode() { this.HighlightRules = Rules; this.$outdent = new Outdent(); this.foldingRules = new FoldMode(); } oop.inherits(Mode, TextMode); (function() { /*: [({[=:] # Opening parentheses or brackets |[-=]> # OR single or double arrow |\b(?: # OR one of these words: else # else |try # OR try |(?:swi|ca)tch # OR catch, optionally followed by: (?:\s*[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)? # a variable |finally # OR finally ))\s*$ # all as the last thing on a line (allowing trailing space) | # ---- OR ---- : ^\s* # a line starting with optional space (else\b\s*)? # followed by an optional "else" (?: # followed by one of the following: if # if |for # OR for |while # OR while |loop # OR loop )\b # (as a word) (?!.*\bthen\b) # ... but NOT followed by "then" on the line */ var indenter = /(?:[({[=:]|[-=]>|\b(?:else|try|(?:swi|ca)tch(?:\s+[$A-Za-z_\x7f-\uffff][$\w\x7f-\uffff]*)?|finally))\s*$|^\s*(else\b\s*)?(?:if|for|while|loop)\b(?!.*\bthen\b)/; this.lineCommentStart = "#"; this.blockComment = {start: "###", end: "###"}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var tokens = this.getTokenizer().getLineTokens(line, state).tokens; if (!(tokens.length && tokens[tokens.length - 1].type === 'comment') && state === 'start' && indenter.test(line)) indent += tab; return indent; }; this.checkOutdent = function(state, line, input) { return this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; this.createWorker = function(session) { var worker = new WorkerClient(["ace"], "ace/mode/coffee_worker", "Worker"); worker.attachToDocument(session.getDocument()); worker.on("annotate", function(e) { session.setAnnotations(e.data); }); worker.on("terminate", function() { session.clearAnnotations(); }); return worker; }; this.$id = "ace/mode/coffee"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/coffee_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; oop.inherits(CoffeeHighlightRules, TextHighlightRules); function CoffeeHighlightRules() { var identifier = "[$A-Za-z_\\x7f-\\uffff][$\\w\\x7f-\\uffff]*"; var keywords = ( "this|throw|then|try|typeof|super|switch|return|break|by|continue|" + "catch|class|in|instanceof|is|isnt|if|else|extends|for|own|" + "finally|function|while|when|new|no|not|delete|debugger|do|loop|of|off|" + "or|on|unless|until|and|yes" ); var langConstant = ( "true|false|null|undefined|NaN|Infinity" ); var illegal = ( "case|const|default|function|var|void|with|enum|export|implements|" + "interface|let|package|private|protected|public|static|yield" ); var supportClass = ( "Array|Boolean|Date|Function|Number|Object|RegExp|ReferenceError|String|" + "Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|" + "SyntaxError|TypeError|URIError|" + "ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|" + "Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray" ); var supportFunction = ( "Math|JSON|isNaN|isFinite|parseInt|parseFloat|encodeURI|" + "encodeURIComponent|decodeURI|decodeURIComponent|String|" ); var variableLanguage = ( "window|arguments|prototype|document" ); var keywordMapper = this.createKeywordMapper({ "keyword": keywords, "constant.language": langConstant, "invalid.illegal": illegal, "language.support.class": supportClass, "language.support.function": supportFunction, "variable.language": variableLanguage }, "identifier"); var functionRule = { token: ["paren.lparen", "variable.parameter", "paren.rparen", "text", "storage.type"], regex: /(?:(\()((?:"[^")]*?"|'[^')]*?'|\/[^\/)]*?\/|[^()"'\/])*?)(\))(\s*))?([\-=]>)/.source }; var stringEscape = /\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|[0-2][0-7]{0,2}|3[0-6][0-7]?|37[0-7]?|[4-7][0-7]?|.)/; this.$rules = { start : [ { token : "constant.numeric", regex : "(?:0x[\\da-fA-F]+|(?:\\d+(?:\\.\\d+)?|\\.\\d+)(?:[eE][+-]?\\d+)?)" }, { stateName: "qdoc", token : "string", regex : "'''", next : [ {token : "string", regex : "'''", next : "start"}, {token : "constant.language.escape", regex : stringEscape}, {defaultToken: "string"} ] }, { stateName: "qqdoc", token : "string", regex : '"""', next : [ {token : "string", regex : '"""', next : "start"}, {token : "paren.string", regex : '#{', push : "start"}, {token : "constant.language.escape", regex : stringEscape}, {defaultToken: "string"} ] }, { stateName: "qstring", token : "string", regex : "'", next : [ {token : "string", regex : "'", next : "start"}, {token : "constant.language.escape", regex : stringEscape}, {defaultToken: "string"} ] }, { stateName: "qqstring", token : "string.start", regex : '"', next : [ {token : "string.end", regex : '"', next : "start"}, {token : "paren.string", regex : '#{', push : "start"}, {token : "constant.language.escape", regex : stringEscape}, {defaultToken: "string"} ] }, { stateName: "js", token : "string", regex : "`", next : [ {token : "string", regex : "`", next : "start"}, {token : "constant.language.escape", regex : stringEscape}, {defaultToken: "string"} ] }, { regex: "[{}]", onMatch: function(val, state, stack) { this.next = ""; if (val == "{" && stack.length) { stack.unshift("start", state); return "paren"; } if (val == "}" && stack.length) { stack.shift(); this.next = stack.shift() || ""; if (this.next.indexOf("string") != -1) return "paren.string"; } return "paren"; } }, { token : "string.regex", regex : "///", next : "heregex" }, { token : "string.regex", regex : /(?:\/(?![\s=])[^[\/\n\\]*(?:(?:\\[\s\S]|\[[^\]\n\\]*(?:\\[\s\S][^\]\n\\]*)*])[^[\/\n\\]*)*\/)(?:[imgy]{0,4})(?!\w)/ }, { token : "comment", regex : "###(?!#)", next : "comment" }, { token : "comment", regex : "#.*" }, { token : ["punctuation.operator", "text", "identifier"], regex : "(\\.)(\\s*)(" + illegal + ")" }, { token : "punctuation.operator", regex : "\\.{1,3}" }, { //class A extends B token : ["keyword", "text", "language.support.class", "text", "keyword", "text", "language.support.class"], regex : "(class)(\\s+)(" + identifier + ")(?:(\\s+)(extends)(\\s+)(" + identifier + "))?" }, { //play = (...) -> token : ["entity.name.function", "text", "keyword.operator", "text"].concat(functionRule.token), regex : "(" + identifier + ")(\\s*)([=:])(\\s*)" + functionRule.regex }, functionRule, { token : "variable", regex : "@(?:" + identifier + ")?" }, { token: keywordMapper, regex : identifier }, { token : "punctuation.operator", regex : "\\,|\\." }, { token : "storage.type", regex : "[\\-=]>" }, { token : "keyword.operator", regex : "(?:[-+*/%<>&|^!?=]=|>>>=?|\\-\\-|\\+\\+|::|&&=|\\|\\|=|<<=|>>=|\\?\\.|\\.{2,3}|[!*+-=><])" }, { token : "paren.lparen", regex : "[({[]" }, { token : "paren.rparen", regex : "[\\]})]" }, { token : "text", regex : "\\s+" }], heregex : [{ token : "string.regex", regex : '.*?///[imgy]{0,4}', next : "start" }, { token : "comment.regex", regex : "\\s+(?:#.*)?" }, { token : "string.regex", regex : "\\S+" }], comment : [{ token : "comment", regex : '###', next : "start" }, { defaultToken : "comment" }] }; this.normalizeRules(); } exports.CoffeeHighlightRules = CoffeeHighlightRules; }); ================================================ FILE: lib/ace/mode/coffee_worker.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var Mirror = require("../worker/mirror").Mirror; var coffee = require("../mode/coffee/coffee"); window.addEventListener = function() {}; var Worker = exports.Worker = function(sender) { Mirror.call(this, sender); this.setTimeout(250); }; oop.inherits(Worker, Mirror); (function() { this.onUpdate = function() { var value = this.doc.getValue(); var errors = []; try { coffee.compile(value); } catch(e) { var loc = e.location; if (loc) { errors.push({ row: loc.first_line, column: loc.first_column, endRow: loc.last_line, endColumn: loc.last_column, text: e.message, type: "error" }); } } this.sender.emit("annotate", errors); }; }).call(Worker.prototype); }); ================================================ FILE: lib/ace/mode/coldfusion.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var lang = require("../lib/lang"); var HtmlMode = require("./html").Mode; var ColdfusionHighlightRules = require("./coldfusion_highlight_rules").ColdfusionHighlightRules; var voidElements = "cfabort|cfapplication|cfargument|cfassociate|cfbreak|cfcache|cfcollection|cfcookie|cfdbinfo|cfdirectory|cfdump|cfelse|cfelseif|cferror|cfexchangecalendar|cfexchangeconnection|cfexchangecontact|cfexchangefilter|cfexchangetask|cfexit|cffeed|cffile|cfflush|cfftp|cfheader|cfhtmlhead|cfhttpparam|cfimage|cfimport|cfinclude|cfindex|cfinsert|cfinvokeargument|cflocation|cflog|cfmailparam|cfNTauthenticate|cfobject|cfobjectcache|cfparam|cfpdfformparam|cfprint|cfprocparam|cfprocresult|cfproperty|cfqueryparam|cfregistry|cfreportparam|cfrethrow|cfreturn|cfschedule|cfsearch|cfset|cfsetting|cfthrow|cfzipparam)".split("|"); var Mode = function() { HtmlMode.call(this); this.HighlightRules = ColdfusionHighlightRules; }; oop.inherits(Mode, HtmlMode); (function() { // mix with html void elements this.voidElements = oop.mixin(lang.arrayToMap(voidElements), this.voidElements); this.getNextLineIndent = function(state, line, tab) { return this.$getIndent(line); }; this.$id = "ace/mode/coldfusion"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/coldfusion_highlight_rules.js ================================================ /* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license: * * Copyright (c) 2010, Ajax.org B.V. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * Neither the name of Ajax.org B.V. nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * ***** END LICENSE BLOCK ***** */ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var JavaScriptHighlightRules = require("./javascript_highlight_rules").JavaScriptHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var ColdfusionHighlightRules = function() { HtmlHighlightRules.call(this); this.$rules.tag[2].token = function (start, tag) { var group = tag.slice(0,2) == "cf" ? "keyword" : "meta.tag"; return ["meta.tag.punctuation." + (start == "<" ? "" : "end-") + "tag-open.xml", group + ".tag-name.xml"]; }; var jsAndCss = Object.keys(this.$rules).filter(function(x) { return /^(js|css)-/.test(x); }); this.embedRules({ cfmlComment: [ { regex: "", token: "comment.end", next: "pop"}, { defaultToken: "comment"} ] }, "", [ { regex: "", " ", "fg"].join("\n"), session.toString()); }, "test: next line indent should be the same as the current line indent" : function() { assert.equal(" ", this.mode.getNextLineIndent("start", " abc")); assert.equal("", this.mode.getNextLineIndent("start", "abc")); assert.equal("\t", this.mode.getNextLineIndent("start", "\tabc")); } }; }); if (typeof module !== "undefined" && module === require.main) { require("asyncjs").test.testcase(module.exports).exec(); } ================================================ FILE: lib/ace/mode/csharp.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CSharpHighlightRules = require("./csharp_highlight_rules").CSharpHighlightRules; var MatchingBraceOutdent = require("./matching_brace_outdent").MatchingBraceOutdent; var CstyleBehaviour = require("./behaviour/cstyle").CstyleBehaviour; var CStyleFoldMode = require("./folding/csharp").FoldMode; var Mode = function() { this.HighlightRules = CSharpHighlightRules; this.$outdent = new MatchingBraceOutdent(); this.$behaviour = new CstyleBehaviour(); this.foldingRules = new CStyleFoldMode(); }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = "//"; this.blockComment = {start: "/*", end: "*/"}; this.getNextLineIndent = function(state, line, tab) { var indent = this.$getIndent(line); var tokenizedLine = this.getTokenizer().getLineTokens(line, state); var tokens = tokenizedLine.tokens; if (tokens.length && tokens[tokens.length-1].type == "comment") { return indent; } if (state == "start") { var match = line.match(/^.*[\{\(\[]\s*$/); if (match) { indent += tab; } } return indent; }; this.checkOutdent = function(state, line, input) { return this.$outdent.checkOutdent(line, input); }; this.autoOutdent = function(state, doc, row) { this.$outdent.autoOutdent(doc, row); }; this.createWorker = function(session) { return null; }; this.$id = "ace/mode/csharp"; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/csharp_highlight_rules.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var DocCommentHighlightRules = require("./doc_comment_highlight_rules").DocCommentHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CSharpHighlightRules = function() { var keywordMapper = this.createKeywordMapper({ "variable.language": "this", "keyword": "abstract|event|new|struct|as|explicit|null|switch|base|extern|object|this|bool|false|operator|throw|break|finally|out|true|byte|fixed|override|try|case|float|params|typeof|catch|for|private|uint|char|foreach|protected|ulong|checked|goto|public|unchecked|class|if|readonly|unsafe|const|implicit|ref|ushort|continue|in|return|using|decimal|int|sbyte|virtual|default|interface|sealed|volatile|delegate|internal|partial|short|void|do|is|sizeof|while|double|lock|stackalloc|else|long|static|enum|namespace|string|var|dynamic", "constant.language": "null|true|false" }, "identifier"); // regexp must not have capturing parentheses. Use (?:) instead. // regexps are ordered -> the first match is used this.$rules = { "start" : [ { token : "comment", regex : "\\/\\/.*$" }, DocCommentHighlightRules.getStartRule("doc-start"), { token : "comment", // multi line comment regex : "\\/\\*", next : "comment" }, { token : "string", // character regex : /'(?:.|\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n]))?'/ }, { token : "string", start : '"', end : '"|$', next: [ {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/}, {token: "invalid", regex: /\\./} ] }, { token : "string", start : '@"', end : '"', next:[ {token: "constant.language.escape", regex: '""'} ] }, { token : "string", start : /\$"/, end : '"|$', next: [ {token: "constant.language.escape", regex: /\\(:?$)|{{/}, {token: "constant.language.escape", regex: /\\(:?u[\da-fA-F]+|x[\da-fA-F]+|[tbrf'"n])/}, {token: "invalid", regex: /\\./} ] }, { token : "constant.numeric", // hex regex : "0[xX][0-9a-fA-F]+\\b" }, { token : "constant.numeric", // float regex : "[+-]?\\d+(?:(?:\\.\\d*)?(?:[eE][+-]?\\d+)?)?\\b" }, { token : "constant.language.boolean", regex : "(?:true|false)\\b" }, { token : keywordMapper, regex : "[a-zA-Z_$][a-zA-Z0-9_$]*\\b" }, { token : "keyword.operator", regex : "!|\\$|%|&|\\*|\\-\\-|\\-|\\+\\+|\\+|~|===|==|=|!=|!==|<=|>=|<<=|>>=|>>>=|<>|<|>|!|&&|\\|\\||\\?\\:|\\*=|%=|\\+=|\\-=|&=|\\^=|\\b(?:in|instanceof|new|delete|typeof|void)" }, { token : "keyword", regex : "^\\s*#(if|else|elif|endif|define|undef|warning|error|line|region|endregion|pragma)" }, { token : "punctuation.operator", regex : "\\?|\\:|\\,|\\;|\\." }, { token : "paren.lparen", regex : "[[({]" }, { token : "paren.rparen", regex : "[\\])}]" }, { token : "text", regex : "\\s+" } ], "comment" : [ { token : "comment", // closing comment regex : "\\*\\/", next : "start" }, { defaultToken : "comment" } ] }; this.embedRules(DocCommentHighlightRules, "doc-", [ DocCommentHighlightRules.getEndRule("start") ]); this.normalizeRules(); }; oop.inherits(CSharpHighlightRules, TextHighlightRules); exports.CSharpHighlightRules = CSharpHighlightRules; }); ================================================ FILE: lib/ace/mode/csound_document.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CsoundDocumentHighlightRules = require("./csound_document_highlight_rules").CsoundDocumentHighlightRules; var Mode = function() { this.HighlightRules = CsoundDocumentHighlightRules; }; oop.inherits(Mode, TextMode); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/csound_document_highlight_rules.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var CsoundOrchestraHighlightRules = require("./csound_orchestra_highlight_rules").CsoundOrchestraHighlightRules; var CsoundScoreHighlightRules = require("./csound_score_highlight_rules").CsoundScoreHighlightRules; var HtmlHighlightRules = require("./html_highlight_rules").HtmlHighlightRules; var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CsoundDocumentHighlightRules = function() { this.$rules = { "start": [ { token : ["meta.tag.punctuation.tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : /(<)(CsoundSynthesi[sz]er)(>)/, next : "synthesizer" }, {defaultToken : "text.csound-document"} ], "synthesizer": [ { token : ["meta.tag.punctuation.end-tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "()", next : "start" }, { token : ["meta.tag.punctuation.tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "(<)(CsInstruments)(>)", next : "csound-start" }, { token : ["meta.tag.punctuation.tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "(<)(CsScore)(>)", next : "csound-score-start" }, { token : ["meta.tag.punctuation.tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "(<)([Hh][Tt][Mm][Ll])(>)", next : "html-start" } ] }; this.embedRules(CsoundOrchestraHighlightRules, "csound-", [{ token : ["meta.tag.punctuation.end-tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "()", next : "synthesizer" }]); this.embedRules(CsoundScoreHighlightRules, "csound-score-", [{ token : ["meta.tag.punctuation.end-tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "()", next : "synthesizer" }]); this.embedRules(HtmlHighlightRules, "html-", [{ token : ["meta.tag.punctuation.end-tag-open.csound-document", "entity.name.tag.begin.csound-document", "meta.tag.punctuation.tag-close.csound-document"], regex : "()", next : "synthesizer" }]); this.normalizeRules(); }; oop.inherits(CsoundDocumentHighlightRules, TextHighlightRules); exports.CsoundDocumentHighlightRules = CsoundDocumentHighlightRules; }); ================================================ FILE: lib/ace/mode/csound_orchestra.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CsoundOrchestraHighlightRules = require("./csound_orchestra_highlight_rules").CsoundOrchestraHighlightRules; var Mode = function() { this.HighlightRules = CsoundOrchestraHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/csound_orchestra_highlight_rules.js ================================================ define(function(require, exports, module) { "use strict"; var lang = require("../lib/lang"); var oop = require("../lib/oop"); var CsoundPreprocessorHighlightRules = require("./csound_preprocessor_highlight_rules").CsoundPreprocessorHighlightRules; var CsoundScoreHighlightRules = require("./csound_score_highlight_rules").CsoundScoreHighlightRules; var LuaHighlightRules = require("./lua_highlight_rules").LuaHighlightRules; var PythonHighlightRules = require("./python_highlight_rules").PythonHighlightRules; var CsoundOrchestraHighlightRules = function() { CsoundPreprocessorHighlightRules.call(this); // To update the opcodes and deprecatedOpcodes arrays, run /* curl --remote-name https://bitbucket.org/nwhetsell/pygments-main/raw/tip/pygments/lexers/_csound_builtins.py python -c "import json; from _csound_builtins import OPCODES, DEPRECATED_OPCODES; print 'var opcodes = {};'.format(json.dumps(sorted(list(OPCODES)), indent=4)); print 'var deprecatedOpcodes = {};'.format(json.dumps(sorted(list(DEPRECATED_OPCODES)), indent=4))" */ // and then paste the output. var opcodes = [ "ATSadd", "ATSaddnz", "ATSbufread", "ATScross", "ATSinfo", "ATSinterpread", "ATSpartialtap", "ATSread", "ATSreadnz", "ATSsinnoi", "FLbox", "FLbutBank", "FLbutton", "FLcloseButton", "FLcolor", "FLcolor2", "FLcount", "FLexecButton", "FLgetsnap", "FLgroup", "FLgroupEnd", "FLgroup_end", "FLhide", "FLhvsBox", "FLhvsBoxSetValue", "FLjoy", "FLkeyIn", "FLknob", "FLlabel", "FLloadsnap", "FLmouse", "FLpack", "FLpackEnd", "FLpack_end", "FLpanel", "FLpanelEnd", "FLpanel_end", "FLprintk", "FLprintk2", "FLroller", "FLrun", "FLsavesnap", "FLscroll", "FLscrollEnd", "FLscroll_end", "FLsetAlign", "FLsetBox", "FLsetColor", "FLsetColor2", "FLsetFont", "FLsetPosition", "FLsetSize", "FLsetSnapGroup", "FLsetText", "FLsetTextColor", "FLsetTextSize", "FLsetTextType", "FLsetVal", "FLsetVal_i", "FLsetVali", "FLsetsnap", "FLshow", "FLslidBnk", "FLslidBnk2", "FLslidBnk2Set", "FLslidBnk2Setk", "FLslidBnkGetHandle", "FLslidBnkSet", "FLslidBnkSetk", "FLslider", "FLtabs", "FLtabsEnd", "FLtabs_end", "FLtext", "FLupdate", "FLvalue", "FLvkeybd", "FLvslidBnk", "FLvslidBnk2", "FLxyin", "JackoAudioIn", "JackoAudioInConnect", "JackoAudioOut", "JackoAudioOutConnect", "JackoFreewheel", "JackoInfo", "JackoInit", "JackoMidiInConnect", "JackoMidiOut", "JackoMidiOutConnect", "JackoNoteOut", "JackoOn", "JackoTransport", "K35_hpf", "K35_lpf", "MixerClear", "MixerGetLevel", "MixerReceive", "MixerSend", "MixerSetLevel", "MixerSetLevel_i", "OSCinit", "OSCinitM", "OSClisten", "OSCraw", "OSCsend", "OSCsendA", "OSCsend_lo", "S", "STKBandedWG", "STKBeeThree", "STKBlowBotl", "STKBlowHole", "STKBowed", "STKBrass", "STKClarinet", "STKDrummer", "STKFMVoices", "STKFlute", "STKHevyMetl", "STKMandolin", "STKModalBar", "STKMoog", "STKPercFlut", "STKPlucked", "STKResonate", "STKRhodey", "STKSaxofony", "STKShakers", "STKSimple", "STKSitar", "STKStifKarp", "STKTubeBell", "STKVoicForm", "STKWhistle", "STKWurley", "a", "abs", "active", "adsr", "adsyn", "adsynt", "adsynt2", "aftouch", "alpass", "alwayson", "ampdb", "ampdbfs", "ampmidi", "ampmidid", "areson", "aresonk", "atone", "atonek", "atonex", "babo", "balance", "bamboo", "barmodel", "bbcutm", "bbcuts", "betarand", "bexprnd", "bformdec1", "bformenc1", "binit", "biquad", "biquada", "birnd", "bpf", "bqrez", "buchla", "butbp", "butbr", "buthp", "butlp", "butterbp", "butterbr", "butterhp", "butterlp", "button", "buzz", "c2r", "cabasa", "cauchy", "cauchyi", "cbrt", "ceil", "cell", "cent", "centroid", "ceps", "cepsinv", "chanctrl", "changed", "changed2", "chani", "chano", "chebyshevpoly", "checkbox", "chn_S", "chn_a", "chn_k", "chnclear", "chnexport", "chnget", "chnmix", "chnparams", "chnset", "chuap", "clear", "clfilt", "clip", "clockoff", "clockon", "cmp", "cmplxprod", "comb", "combinv", "compilecsd", "compileorc", "compilestr", "compress", "compress2", "connect", "control", "convle", "convolve", "copya2ftab", "copyf2array", "cos", "cosh", "cosinv", "cosseg", "cossegb", "cossegr", "cps2pch", "cpsmidi", "cpsmidib", "cpsmidinn", "cpsoct", "cpspch", "cpstmid", "cpstun", "cpstuni", "cpsxpch", "cpumeter", "cpuprc", "cross2", "crossfm", "crossfmi", "crossfmpm", "crossfmpmi", "crosspm", "crosspmi", "crunch", "ctlchn", "ctrl14", "ctrl21", "ctrl7", "ctrlinit", "cuserrnd", "dam", "date", "dates", "db", "dbamp", "dbfsamp", "dcblock", "dcblock2", "dconv", "dct", "dctinv", "delay", "delay1", "delayk", "delayr", "delayw", "deltap", "deltap3", "deltapi", "deltapn", "deltapx", "deltapxw", "denorm", "diff", "diode_ladder", "directory", "diskgrain", "diskin", "diskin2", "dispfft", "display", "distort", "distort1", "divz", "doppler", "dot", "downsamp", "dripwater", "dssiactivate", "dssiaudio", "dssictls", "dssiinit", "dssilist", "dumpk", "dumpk2", "dumpk3", "dumpk4", "duserrnd", "dust", "dust2", "envlpx", "envlpxr", "ephasor", "eqfil", "evalstr", "event", "event_i", "exciter", "exitnow", "exp", "expcurve", "expon", "exprand", "exprandi", "expseg", "expsega", "expsegb", "expsegba", "expsegr", "fareylen", "fareyleni", "faustaudio", "faustcompile", "faustctl", "faustgen", "fft", "fftinv", "ficlose", "filebit", "filelen", "filenchnls", "filepeak", "filescal", "filesr", "filevalid", "fillarray", "filter2", "fin", "fini", "fink", "fiopen", "flanger", "flashtxt", "flooper", "flooper2", "floor", "fluidAllOut", "fluidCCi", "fluidCCk", "fluidControl", "fluidEngine", "fluidLoad", "fluidNote", "fluidOut", "fluidProgramSelect", "fluidSetInterpMethod", "fmanal", "fmax", "fmb3", "fmbell", "fmin", "fmmetal", "fmod", "fmpercfl", "fmrhode", "fmvoice", "fmwurlie", "fof", "fof2", "fofilter", "fog", "fold", "follow", "follow2", "foscil", "foscili", "fout", "fouti", "foutir", "foutk", "fprintks", "fprints", "frac", "fractalnoise", "framebuffer", "freeverb", "ftchnls", "ftconv", "ftcps", "ftfree", "ftgen", "ftgenonce", "ftgentmp", "ftlen", "ftload", "ftloadk", "ftlptim", "ftmorf", "ftom", "ftresize", "ftresizei", "ftsamplebank", "ftsave", "ftsavek", "ftsr", "gain", "gainslider", "gauss", "gaussi", "gausstrig", "gbuzz", "genarray", "genarray_i", "gendy", "gendyc", "gendyx", "getcfg", "getcol", "getftargs", "getrow", "getseed", "gogobel", "grain", "grain2", "grain3", "granule", "guiro", "harmon", "harmon2", "harmon3", "harmon4", "hdf5read", "hdf5write", "hilbert", "hilbert2", "hrtfearly", "hrtfmove", "hrtfmove2", "hrtfreverb", "hrtfstat", "hsboscil", "hvs1", "hvs2", "hvs3", "hypot", "i", "ihold", "imagecreate", "imagefree", "imagegetpixel", "imageload", "imagesave", "imagesetpixel", "imagesize", "in", "in32", "inch", "inh", "init", "initc14", "initc21", "initc7", "inleta", "inletf", "inletk", "inletkid", "inletv", "ino", "inq", "inrg", "ins", "insglobal", "insremot", "int", "integ", "interp", "invalue", "inx", "inz", "jacktransport", "jitter", "jitter2", "joystick", "jspline", "k", "la_i_add_mc", "la_i_add_mr", "la_i_add_vc", "la_i_add_vr", "la_i_assign_mc", "la_i_assign_mr", "la_i_assign_t", "la_i_assign_vc", "la_i_assign_vr", "la_i_conjugate_mc", "la_i_conjugate_mr", "la_i_conjugate_vc", "la_i_conjugate_vr", "la_i_distance_vc", "la_i_distance_vr", "la_i_divide_mc", "la_i_divide_mr", "la_i_divide_vc", "la_i_divide_vr", "la_i_dot_mc", "la_i_dot_mc_vc", "la_i_dot_mr", "la_i_dot_mr_vr", "la_i_dot_vc", "la_i_dot_vr", "la_i_get_mc", "la_i_get_mr", "la_i_get_vc", "la_i_get_vr", "la_i_invert_mc", "la_i_invert_mr", "la_i_lower_solve_mc", "la_i_lower_solve_mr", "la_i_lu_det_mc", "la_i_lu_det_mr", "la_i_lu_factor_mc", "la_i_lu_factor_mr", "la_i_lu_solve_mc", "la_i_lu_solve_mr", "la_i_mc_create", "la_i_mc_set", "la_i_mr_create", "la_i_mr_set", "la_i_multiply_mc", "la_i_multiply_mr", "la_i_multiply_vc", "la_i_multiply_vr", "la_i_norm1_mc", "la_i_norm1_mr", "la_i_norm1_vc", "la_i_norm1_vr", "la_i_norm_euclid_mc", "la_i_norm_euclid_mr", "la_i_norm_euclid_vc", "la_i_norm_euclid_vr", "la_i_norm_inf_mc", "la_i_norm_inf_mr", "la_i_norm_inf_vc", "la_i_norm_inf_vr", "la_i_norm_max_mc", "la_i_norm_max_mr", "la_i_print_mc", "la_i_print_mr", "la_i_print_vc", "la_i_print_vr", "la_i_qr_eigen_mc", "la_i_qr_eigen_mr", "la_i_qr_factor_mc", "la_i_qr_factor_mr", "la_i_qr_sym_eigen_mc", "la_i_qr_sym_eigen_mr", "la_i_random_mc", "la_i_random_mr", "la_i_random_vc", "la_i_random_vr", "la_i_size_mc", "la_i_size_mr", "la_i_size_vc", "la_i_size_vr", "la_i_subtract_mc", "la_i_subtract_mr", "la_i_subtract_vc", "la_i_subtract_vr", "la_i_t_assign", "la_i_trace_mc", "la_i_trace_mr", "la_i_transpose_mc", "la_i_transpose_mr", "la_i_upper_solve_mc", "la_i_upper_solve_mr", "la_i_vc_create", "la_i_vc_set", "la_i_vr_create", "la_i_vr_set", "la_k_a_assign", "la_k_add_mc", "la_k_add_mr", "la_k_add_vc", "la_k_add_vr", "la_k_assign_a", "la_k_assign_f", "la_k_assign_mc", "la_k_assign_mr", "la_k_assign_t", "la_k_assign_vc", "la_k_assign_vr", "la_k_conjugate_mc", "la_k_conjugate_mr", "la_k_conjugate_vc", "la_k_conjugate_vr", "la_k_current_f", "la_k_current_vr", "la_k_distance_vc", "la_k_distance_vr", "la_k_divide_mc", "la_k_divide_mr", "la_k_divide_vc", "la_k_divide_vr", "la_k_dot_mc", "la_k_dot_mc_vc", "la_k_dot_mr", "la_k_dot_mr_vr", "la_k_dot_vc", "la_k_dot_vr", "la_k_f_assign", "la_k_get_mc", "la_k_get_mr", "la_k_get_vc", "la_k_get_vr", "la_k_invert_mc", "la_k_invert_mr", "la_k_lower_solve_mc", "la_k_lower_solve_mr", "la_k_lu_det_mc", "la_k_lu_det_mr", "la_k_lu_factor_mc", "la_k_lu_factor_mr", "la_k_lu_solve_mc", "la_k_lu_solve_mr", "la_k_mc_set", "la_k_mr_set", "la_k_multiply_mc", "la_k_multiply_mr", "la_k_multiply_vc", "la_k_multiply_vr", "la_k_norm1_mc", "la_k_norm1_mr", "la_k_norm1_vc", "la_k_norm1_vr", "la_k_norm_euclid_mc", "la_k_norm_euclid_mr", "la_k_norm_euclid_vc", "la_k_norm_euclid_vr", "la_k_norm_inf_mc", "la_k_norm_inf_mr", "la_k_norm_inf_vc", "la_k_norm_inf_vr", "la_k_norm_max_mc", "la_k_norm_max_mr", "la_k_qr_eigen_mc", "la_k_qr_eigen_mr", "la_k_qr_factor_mc", "la_k_qr_factor_mr", "la_k_qr_sym_eigen_mc", "la_k_qr_sym_eigen_mr", "la_k_random_mc", "la_k_random_mr", "la_k_random_vc", "la_k_random_vr", "la_k_subtract_mc", "la_k_subtract_mr", "la_k_subtract_vc", "la_k_subtract_vr", "la_k_t_assign", "la_k_trace_mc", "la_k_trace_mr", "la_k_upper_solve_mc", "la_k_upper_solve_mr", "la_k_vc_set", "la_k_vr_set", "lenarray", "lfo", "limit", "limit1", "line", "linen", "linenr", "lineto", "link_beat_force", "link_beat_get", "link_beat_request", "link_create", "link_enable", "link_is_enabled", "link_metro", "link_peers", "link_tempo_get", "link_tempo_set", "linlin", "linrand", "linseg", "linsegb", "linsegr", "liveconv", "locsend", "locsig", "log", "log10", "log2", "logbtwo", "logcurve", "loopseg", "loopsegp", "looptseg", "loopxseg", "lorenz", "loscil", "loscil3", "loscilx", "lowpass2", "lowres", "lowresx", "lpf18", "lpform", "lpfreson", "lphasor", "lpinterp", "lposcil", "lposcil3", "lposcila", "lposcilsa", "lposcilsa2", "lpread", "lpreson", "lpshold", "lpsholdp", "lpslot", "lua_exec", "lua_iaopcall", "lua_iaopcall_off", "lua_ikopcall", "lua_ikopcall_off", "lua_iopcall", "lua_iopcall_off", "lua_opdef", "mac", "maca", "madsr", "mags", "mandel", "mandol", "maparray", "maparray_i", "marimba", "massign", "max", "max_k", "maxabs", "maxabsaccum", "maxaccum", "maxalloc", "maxarray", "mclock", "mdelay", "median", "mediank", "metro", "mfb", "midglobal", "midiarp", "midic14", "midic21", "midic7", "midichannelaftertouch", "midichn", "midicontrolchange", "midictrl", "mididefault", "midifilestatus", "midiin", "midinoteoff", "midinoteoncps", "midinoteonkey", "midinoteonoct", "midinoteonpch", "midion", "midion2", "midiout", "midipgm", "midipitchbend", "midipolyaftertouch", "midiprogramchange", "miditempo", "midremot", "min", "minabs", "minabsaccum", "minaccum", "minarray", "mincer", "mirror", "mode", "modmatrix", "monitor", "moog", "moogladder", "moogladder2", "moogvcf", "moogvcf2", "moscil", "mp3bitrate", "mp3in", "mp3len", "mp3nchnls", "mp3scal", "mp3scal_check", "mp3scal_load", "mp3scal_load2", "mp3scal_play", "mp3scal_play2", "mp3sr", "mpulse", "mrtmsg", "mtof", "mton", "multitap", "mute", "mvchpf", "mvclpf1", "mvclpf2", "mvclpf3", "mvclpf4", "mxadsr", "nchnls_hw", "nestedap", "nlalp", "nlfilt", "nlfilt2", "noise", "noteoff", "noteon", "noteondur", "noteondur2", "notnum", "nreverb", "nrpn", "nsamp", "nstance", "nstrnum", "ntom", "ntrpol", "nxtpow2", "octave", "octcps", "octmidi", "octmidib", "octmidinn", "octpch", "olabuffer", "oscbnk", "oscil", "oscil1", "oscil1i", "oscil3", "oscili", "oscilikt", "osciliktp", "oscilikts", "osciln", "oscils", "oscilx", "out", "out32", "outc", "outch", "outh", "outiat", "outic", "outic14", "outipat", "outipb", "outipc", "outkat", "outkc", "outkc14", "outkpat", "outkpb", "outkpc", "outleta", "outletf", "outletk", "outletkid", "outletv", "outo", "outq", "outq1", "outq2", "outq3", "outq4", "outrg", "outs", "outs1", "outs2", "outvalue", "outx", "outz", "p", "p5gconnect", "p5gdata", "pan", "pan2", "pareq", "part2txt", "partials", "partikkel", "partikkelget", "partikkelset", "partikkelsync", "passign", "paulstretch", "pcauchy", "pchbend", "pchmidi", "pchmidib", "pchmidinn", "pchoct", "pchtom", "pconvolve", "pcount", "pdclip", "pdhalf", "pdhalfy", "peak", "pgmassign", "pgmchn", "phaser1", "phaser2", "phasor", "phasorbnk", "phs", "pindex", "pinker", "pinkish", "pitch", "pitchac", "pitchamdf", "planet", "platerev", "plltrack", "pluck", "poisson", "pol2rect", "polyaft", "polynomial", "port", "portk", "poscil", "poscil3", "pow", "powershape", "powoftwo", "pows", "prealloc", "prepiano", "print", "print_type", "printf", "printf_i", "printk", "printk2", "printks", "printks2", "prints", "product", "pset", "ptable", "ptable3", "ptablei", "ptableiw", "ptablew", "ptrack", "puts", "pvadd", "pvbufread", "pvcross", "pvinterp", "pvoc", "pvread", "pvs2array", "pvs2tab", "pvsadsyn", "pvsanal", "pvsarp", "pvsbandp", "pvsbandr", "pvsbin", "pvsblur", "pvsbuffer", "pvsbufread", "pvsbufread2", "pvscale", "pvscent", "pvsceps", "pvscross", "pvsdemix", "pvsdiskin", "pvsdisp", "pvsenvftw", "pvsfilter", "pvsfread", "pvsfreeze", "pvsfromarray", "pvsftr", "pvsftw", "pvsfwrite", "pvsgain", "pvsgendy", "pvshift", "pvsifd", "pvsin", "pvsinfo", "pvsinit", "pvslock", "pvsmaska", "pvsmix", "pvsmooth", "pvsmorph", "pvsosc", "pvsout", "pvspitch", "pvstanal", "pvstencil", "pvstrace", "pvsvoc", "pvswarp", "pvsynth", "pwd", "pyassign", "pyassigni", "pyassignt", "pycall", "pycall1", "pycall1i", "pycall1t", "pycall2", "pycall2i", "pycall2t", "pycall3", "pycall3i", "pycall3t", "pycall4", "pycall4i", "pycall4t", "pycall5", "pycall5i", "pycall5t", "pycall6", "pycall6i", "pycall6t", "pycall7", "pycall7i", "pycall7t", "pycall8", "pycall8i", "pycall8t", "pycalli", "pycalln", "pycallni", "pycallt", "pyeval", "pyevali", "pyevalt", "pyexec", "pyexeci", "pyexect", "pyinit", "pylassign", "pylassigni", "pylassignt", "pylcall", "pylcall1", "pylcall1i", "pylcall1t", "pylcall2", "pylcall2i", "pylcall2t", "pylcall3", "pylcall3i", "pylcall3t", "pylcall4", "pylcall4i", "pylcall4t", "pylcall5", "pylcall5i", "pylcall5t", "pylcall6", "pylcall6i", "pylcall6t", "pylcall7", "pylcall7i", "pylcall7t", "pylcall8", "pylcall8i", "pylcall8t", "pylcalli", "pylcalln", "pylcallni", "pylcallt", "pyleval", "pylevali", "pylevalt", "pylexec", "pylexeci", "pylexect", "pylrun", "pylruni", "pylrunt", "pyrun", "pyruni", "pyrunt", "qinf", "qnan", "r2c", "rand", "randh", "randi", "random", "randomh", "randomi", "rbjeq", "readclock", "readf", "readfi", "readk", "readk2", "readk3", "readk4", "readks", "readscore", "readscratch", "rect2pol", "release", "remoteport", "remove", "repluck", "reson", "resonk", "resonr", "resonx", "resonxk", "resony", "resonz", "resyn", "reverb", "reverb2", "reverbsc", "rewindscore", "rezzy", "rfft", "rifft", "rms", "rnd", "rnd31", "round", "rspline", "rtclock", "s16b14", "s32b14", "samphold", "sandpaper", "sc_lag", "sc_lagud", "sc_phasor", "sc_trig", "scale", "scalearray", "scanhammer", "scans", "scantable", "scanu", "schedkwhen", "schedkwhennamed", "schedule", "schedwhen", "scoreline", "scoreline_i", "seed", "sekere", "select", "semitone", "sense", "sensekey", "seqtime", "seqtime2", "serialBegin", "serialEnd", "serialFlush", "serialPrint", "serialRead", "serialWrite", "serialWrite_i", "setcol", "setctrl", "setksmps", "setrow", "setscorepos", "sfilist", "sfinstr", "sfinstr3", "sfinstr3m", "sfinstrm", "sfload", "sflooper", "sfpassign", "sfplay", "sfplay3", "sfplay3m", "sfplaym", "sfplist", "sfpreset", "shaker", "shiftin", "shiftout", "signalflowgraph", "signum", "sin", "sinh", "sininv", "sinsyn", "sleighbells", "slicearray", "slider16", "slider16f", "slider16table", "slider16tablef", "slider32", "slider32f", "slider32table", "slider32tablef", "slider64", "slider64f", "slider64table", "slider64tablef", "slider8", "slider8f", "slider8table", "slider8tablef", "sliderKawai", "sndloop", "sndwarp", "sndwarpst", "sockrecv", "sockrecvs", "socksend", "socksend_k", "socksends", "sorta", "sortd", "soundin", "space", "spat3d", "spat3di", "spat3dt", "spdist", "splitrig", "sprintf", "sprintfk", "spsend", "sqrt", "statevar", "stix", "strcat", "strcatk", "strchar", "strchark", "strcmp", "strcmpk", "strcpy", "strcpyk", "strecv", "streson", "strfromurl", "strget", "strindex", "strindexk", "strlen", "strlenk", "strlower", "strlowerk", "strrindex", "strrindexk", "strset", "strsub", "strsubk", "strtod", "strtodk", "strtol", "strtolk", "strupper", "strupperk", "stsend", "subinstr", "subinstrinit", "sum", "sumarray", "svfilter", "syncgrain", "syncloop", "syncphasor", "system", "system_i", "tab", "tab2pvs", "tab_i", "tabifd", "table", "table3", "table3kt", "tablecopy", "tablefilter", "tablefilteri", "tablegpw", "tablei", "tableicopy", "tableigpw", "tableikt", "tableimix", "tableiw", "tablekt", "tablemix", "tableng", "tablera", "tableseg", "tableshuffle", "tableshufflei", "tablew", "tablewa", "tablewkt", "tablexkt", "tablexseg", "tabmorph", "tabmorpha", "tabmorphak", "tabmorphi", "tabplay", "tabrec", "tabsum", "tabw", "tabw_i", "tambourine", "tan", "tanh", "taninv", "taninv2", "tb0", "tb0_init", "tb1", "tb10", "tb10_init", "tb11", "tb11_init", "tb12", "tb12_init", "tb13", "tb13_init", "tb14", "tb14_init", "tb15", "tb15_init", "tb1_init", "tb2", "tb2_init", "tb3", "tb3_init", "tb4", "tb4_init", "tb5", "tb5_init", "tb6", "tb6_init", "tb7", "tb7_init", "tb8", "tb8_init", "tb9", "tb9_init", "tbvcf", "tempest", "tempo", "temposcal", "tempoval", "timedseq", "timeinstk", "timeinsts", "timek", "times", "tival", "tlineto", "tone", "tonek", "tonex", "tradsyn", "trandom", "transeg", "transegb", "transegr", "trcross", "trfilter", "trhighest", "trigger", "trigseq", "trirand", "trlowest", "trmix", "trscale", "trshift", "trsplit", "turnoff", "turnoff2", "turnon", "tvconv", "unirand", "unwrap", "upsamp", "urandom", "urd", "vactrol", "vadd", "vadd_i", "vaddv", "vaddv_i", "vaget", "valpass", "vaset", "vbap", "vbapg", "vbapgmove", "vbaplsinit", "vbapmove", "vbapz", "vbapzmove", "vcella", "vco", "vco2", "vco2ft", "vco2ift", "vco2init", "vcomb", "vcopy", "vcopy_i", "vdel_k", "vdelay", "vdelay3", "vdelayk", "vdelayx", "vdelayxq", "vdelayxs", "vdelayxw", "vdelayxwq", "vdelayxws", "vdivv", "vdivv_i", "vecdelay", "veloc", "vexp", "vexp_i", "vexpseg", "vexpv", "vexpv_i", "vibes", "vibr", "vibrato", "vincr", "vlimit", "vlinseg", "vlowres", "vmap", "vmirror", "vmult", "vmult_i", "vmultv", "vmultv_i", "voice", "vosim", "vphaseseg", "vport", "vpow", "vpow_i", "vpowv", "vpowv_i", "vpvoc", "vrandh", "vrandi", "vsubv", "vsubv_i", "vtaba", "vtabi", "vtabk", "vtable1k", "vtablea", "vtablei", "vtablek", "vtablewa", "vtablewi", "vtablewk", "vtabwa", "vtabwi", "vtabwk", "vwrap", "waveset", "websocket", "weibull", "wgbow", "wgbowedbar", "wgbrass", "wgclar", "wgflute", "wgpluck", "wgpluck2", "wguide1", "wguide2", "wiiconnect", "wiidata", "wiirange", "wiisend", "window", "wrap", "writescratch", "wterrain", "xadsr", "xin", "xout", "xscanmap", "xscans", "xscansmap", "xscanu", "xtratim", "xyscale", "zacl", "zakinit", "zamod", "zar", "zarg", "zaw", "zawm", "zdf_1pole", "zdf_1pole_mode", "zdf_2pole", "zdf_2pole_mode", "zdf_ladder", "zfilter2", "zir", "ziw", "ziwm", "zkcl", "zkmod", "zkr", "zkw", "zkwm" ]; var deprecatedOpcodes = [ "array", "bformdec", "bformenc", "copy2ftab", "copy2ttab", "hrtfer", "ktableseg", "lentab", "maxtab", "mintab", "pop", "pop_f", "push", "push_f", "scalet", "sndload", "soundout", "soundouts", "specaddm", "specdiff", "specdisp", "specfilt", "spechist", "specptrk", "specscal", "specsum", "spectrum", "stack", "sumtab", "tabgen", "tabmap", "tabmap_i", "tabslice", "vbap16", "vbap4", "vbap4move", "vbap8", "vbap8move", "xyin" ]; opcodes = lang.arrayToMap(opcodes); deprecatedOpcodes = lang.arrayToMap(deprecatedOpcodes); this.lineContinuations = [ { token : "constant.character.escape.line-continuation.csound", regex : /\\$/ }, this.pushRule({ token : "constant.character.escape.line-continuation.csound", regex : /\\/, next : "line continuation" }) ]; this.comments.push(this.lineContinuations); this.quotedStringContents.push( this.lineContinuations, { token : "invalid.illegal", regex : /[^"\\]*$/ } ); var start = this.$rules.start; start.splice(1, 0, { token : ["text.csound", "entity.name.label.csound", "entity.punctuation.label.csound", "text.csound"], regex : /^([ \t]*)(\w+)(:)([ \t]+|$)/ }); start.push( this.pushRule({ token : "keyword.function.csound", regex : /\binstr\b/, next : "instrument numbers and identifiers" }), this.pushRule({ token : "keyword.function.csound", regex : /\bopcode\b/, next : "after opcode keyword" }), { token : "keyword.other.csound", regex : /\bend(?:in|op)\b/ }, { token : "variable.language.csound", regex : /\b(?:0dbfs|A4|k(?:r|smps)|nchnls(?:_i)?|sr)\b/ }, this.numbers, { token : "keyword.operator.csound", regex : "\\+=|-=|\\*=|/=|<<|>>|<=|>=|==|!=|&&|\\|\\||[~¬]|[=!+\\-*/^%&|<>#?:]" }, this.pushRule({ token : "punctuation.definition.string.begin.csound", regex : /"/, next : "quoted string" }), this.pushRule({ token : "punctuation.definition.string.begin.csound", regex : /{{/, next : "braced string" }), { token : "keyword.control.csound", regex : /\b(?:do|else(?:if)?|end(?:if|until)|fi|i(?:f|then)|kthen|od|r(?:ir)?eturn|then|until|while)\b/ }, this.pushRule({ token : "keyword.control.csound", regex : /\b[ik]?goto\b/, next : "goto before label" }), this.pushRule({ token : "keyword.control.csound", regex : /\b(?:r(?:einit|igoto)|tigoto)\b/, next : "goto before label" }), this.pushRule({ token : "keyword.control.csound", regex : /\bc(?:g|in?|k|nk?)goto\b/, next : ["goto before label", "goto before argument"] }), this.pushRule({ token : "keyword.control.csound", regex : /\btimout\b/, next : ["goto before label", "goto before argument", "goto before argument"] }), this.pushRule({ token : "keyword.control.csound", regex : /\bloop_[gl][et]\b/, next : ["goto before label", "goto before argument", "goto before argument", "goto before argument"] }), this.pushRule({ token : "support.function.csound", regex : /\b(?:readscore|scoreline(?:_i)?)\b/, next : "Csound score opcode" }), this.pushRule({ token : "support.function.csound", regex : /\bpyl?run[it]?\b(?!$)/, next : "Python opcode" }), this.pushRule({ token : "support.function.csound", regex : /\blua_(?:exec|opdef)\b(?!$)/, next : "Lua opcode" }), { token : "support.variable.csound", regex : /\bp\d+\b/ }, { regex : /\b([A-Z_a-z]\w*)(?:(:)([A-Za-z]))?\b/, onMatch: function(value, currentState, stack, line) { var tokens = value.split(this.splitRegex); var name = tokens[1]; var type; if (opcodes.hasOwnProperty(name)) type = "support.function.csound"; else if (deprecatedOpcodes.hasOwnProperty(name)) type = "invalid.deprecated.csound"; if (type) { if (tokens[2]) { return [ {type: type, value: name}, {type: "punctuation.type-annotation.csound", value: tokens[2]}, {type: "type-annotation.storage.type.csound", value: tokens[3]} ]; } return type; } return "text.csound"; } } ); this.$rules["macro parameter value list"].splice(2, 0, { token : "punctuation.definition.string.begin.csound", regex : /{{/, next : "macro parameter value braced string" }); this.addRules({ "macro parameter value braced string": [ { token : "constant.character.escape.csound", regex : /\\[#'()]/ }, { token : "invalid.illegal.csound.csound", regex : /[#'()]/ }, { token : "punctuation.definition.string.end.csound", regex : /}}/, next : "macro parameter value list" }, { defaultToken: "string.braced.csound" } ], "instrument numbers and identifiers": [ this.comments, { token : "entity.name.function.csound", regex : /\d+|[A-Z_a-z]\w*/ }, this.popRule({ token : "empty", regex : /$/ }) ], "after opcode keyword": [ this.comments, this.popRule({ token : "empty", regex : /$/ }), this.popRule({ token : "entity.name.function.opcode.csound", regex : /[A-Z_a-z]\w*/, next : "opcode type signatures" }) ], "opcode type signatures": [ this.comments, this.popRule({ token : "empty", regex : /$/ }), { token : "storage.type.csound", // https://github.com/csound/csound/search?q=XIDENT+path%3AEngine+filename%3Acsound_orc.lex regex : /\b(?:0|[afijkKoOpPStV\[\]]+)/ } ], "quoted string": [ this.popRule({ token : "punctuation.definition.string.end.csound", regex : /"/ }), this.quotedStringContents, { defaultToken: "string.quoted.csound" } ], "braced string": [ this.popRule({ token : "punctuation.definition.string.end.csound", regex : /}}/ }), this.bracedStringContents, { defaultToken: "string.braced.csound" } ], "goto before argument": [ this.popRule({ token : "text.csound", regex : /,/ }), start ], "goto before label": [ { token : "text.csound", regex : /\s+/ }, this.comments, this.popRule({ token : "entity.name.label.csound", regex : /\w+/ }), this.popRule({ token : "empty", regex : /(?!\w)/ }) ], "Csound score opcode": [ this.comments, { token : "punctuation.definition.string.begin.csound", regex : /{{/, next : "csound-score-start" }, this.popRule({ token : "empty", regex : /$/ }) ], "Python opcode": [ this.comments, { token : "punctuation.definition.string.begin.csound", regex : /{{/, next : "python-start" }, this.popRule({ token : "empty", regex : /$/ }) ], "Lua opcode": [ this.comments, { token : "punctuation.definition.string.begin.csound", regex : /{{/, next : "lua-start" }, this.popRule({ token : "empty", regex : /$/ }) ], "line continuation": [ this.popRule({ token : "empty", regex : /$/ }), this.semicolonComments, { token : "invalid.illegal.csound", regex : /\S.*/ } ] }); var rules = [ this.popRule({ token : "punctuation.definition.string.end.csound", regex : /}}/ }) ]; this.embedRules(CsoundScoreHighlightRules, "csound-score-", rules); this.embedRules(PythonHighlightRules, "python-", rules); this.embedRules(LuaHighlightRules, "lua-", rules); this.normalizeRules(); }; oop.inherits(CsoundOrchestraHighlightRules, CsoundPreprocessorHighlightRules); exports.CsoundOrchestraHighlightRules = CsoundOrchestraHighlightRules; }); ================================================ FILE: lib/ace/mode/csound_preprocessor_highlight_rules.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules; var CsoundPreprocessorHighlightRules = function() { this.semicolonComments = { token : "comment.line.semicolon.csound", regex : ";.*$" }; this.comments = [ { token : "punctuation.definition.comment.begin.csound", regex : "/\\*", push : [ { token : "punctuation.definition.comment.end.csound", regex : "\\*/", next : "pop" }, { defaultToken: "comment.block.csound" } ] }, { token : "comment.line.double-slash.csound", regex : "//.*$" }, this.semicolonComments ]; this.macroUses = [ { token : ["entity.name.function.preprocessor.csound", "punctuation.definition.macro-parameter-value-list.begin.csound"], regex : /(\$[A-Z_a-z]\w*\.?)(\()/, next : "macro parameter value list" }, { token : "entity.name.function.preprocessor.csound", regex : /\$[A-Z_a-z]\w*(?:\.|\b)/ } ]; this.numbers = [ { token : "constant.numeric.float.csound", regex : /(?:\d+[Ee][+-]?\d+)|(?:\d+\.\d*|\d*\.\d+)(?:[Ee][+-]?\d+)?/ }, { token : ["storage.type.number.csound", "constant.numeric.integer.hexadecimal.csound"], regex : /(0[Xx])([0-9A-Fa-f]+)/ }, { token : "constant.numeric.integer.decimal.csound", regex : /\d+/ } ]; this.bracedStringContents = [ { token : "constant.character.escape.csound", // https://github.com/csound/csound/search?q=unquote_string+path%3AEngine+filename%3Acsound_orc_compile.c regex : /\\(?:[\\abnrt"]|[0-7]{1,3})/ }, // Format specifiers are included in quoted and braced strings. This // means that format specifiers are highlighted in all strings, even // though only // fprintks https://csound.github.io/docs/manual/fprintks.html // fprints https://csound.github.io/docs/manual/fprints.html // printf/printf_i https://csound.github.io/docs/manual/printf.html // printks https://csound.github.io/docs/manual/printks.html // prints https://csound.github.io/docs/manual/prints.html // sprintf https://csound.github.io/docs/manual/sprintf.html // sprintfk https://csound.github.io/docs/manual/sprintfk.html // work with strings that contain format specifiers. In addition, these // opcodes’ handling of format specifiers is inconsistent: // - fprintks, fprints, printks, and prints do accept %a and %A // specifiers, but can’t accept %s specifiers. // - printf, printf_i, sprintf, and sprintfk don’t accept %a and %A // specifiers, but do accept %s specifiers. // See https://github.com/csound/csound/issues/747 for more information. { token : "constant.character.placeholder.csound", regex : /%[#0\- +]*\d*(?:\.\d+)?[diuoxXfFeEgGaAcs]/ }, { token : "constant.character.escape.csound", regex : /%%/ } ]; this.quotedStringContents = [ this.macroUses, this.bracedStringContents ]; var start = [ this.comments, { token : "keyword.preprocessor.csound", regex : /#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+/ }, { token : "keyword.preprocessor.csound", regex : /#include/, push : [ this.comments, { token : "string.csound", regex : /([^ \t])(?:.*?\1)/, next : "pop" } ] }, { token : "keyword.preprocessor.csound", regex : /#[ \t]*define/, next : "define directive" }, { token : "keyword.preprocessor.csound", regex : /#(?:ifn?def|undef)\b/, next : "macro directive" }, this.macroUses ]; this.$rules = { "start": start, "define directive": [ this.comments, { token : "entity.name.function.preprocessor.csound", regex : /[A-Z_a-z]\w*/ }, { token : "punctuation.definition.macro-parameter-name-list.begin.csound", regex : /\(/, next : "macro parameter name list" }, { token : "punctuation.definition.macro.begin.csound", regex : /#/, next : "macro body" } ], "macro parameter name list": [ { token : "variable.parameter.preprocessor.csound", regex : /[A-Z_a-z]\w*/ }, { token : "punctuation.definition.macro-parameter-name-list.end.csound", regex : /\)/, next : "define directive" } ], "macro body": [ { token : "constant.character.escape.csound", regex : /\\#/ }, { token : "punctuation.definition.macro.end.csound", regex : /#/, next : "start" }, start ], "macro directive": [ this.comments, { token : "entity.name.function.preprocessor.csound", regex : /[A-Z_a-z]\w*/, next : "start" } ], "macro parameter value list": [ { token : "punctuation.definition.macro-parameter-value-list.end.csound", regex : /\)/, next : "start" }, { token : "punctuation.definition.string.begin.csound", regex : /"/, next : "macro parameter value quoted string" }, this.pushRule({ token : "punctuation.macro-parameter-value-parenthetical.begin.csound", regex : /\(/, next : "macro parameter value parenthetical" }), { token : "punctuation.macro-parameter-value-separator.csound", regex : "[#']" } ], "macro parameter value quoted string": [ { token : "constant.character.escape.csound", regex : /\\[#'()]/ }, { token : "invalid.illegal.csound", regex : /[#'()]/ }, { token : "punctuation.definition.string.end.csound", regex : /"/, next : "macro parameter value list" }, this.quotedStringContents, { defaultToken: "string.quoted.csound" } ], "macro parameter value parenthetical": [ { token : "constant.character.escape.csound", regex : /\\\)/ }, this.popRule({ token : "punctuation.macro-parameter-value-parenthetical.end.csound", regex : /\)/ }), this.pushRule({ token : "punctuation.macro-parameter-value-parenthetical.begin.csound", regex : /\(/, next : "macro parameter value parenthetical" }), start ] }; }; oop.inherits(CsoundPreprocessorHighlightRules, TextHighlightRules); (function() { this.pushRule = function(params) { return { regex : params.regex, onMatch: function(value, currentState, stack, line) { if (stack.length === 0) stack.push(currentState); if (Array.isArray(params.next)) { for (var i = 0; i < params.next.length; i++) { stack.push(params.next[i]); } } else { stack.push(params.next); } this.next = stack[stack.length - 1]; return params.token; }, // TODO get next() { return Array.isArray(params.next) ? params.next[params.next.length - 1] : params.next; }, set next(next) { if (Array.isArray(params.next)) { var oldNext = params.next[params.next.length - 1]; var oldNextIndex = oldNext.length - 1; var newNextIndex = next.length - 1; if (newNextIndex > oldNextIndex) { while (oldNextIndex >= 0 && newNextIndex >= 0) { if (oldNext.charAt(oldNextIndex) !== next.charAt(newNextIndex)) { var prefix = next.substr(0, newNextIndex); for (var i = 0; i < params.next.length; i++) { params.next[i] = prefix + params.next[i]; } break; } oldNextIndex--; newNextIndex--; } } } else { params.next = next; } }, // TODO: normalizeRules get token() { return params.token; } }; }; this.popRule = function(params) { return { regex : params.regex, onMatch: function(value, currentState, stack, line) { stack.pop(); if (params.next) { stack.push(params.next); this.next = stack[stack.length - 1]; } else { this.next = stack.length > 1 ? stack[stack.length - 1] : stack.pop(); } return params.token; } }; }; }).call(CsoundPreprocessorHighlightRules.prototype); exports.CsoundPreprocessorHighlightRules = CsoundPreprocessorHighlightRules; }); ================================================ FILE: lib/ace/mode/csound_score.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var TextMode = require("./text").Mode; var CsoundScoreHighlightRules = require("./csound_score_highlight_rules").CsoundScoreHighlightRules; var Mode = function() { this.HighlightRules = CsoundScoreHighlightRules; }; oop.inherits(Mode, TextMode); (function() { this.lineCommentStart = ";"; this.blockComment = {start: "/*", end: "*/"}; }).call(Mode.prototype); exports.Mode = Mode; }); ================================================ FILE: lib/ace/mode/csound_score_highlight_rules.js ================================================ define(function(require, exports, module) { "use strict"; var oop = require("../lib/oop"); var CsoundPreprocessorHighlightRules = require("./csound_preprocessor_highlight_rules").CsoundPreprocessorHighlightRules; var CsoundScoreHighlightRules = function() { CsoundPreprocessorHighlightRules.call(this); this.quotedStringContents.push({ token : "invalid.illegal.csound-score", regex : /[^"]*$/ }); var start = this.$rules.start; start.push( { token : "keyword.control.csound-score", regex : /[abCdefiqstvxy]/ }, { // w statements are generated internally and should not be used; see // https://github.com/csound/csound/issues/750. token : "invalid.illegal.csound-score", regex : /w/ }, { // z is not a statement, but rather a constant equal to // 800,000,000,000. 800 billion seconds is about 25,367.8 years. See // also https://csound.github.io/docs/manual/ScoreTop.html and // https://github.com/csound/csound/search?q=stof+path%3AEngine+filename%3Asread.c. token : "constant.numeric.language.csound-score", regex : /z/ }, { token : ["keyword.control.csound-score", "constant.numeric.integer.decimal.csound-score"], regex : /([nNpP][pP])(\d+)/ }, { token : "keyword.other.csound-score", regex : /[mn]/, push : [ { token : "empty", regex : /$/, next : "pop" }, this.comments, { token : "entity.name.label.csound-score", regex : /[A-Z_a-z]\w*/ } ] }, { token : "keyword.preprocessor.csound-score", regex : /r\b/, next : "repeat section" }, this.numbers, { token : "keyword.operator.csound-score", regex : "[!+\\-*/^%&|<>#~.]" }, this.pushRule({ token : "punctuation.definition.string.begin.csound-score", regex : /"/, next : "quoted string" }), this.pushRule({ token : "punctuation.braced-loop.begin.csound-score", regex : /{/, next : "loop after left brace" }) ); this.addRules({ "repeat section": [ { token : "empty", regex : /$/, next : "start" }, this.comments, { token : "constant.numeric.integer.decimal.csound-score", regex : /\d+/, next : "repeat section before label" } ], "repeat section before label": [ { token : "empty", regex : /$/, next : "start" }, this.comments, { token : "entity.name.label.csound-score", regex : /[A-Z_a-z]\w*/, next : "start" } ], "quoted string": [ this.popRule({ token : "punctuation.definition.string.end.csound-score", regex : /"/ }), this.quotedStringContents, { defaultToken: "string.quoted.csound-score" } ], "loop after left brace": [ this.popRule({ token : "constant.numeric.integer.decimal.csound-score", regex : /\d+/, next : "loop after repeat count" }), this.comments, { token : "invalid.illegal.csound", regex : /\S.*/ } ], "loop after repeat count": [ this.popRule({ token : "entity.name.function.preprocessor.csound-score", regex : /[A-Z_a-z]\w*\b/, next : "loop after macro name" }), this.comments, { token : "invalid.illegal.csound", regex : /\S.*/ } ], "loop after macro name": [ start, this.popRule({ token : "punctuation.braced-loop.end.csound-score", regex : /}/ }) ] }); this.normalizeRules(); }; oop.inherits(CsoundScoreHighlightRules, CsoundPreprocessorHighlightRules); exports.CsoundScoreHighlightRules = CsoundScoreHighlightRules; }); ================================================ FILE: lib/ace/mode/css/csslint.js ================================================ define(function(require, exports, module) { /*! CSSLint Copyright (c) 2014 Nicole Sullivan and Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Build: v0.10.0 22-July-2014 01:17:52 */ /*! Parser-Lib Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Version v0.2.5, Build time: 7-May-2014 03:37:38 */ var parserlib = {}; (function(){ /** * A generic base to inherit from for any object * that needs event handling. * @class EventTarget * @constructor */ function EventTarget(){ /** * The array of listeners for various events. * @type Object * @property _listeners * @private */ this._listeners = {}; } EventTarget.prototype = { //restore constructor constructor: EventTarget, /** * Adds a listener for a given event type. * @param {String} type The type of event to add a listener for. * @param {Function} listener The function to call when the event occurs. * @return {void} * @method addListener */ addListener: function(type, listener){ if (!this._listeners[type]){ this._listeners[type] = []; } this._listeners[type].push(listener); }, /** * Fires an event based on the passed-in object. * @param {Object|String} event An object with at least a 'type' attribute * or a string indicating the event name. * @return {void} * @method fire */ fire: function(event){ if (typeof event == "string"){ event = { type: event }; } if (typeof event.target != "undefined"){ event.target = this; } if (typeof event.type == "undefined"){ throw new Error("Event object missing 'type' property."); } if (this._listeners[event.type]){ //create a copy of the array and use that so listeners can't chane var listeners = this._listeners[event.type].concat(); for (var i=0, len=listeners.length; i < len; i++){ listeners[i].call(this, event); } } }, /** * Removes a listener for a given event type. * @param {String} type The type of event to remove a listener from. * @param {Function} listener The function to remove from the event. * @return {void} * @method removeListener */ removeListener: function(type, listener){ if (this._listeners[type]){ var listeners = this._listeners[type]; for (var i=0, len=listeners.length; i < len; i++){ if (listeners[i] === listener){ listeners.splice(i, 1); break; } } } } }; /** * Convenient way to read through strings. * @namespace parserlib.util * @class StringReader * @constructor * @param {String} text The text to read. */ function StringReader(text){ /** * The input text with line endings normalized. * @property _input * @type String * @private */ this._input = text.replace(/\n\r?/g, "\n"); /** * The row for the character to be read next. * @property _line * @type int * @private */ this._line = 1; /** * The column for the character to be read next. * @property _col * @type int * @private */ this._col = 1; /** * The index of the character in the input to be read next. * @property _cursor * @type int * @private */ this._cursor = 0; } StringReader.prototype = { //restore constructor constructor: StringReader, //------------------------------------------------------------------------- // Position info //------------------------------------------------------------------------- /** * Returns the column of the character to be read next. * @return {int} The column of the character to be read next. * @method getCol */ getCol: function(){ return this._col; }, /** * Returns the row of the character to be read next. * @return {int} The row of the character to be read next. * @method getLine */ getLine: function(){ return this._line ; }, /** * Determines if you're at the end of the input. * @return {Boolean} True if there's no more input, false otherwise. * @method eof */ eof: function(){ return (this._cursor == this._input.length); }, //------------------------------------------------------------------------- // Basic reading //------------------------------------------------------------------------- /** * Reads the next character without advancing the cursor. * @param {int} count How many characters to look ahead (default is 1). * @return {String} The next character or null if there is no next character. * @method peek */ peek: function(count){ var c = null; count = (typeof count == "undefined" ? 1 : count); //if we're not at the end of the input... if (this._cursor < this._input.length){ //get character and increment cursor and column c = this._input.charAt(this._cursor + count - 1); } return c; }, /** * Reads the next character from the input and adjusts the row and column * accordingly. * @return {String} The next character or null if there is no next character. * @method read */ read: function(){ var c = null; //if we're not at the end of the input... if (this._cursor < this._input.length){ //if the last character was a newline, increment row count //and reset column count if (this._input.charAt(this._cursor) == "\n"){ this._line++; this._col=1; } else { this._col++; } //get character and increment cursor and column c = this._input.charAt(this._cursor++); } return c; }, //------------------------------------------------------------------------- // Misc //------------------------------------------------------------------------- /** * Saves the current location so it can be returned to later. * @method mark * @return {void} */ mark: function(){ this._bookmark = { cursor: this._cursor, line: this._line, col: this._col }; }, reset: function(){ if (this._bookmark){ this._cursor = this._bookmark.cursor; this._line = this._bookmark.line; this._col = this._bookmark.col; delete this._bookmark; } }, //------------------------------------------------------------------------- // Advanced reading //------------------------------------------------------------------------- /** * Reads up to and including the given string. Throws an error if that * string is not found. * @param {String} pattern The string to read. * @return {String} The string when it is found. * @throws Error when the string pattern is not found. * @method readTo */ readTo: function(pattern){ var buffer = "", c; /* * First, buffer must be the same length as the pattern. * Then, buffer must end with the pattern or else reach the * end of the input. */ while (buffer.length < pattern.length || buffer.lastIndexOf(pattern) != buffer.length - pattern.length){ c = this.read(); if (c){ buffer += c; } else { throw new Error("Expected \"" + pattern + "\" at line " + this._line + ", col " + this._col + "."); } } return buffer; }, /** * Reads characters while each character causes the given * filter function to return true. The function is passed * in each character and either returns true to continue * reading or false to stop. * @param {Function} filter The function to read on each character. * @return {String} The string made up of all characters that passed the * filter check. * @method readWhile */ readWhile: function(filter){ var buffer = "", c = this.read(); while(c !== null && filter(c)){ buffer += c; c = this.read(); } return buffer; }, /** * Reads characters that match either text or a regular expression and * returns those characters. If a match is found, the row and column * are adjusted; if no match is found, the reader's state is unchanged. * reading or false to stop. * @param {String|RegExp} matcher If a string, then the literal string * value is searched for. If a regular expression, then any string * matching the pattern is search for. * @return {String} The string made up of all characters that matched or * null if there was no match. * @method readMatch */ readMatch: function(matcher){ var source = this._input.substring(this._cursor), value = null; //if it's a string, just do a straight match if (typeof matcher == "string"){ if (source.indexOf(matcher) === 0){ value = this.readCount(matcher.length); } } else if (matcher instanceof RegExp){ if (matcher.test(source)){ value = this.readCount(RegExp.lastMatch.length); } } return value; }, /** * Reads a given number of characters. If the end of the input is reached, * it reads only the remaining characters and does not throw an error. * @param {int} count The number of characters to read. * @return {String} The string made up the read characters. * @method readCount */ readCount: function(count){ var buffer = ""; while(count--){ buffer += this.read(); } return buffer; } }; /** * Type to use when a syntax error occurs. * @class SyntaxError * @namespace parserlib.util * @constructor * @param {String} message The error message. * @param {int} line The line at which the error occurred. * @param {int} col The column at which the error occurred. */ function SyntaxError(message, line, col){ /** * The column at which the error occurred. * @type int * @property col */ this.col = col; /** * The line at which the error occurred. * @type int * @property line */ this.line = line; /** * The text representation of the unit. * @type String * @property text */ this.message = message; } //inherit from Error SyntaxError.prototype = new Error(); /** * Base type to represent a single syntactic unit. * @class SyntaxUnit * @namespace parserlib.util * @constructor * @param {String} text The text of the unit. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function SyntaxUnit(text, line, col, type){ /** * The column of text on which the unit resides. * @type int * @property col */ this.col = col; /** * The line of text on which the unit resides. * @type int * @property line */ this.line = line; /** * The text representation of the unit. * @type String * @property text */ this.text = text; /** * The type of syntax unit. * @type int * @property type */ this.type = type; } /** * Create a new syntax unit based solely on the given token. * Convenience method for creating a new syntax unit when * it represents a single token instead of multiple. * @param {Object} token The token object to represent. * @return {parserlib.util.SyntaxUnit} The object representing the token. * @static * @method fromToken */ SyntaxUnit.fromToken = function(token){ return new SyntaxUnit(token.value, token.startLine, token.startCol); }; SyntaxUnit.prototype = { //restore constructor constructor: SyntaxUnit, /** * Returns the text representation of the unit. * @return {String} The text representation of the unit. * @method valueOf */ valueOf: function(){ return this.text; }, /** * Returns the text representation of the unit. * @return {String} The text representation of the unit. * @method toString */ toString: function(){ return this.text; } }; /*global StringReader, SyntaxError*/ /** * Generic TokenStream providing base functionality. * @class TokenStreamBase * @namespace parserlib.util * @constructor * @param {String|StringReader} input The text to tokenize or a reader from * which to read the input. */ function TokenStreamBase(input, tokenData){ /** * The string reader for easy access to the text. * @type StringReader * @property _reader * @private */ this._reader = input ? new StringReader(input.toString()) : null; /** * Token object for the last consumed token. * @type Token * @property _token * @private */ this._token = null; /** * The array of token information. * @type Array * @property _tokenData * @private */ this._tokenData = tokenData; /** * Lookahead token buffer. * @type Array * @property _lt * @private */ this._lt = []; /** * Lookahead token buffer index. * @type int * @property _ltIndex * @private */ this._ltIndex = 0; this._ltIndexCache = []; } /** * Accepts an array of token information and outputs * an array of token data containing key-value mappings * and matching functions that the TokenStream needs. * @param {Array} tokens An array of token descriptors. * @return {Array} An array of processed token data. * @method createTokenData * @static */ TokenStreamBase.createTokenData = function(tokens){ var nameMap = [], typeMap = {}, tokenData = tokens.concat([]), i = 0, len = tokenData.length+1; tokenData.UNKNOWN = -1; tokenData.unshift({name:"EOF"}); for (; i < len; i++){ nameMap.push(tokenData[i].name); tokenData[tokenData[i].name] = i; if (tokenData[i].text){ typeMap[tokenData[i].text] = i; } } tokenData.name = function(tt){ return nameMap[tt]; }; tokenData.type = function(c){ return typeMap[c]; }; return tokenData; }; TokenStreamBase.prototype = { //restore constructor constructor: TokenStreamBase, //------------------------------------------------------------------------- // Matching methods //------------------------------------------------------------------------- /** * Determines if the next token matches the given token type. * If so, that token is consumed; if not, the token is placed * back onto the token stream. You can pass in any number of * token types and this will return true if any of the token * types is found. * @param {int|int[]} tokenTypes Either a single token type or an array of * token types that the next token might be. If an array is passed, * it's assumed that the token can be any of these. * @param {variant} channel (Optional) The channel to read from. If not * provided, reads from the default (unnamed) channel. * @return {Boolean} True if the token type matches, false if not. * @method match */ match: function(tokenTypes, channel){ //always convert to an array, makes things easier if (!(tokenTypes instanceof Array)){ tokenTypes = [tokenTypes]; } var tt = this.get(channel), i = 0, len = tokenTypes.length; while(i < len){ if (tt == tokenTypes[i++]){ return true; } } //no match found, put the token back this.unget(); return false; }, /** * Determines if the next token matches the given token type. * If so, that token is consumed; if not, an error is thrown. * @param {int|int[]} tokenTypes Either a single token type or an array of * token types that the next token should be. If an array is passed, * it's assumed that the token must be one of these. * @param {variant} channel (Optional) The channel to read from. If not * provided, reads from the default (unnamed) channel. * @return {void} * @method mustMatch */ mustMatch: function(tokenTypes, channel){ var token; //always convert to an array, makes things easier if (!(tokenTypes instanceof Array)){ tokenTypes = [tokenTypes]; } if (!this.match.apply(this, arguments)){ token = this.LT(1); throw new SyntaxError("Expected " + this._tokenData[tokenTypes[0]].name + " at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } }, //------------------------------------------------------------------------- // Consuming methods //------------------------------------------------------------------------- /** * Keeps reading from the token stream until either one of the specified * token types is found or until the end of the input is reached. * @param {int|int[]} tokenTypes Either a single token type or an array of * token types that the next token should be. If an array is passed, * it's assumed that the token must be one of these. * @param {variant} channel (Optional) The channel to read from. If not * provided, reads from the default (unnamed) channel. * @return {void} * @method advance */ advance: function(tokenTypes, channel){ while(this.LA(0) !== 0 && !this.match(tokenTypes, channel)){ this.get(); } return this.LA(0); }, /** * Consumes the next token from the token stream. * @return {int} The token type of the token that was just consumed. * @method get */ get: function(channel){ var tokenInfo = this._tokenData, reader = this._reader, value, i =0, len = tokenInfo.length, found = false, token, info; //check the lookahead buffer first if (this._lt.length && this._ltIndex >= 0 && this._ltIndex < this._lt.length){ i++; this._token = this._lt[this._ltIndex++]; info = tokenInfo[this._token.type]; //obey channels logic while((info.channel !== undefined && channel !== info.channel) && this._ltIndex < this._lt.length){ this._token = this._lt[this._ltIndex++]; info = tokenInfo[this._token.type]; i++; } //here be dragons if ((info.channel === undefined || channel === info.channel) && this._ltIndex <= this._lt.length){ this._ltIndexCache.push(i); return this._token.type; } } //call token retriever method token = this._getToken(); //if it should be hidden, don't save a token if (token.type > -1 && !tokenInfo[token.type].hide){ //apply token channel token.channel = tokenInfo[token.type].channel; //save for later this._token = token; this._lt.push(token); //save space that will be moved (must be done before array is truncated) this._ltIndexCache.push(this._lt.length - this._ltIndex + i); //keep the buffer under 5 items if (this._lt.length > 5){ this._lt.shift(); } //also keep the shift buffer under 5 items if (this._ltIndexCache.length > 5){ this._ltIndexCache.shift(); } //update lookahead index this._ltIndex = this._lt.length; } /* * Skip to the next token if: * 1. The token type is marked as hidden. * 2. The token type has a channel specified and it isn't the current channel. */ info = tokenInfo[token.type]; if (info && (info.hide || (info.channel !== undefined && channel !== info.channel))){ return this.get(channel); } else { //return just the type return token.type; } }, /** * Looks ahead a certain number of tokens and returns the token type at * that position. This will throw an error if you lookahead past the * end of input, past the size of the lookahead buffer, or back past * the first token in the lookahead buffer. * @param {int} The index of the token type to retrieve. 0 for the * current token, 1 for the next, -1 for the previous, etc. * @return {int} The token type of the token in the given position. * @method LA */ LA: function(index){ var total = index, tt; if (index > 0){ //TODO: Store 5 somewhere if (index > 5){ throw new Error("Too much lookahead."); } //get all those tokens while(total){ tt = this.get(); total--; } //unget all those tokens while(total < index){ this.unget(); total++; } } else if (index < 0){ if(this._lt[this._ltIndex+index]){ tt = this._lt[this._ltIndex+index].type; } else { throw new Error("Too much lookbehind."); } } else { tt = this._token.type; } return tt; }, /** * Looks ahead a certain number of tokens and returns the token at * that position. This will throw an error if you lookahead past the * end of input, past the size of the lookahead buffer, or back past * the first token in the lookahead buffer. * @param {int} The index of the token type to retrieve. 0 for the * current token, 1 for the next, -1 for the previous, etc. * @return {Object} The token of the token in the given position. * @method LA */ LT: function(index){ //lookahead first to prime the token buffer this.LA(index); //now find the token, subtract one because _ltIndex is already at the next index return this._lt[this._ltIndex+index-1]; }, /** * Returns the token type for the next token in the stream without * consuming it. * @return {int} The token type of the next token in the stream. * @method peek */ peek: function(){ return this.LA(1); }, /** * Returns the actual token object for the last consumed token. * @return {Token} The token object for the last consumed token. * @method token */ token: function(){ return this._token; }, /** * Returns the name of the token for the given token type. * @param {int} tokenType The type of token to get the name of. * @return {String} The name of the token or "UNKNOWN_TOKEN" for any * invalid token type. * @method tokenName */ tokenName: function(tokenType){ if (tokenType < 0 || tokenType > this._tokenData.length){ return "UNKNOWN_TOKEN"; } else { return this._tokenData[tokenType].name; } }, /** * Returns the token type value for the given token name. * @param {String} tokenName The name of the token whose value should be returned. * @return {int} The token type value for the given token name or -1 * for an unknown token. * @method tokenName */ tokenType: function(tokenName){ return this._tokenData[tokenName] || -1; }, /** * Returns the last consumed token to the token stream. * @method unget */ unget: function(){ //if (this._ltIndex > -1){ if (this._ltIndexCache.length){ this._ltIndex -= this._ltIndexCache.pop();//--; this._token = this._lt[this._ltIndex - 1]; } else { throw new Error("Too much lookahead."); } } }; parserlib.util = { StringReader: StringReader, SyntaxError : SyntaxError, SyntaxUnit : SyntaxUnit, EventTarget : EventTarget, TokenStreamBase : TokenStreamBase }; })(); /* Parser-Lib Copyright (c) 2009-2011 Nicholas C. Zakas. All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* Version v0.2.5, Build time: 7-May-2014 03:37:38 */ (function(){ var EventTarget = parserlib.util.EventTarget, TokenStreamBase = parserlib.util.TokenStreamBase, StringReader = parserlib.util.StringReader, SyntaxError = parserlib.util.SyntaxError, SyntaxUnit = parserlib.util.SyntaxUnit; var Colors = { aliceblue :"#f0f8ff", antiquewhite :"#faebd7", aqua :"#00ffff", aquamarine :"#7fffd4", azure :"#f0ffff", beige :"#f5f5dc", bisque :"#ffe4c4", black :"#000000", blanchedalmond :"#ffebcd", blue :"#0000ff", blueviolet :"#8a2be2", brown :"#a52a2a", burlywood :"#deb887", cadetblue :"#5f9ea0", chartreuse :"#7fff00", chocolate :"#d2691e", coral :"#ff7f50", cornflowerblue :"#6495ed", cornsilk :"#fff8dc", crimson :"#dc143c", cyan :"#00ffff", darkblue :"#00008b", darkcyan :"#008b8b", darkgoldenrod :"#b8860b", darkgray :"#a9a9a9", darkgrey :"#a9a9a9", darkgreen :"#006400", darkkhaki :"#bdb76b", darkmagenta :"#8b008b", darkolivegreen :"#556b2f", darkorange :"#ff8c00", darkorchid :"#9932cc", darkred :"#8b0000", darksalmon :"#e9967a", darkseagreen :"#8fbc8f", darkslateblue :"#483d8b", darkslategray :"#2f4f4f", darkslategrey :"#2f4f4f", darkturquoise :"#00ced1", darkviolet :"#9400d3", deeppink :"#ff1493", deepskyblue :"#00bfff", dimgray :"#696969", dimgrey :"#696969", dodgerblue :"#1e90ff", firebrick :"#b22222", floralwhite :"#fffaf0", forestgreen :"#228b22", fuchsia :"#ff00ff", gainsboro :"#dcdcdc", ghostwhite :"#f8f8ff", gold :"#ffd700", goldenrod :"#daa520", gray :"#808080", grey :"#808080", green :"#008000", greenyellow :"#adff2f", honeydew :"#f0fff0", hotpink :"#ff69b4", indianred :"#cd5c5c", indigo :"#4b0082", ivory :"#fffff0", khaki :"#f0e68c", lavender :"#e6e6fa", lavenderblush :"#fff0f5", lawngreen :"#7cfc00", lemonchiffon :"#fffacd", lightblue :"#add8e6", lightcoral :"#f08080", lightcyan :"#e0ffff", lightgoldenrodyellow :"#fafad2", lightgray :"#d3d3d3", lightgrey :"#d3d3d3", lightgreen :"#90ee90", lightpink :"#ffb6c1", lightsalmon :"#ffa07a", lightseagreen :"#20b2aa", lightskyblue :"#87cefa", lightslategray :"#778899", lightslategrey :"#778899", lightsteelblue :"#b0c4de", lightyellow :"#ffffe0", lime :"#00ff00", limegreen :"#32cd32", linen :"#faf0e6", magenta :"#ff00ff", maroon :"#800000", mediumaquamarine:"#66cdaa", mediumblue :"#0000cd", mediumorchid :"#ba55d3", mediumpurple :"#9370d8", mediumseagreen :"#3cb371", mediumslateblue :"#7b68ee", mediumspringgreen :"#00fa9a", mediumturquoise :"#48d1cc", mediumvioletred :"#c71585", midnightblue :"#191970", mintcream :"#f5fffa", mistyrose :"#ffe4e1", moccasin :"#ffe4b5", navajowhite :"#ffdead", navy :"#000080", oldlace :"#fdf5e6", olive :"#808000", olivedrab :"#6b8e23", orange :"#ffa500", orangered :"#ff4500", orchid :"#da70d6", palegoldenrod :"#eee8aa", palegreen :"#98fb98", paleturquoise :"#afeeee", palevioletred :"#d87093", papayawhip :"#ffefd5", peachpuff :"#ffdab9", peru :"#cd853f", pink :"#ffc0cb", plum :"#dda0dd", powderblue :"#b0e0e6", purple :"#800080", red :"#ff0000", rosybrown :"#bc8f8f", royalblue :"#4169e1", saddlebrown :"#8b4513", salmon :"#fa8072", sandybrown :"#f4a460", seagreen :"#2e8b57", seashell :"#fff5ee", sienna :"#a0522d", silver :"#c0c0c0", skyblue :"#87ceeb", slateblue :"#6a5acd", slategray :"#708090", slategrey :"#708090", snow :"#fffafa", springgreen :"#00ff7f", steelblue :"#4682b4", tan :"#d2b48c", teal :"#008080", thistle :"#d8bfd8", tomato :"#ff6347", turquoise :"#40e0d0", violet :"#ee82ee", wheat :"#f5deb3", white :"#ffffff", whitesmoke :"#f5f5f5", yellow :"#ffff00", yellowgreen :"#9acd32", //CSS2 system colors http://www.w3.org/TR/css3-color/#css2-system activeBorder :"Active window border.", activecaption :"Active window caption.", appworkspace :"Background color of multiple document interface.", background :"Desktop background.", buttonface :"The face background color for 3-D elements that appear 3-D due to one layer of surrounding border.", buttonhighlight :"The color of the border facing the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", buttonshadow :"The color of the border away from the light source for 3-D elements that appear 3-D due to one layer of surrounding border.", buttontext :"Text on push buttons.", captiontext :"Text in caption, size box, and scrollbar arrow box.", graytext :"Grayed (disabled) text. This color is set to #000 if the current display driver does not support a solid gray color.", greytext :"Greyed (disabled) text. This color is set to #000 if the current display driver does not support a solid grey color.", highlight :"Item(s) selected in a control.", highlighttext :"Text of item(s) selected in a control.", inactiveborder :"Inactive window border.", inactivecaption :"Inactive window caption.", inactivecaptiontext :"Color of text in an inactive caption.", infobackground :"Background color for tooltip controls.", infotext :"Text color for tooltip controls.", menu :"Menu background.", menutext :"Text in menus.", scrollbar :"Scroll bar gray area.", threeddarkshadow :"The color of the darker (generally outer) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedface :"The face background color for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedhighlight :"The color of the lighter (generally outer) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedlightshadow :"The color of the darker (generally inner) of the two borders facing the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", threedshadow :"The color of the lighter (generally inner) of the two borders away from the light source for 3-D elements that appear 3-D due to two concentric layers of surrounding border.", window :"Window background.", windowframe :"Window frame.", windowtext :"Text in windows." }; /*global SyntaxUnit, Parser*/ /** * Represents a selector combinator (whitespace, +, >). * @namespace parserlib.css * @class Combinator * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} text The text representation of the unit. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function Combinator(text, line, col){ SyntaxUnit.call(this, text, line, col, Parser.COMBINATOR_TYPE); /** * The type of modifier. * @type String * @property type */ this.type = "unknown"; //pretty simple if (/^\s+$/.test(text)){ this.type = "descendant"; } else if (text == ">"){ this.type = "child"; } else if (text == "+"){ this.type = "adjacent-sibling"; } else if (text == "~"){ this.type = "sibling"; } } Combinator.prototype = new SyntaxUnit(); Combinator.prototype.constructor = Combinator; /*global SyntaxUnit, Parser*/ /** * Represents a media feature, such as max-width:500. * @namespace parserlib.css * @class MediaFeature * @extends parserlib.util.SyntaxUnit * @constructor * @param {SyntaxUnit} name The name of the feature. * @param {SyntaxUnit} value The value of the feature or null if none. */ function MediaFeature(name, value){ SyntaxUnit.call(this, "(" + name + (value !== null ? ":" + value : "") + ")", name.startLine, name.startCol, Parser.MEDIA_FEATURE_TYPE); /** * The name of the media feature * @type String * @property name */ this.name = name; /** * The value for the feature or null if there is none. * @type SyntaxUnit * @property value */ this.value = value; } MediaFeature.prototype = new SyntaxUnit(); MediaFeature.prototype.constructor = MediaFeature; /*global SyntaxUnit, Parser*/ /** * Represents an individual media query. * @namespace parserlib.css * @class MediaQuery * @extends parserlib.util.SyntaxUnit * @constructor * @param {String} modifier The modifier "not" or "only" (or null). * @param {String} mediaType The type of media (i.e., "print"). * @param {Array} parts Array of selectors parts making up this selector. * @param {int} line The line of text on which the unit resides. * @param {int} col The column of text on which the unit resides. */ function MediaQuery(modifier, mediaType, features, line, col){ SyntaxUnit.call(this, (modifier ? modifier + " ": "") + (mediaType ? mediaType : "") + (mediaType && features.length > 0 ? " and " : "") + features.join(" and "), line, col, Parser.MEDIA_QUERY_TYPE); /** * The media modifier ("not" or "only") * @type String * @property modifier */ this.modifier = modifier; /** * The mediaType (i.e., "print") * @type String * @property mediaType */ this.mediaType = mediaType; /** * The parts that make up the selector. * @type Array * @property features */ this.features = features; } MediaQuery.prototype = new SyntaxUnit(); MediaQuery.prototype.constructor = MediaQuery; /*global Tokens, TokenStream, SyntaxError, Properties, Validation, ValidationError, SyntaxUnit, PropertyValue, PropertyValuePart, SelectorPart, SelectorSubPart, Selector, PropertyName, Combinator, MediaFeature, MediaQuery, EventTarget */ /** * A CSS3 parser. * @namespace parserlib.css * @class Parser * @constructor * @param {Object} options (Optional) Various options for the parser: * starHack (true|false) to allow IE6 star hack as valid, * underscoreHack (true|false) to interpret leading underscores * as IE6-7 targeting for known properties, ieFilters (true|false) * to indicate that IE < 8 filters should be accepted and not throw * syntax errors. */ function Parser(options){ //inherit event functionality EventTarget.call(this); this.options = options || {}; this._tokenStream = null; } //Static constants Parser.DEFAULT_TYPE = 0; Parser.COMBINATOR_TYPE = 1; Parser.MEDIA_FEATURE_TYPE = 2; Parser.MEDIA_QUERY_TYPE = 3; Parser.PROPERTY_NAME_TYPE = 4; Parser.PROPERTY_VALUE_TYPE = 5; Parser.PROPERTY_VALUE_PART_TYPE = 6; Parser.SELECTOR_TYPE = 7; Parser.SELECTOR_PART_TYPE = 8; Parser.SELECTOR_SUB_PART_TYPE = 9; Parser.prototype = function(){ var proto = new EventTarget(), //new prototype prop, additions = { //restore constructor constructor: Parser, //instance constants - yuck DEFAULT_TYPE : 0, COMBINATOR_TYPE : 1, MEDIA_FEATURE_TYPE : 2, MEDIA_QUERY_TYPE : 3, PROPERTY_NAME_TYPE : 4, PROPERTY_VALUE_TYPE : 5, PROPERTY_VALUE_PART_TYPE : 6, SELECTOR_TYPE : 7, SELECTOR_PART_TYPE : 8, SELECTOR_SUB_PART_TYPE : 9, //----------------------------------------------------------------- // Grammar //----------------------------------------------------------------- _stylesheet: function(){ /* * stylesheet * : [ CHARSET_SYM S* STRING S* ';' ]? * [S|CDO|CDC]* [ import [S|CDO|CDC]* ]* * [ namespace [S|CDO|CDC]* ]* * [ [ ruleset | media | page | font_face | keyframes ] [S|CDO|CDC]* ]* * ; */ var tokenStream = this._tokenStream, charset = null, count, token, tt; this.fire("startstylesheet"); //try to read character set this._charset(); this._skipCruft(); //try to read imports - may be more than one while (tokenStream.peek() == Tokens.IMPORT_SYM){ this._import(); this._skipCruft(); } //try to read namespaces - may be more than one while (tokenStream.peek() == Tokens.NAMESPACE_SYM){ this._namespace(); this._skipCruft(); } //get the next token tt = tokenStream.peek(); //try to read the rest while(tt > Tokens.EOF){ try { switch(tt){ case Tokens.MEDIA_SYM: this._media(); this._skipCruft(); break; case Tokens.PAGE_SYM: this._page(); this._skipCruft(); break; case Tokens.FONT_FACE_SYM: this._font_face(); this._skipCruft(); break; case Tokens.KEYFRAMES_SYM: this._keyframes(); this._skipCruft(); break; case Tokens.VIEWPORT_SYM: this._viewport(); this._skipCruft(); break; case Tokens.UNKNOWN_SYM: //unknown @ rule tokenStream.get(); if (!this.options.strict){ //fire error event this.fire({ type: "error", error: null, message: "Unknown @ rule: " + tokenStream.LT(0).value + ".", line: tokenStream.LT(0).startLine, col: tokenStream.LT(0).startCol }); //skip braces count=0; while (tokenStream.advance([Tokens.LBRACE, Tokens.RBRACE]) == Tokens.LBRACE){ count++; //keep track of nesting depth } while(count){ tokenStream.advance([Tokens.RBRACE]); count--; } } else { //not a syntax error, rethrow it throw new SyntaxError("Unknown @ rule.", tokenStream.LT(0).startLine, tokenStream.LT(0).startCol); } break; case Tokens.S: this._readWhitespace(); break; default: if(!this._ruleset()){ //error handling for known issues switch(tt){ case Tokens.CHARSET_SYM: token = tokenStream.LT(1); this._charset(false); throw new SyntaxError("@charset not allowed here.", token.startLine, token.startCol); case Tokens.IMPORT_SYM: token = tokenStream.LT(1); this._import(false); throw new SyntaxError("@import not allowed here.", token.startLine, token.startCol); case Tokens.NAMESPACE_SYM: token = tokenStream.LT(1); this._namespace(false); throw new SyntaxError("@namespace not allowed here.", token.startLine, token.startCol); default: tokenStream.get(); //get the last token this._unexpectedToken(tokenStream.token()); } } } } catch(ex) { if (ex instanceof SyntaxError && !this.options.strict){ this.fire({ type: "error", error: ex, message: ex.message, line: ex.line, col: ex.col }); } else { throw ex; } } tt = tokenStream.peek(); } if (tt != Tokens.EOF){ this._unexpectedToken(tokenStream.token()); } this.fire("endstylesheet"); }, _charset: function(emit){ var tokenStream = this._tokenStream, charset, token, line, col; if (tokenStream.match(Tokens.CHARSET_SYM)){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); tokenStream.mustMatch(Tokens.STRING); token = tokenStream.token(); charset = token.value; this._readWhitespace(); tokenStream.mustMatch(Tokens.SEMICOLON); if (emit !== false){ this.fire({ type: "charset", charset:charset, line: line, col: col }); } } }, _import: function(emit){ /* * import * : IMPORT_SYM S* * [STRING|URI] S* media_query_list? ';' S* */ var tokenStream = this._tokenStream, tt, uri, importToken, mediaList = []; //read import symbol tokenStream.mustMatch(Tokens.IMPORT_SYM); importToken = tokenStream.token(); this._readWhitespace(); tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); //grab the URI value uri = tokenStream.token().value.replace(/^(?:url\()?["']?([^"']+?)["']?\)?$/, "$1"); this._readWhitespace(); mediaList = this._media_query_list(); //must end with a semicolon tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); if (emit !== false){ this.fire({ type: "import", uri: uri, media: mediaList, line: importToken.startLine, col: importToken.startCol }); } }, _namespace: function(emit){ /* * namespace * : NAMESPACE_SYM S* [namespace_prefix S*]? [STRING|URI] S* ';' S* */ var tokenStream = this._tokenStream, line, col, prefix, uri; //read import symbol tokenStream.mustMatch(Tokens.NAMESPACE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); //it's a namespace prefix - no _namespace_prefix() method because it's just an IDENT if (tokenStream.match(Tokens.IDENT)){ prefix = tokenStream.token().value; this._readWhitespace(); } tokenStream.mustMatch([Tokens.STRING, Tokens.URI]); /*if (!tokenStream.match(Tokens.STRING)){ tokenStream.mustMatch(Tokens.URI); }*/ //grab the URI value uri = tokenStream.token().value.replace(/(?:url\()?["']([^"']+)["']\)?/, "$1"); this._readWhitespace(); //must end with a semicolon tokenStream.mustMatch(Tokens.SEMICOLON); this._readWhitespace(); if (emit !== false){ this.fire({ type: "namespace", prefix: prefix, uri: uri, line: line, col: col }); } }, _media: function(){ /* * media * : MEDIA_SYM S* media_query_list S* '{' S* ruleset* '}' S* * ; */ var tokenStream = this._tokenStream, line, col, mediaList;// = []; //look for @media tokenStream.mustMatch(Tokens.MEDIA_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); mediaList = this._media_query_list(); tokenStream.mustMatch(Tokens.LBRACE); this._readWhitespace(); this.fire({ type: "startmedia", media: mediaList, line: line, col: col }); while(true) { if (tokenStream.peek() == Tokens.PAGE_SYM){ this._page(); } else if (tokenStream.peek() == Tokens.FONT_FACE_SYM){ this._font_face(); } else if (tokenStream.peek() == Tokens.VIEWPORT_SYM){ this._viewport(); } else if (!this._ruleset()){ break; } } tokenStream.mustMatch(Tokens.RBRACE); this._readWhitespace(); this.fire({ type: "endmedia", media: mediaList, line: line, col: col }); }, //CSS3 Media Queries _media_query_list: function(){ /* * media_query_list * : S* [media_query [ ',' S* media_query ]* ]? * ; */ var tokenStream = this._tokenStream, mediaList = []; this._readWhitespace(); if (tokenStream.peek() == Tokens.IDENT || tokenStream.peek() == Tokens.LPAREN){ mediaList.push(this._media_query()); } while(tokenStream.match(Tokens.COMMA)){ this._readWhitespace(); mediaList.push(this._media_query()); } return mediaList; }, /* * Note: "expression" in the grammar maps to the _media_expression * method. */ _media_query: function(){ /* * media_query * : [ONLY | NOT]? S* media_type S* [ AND S* expression ]* * | expression [ AND S* expression ]* * ; */ var tokenStream = this._tokenStream, type = null, ident = null, token = null, expressions = []; if (tokenStream.match(Tokens.IDENT)){ ident = tokenStream.token().value.toLowerCase(); //since there's no custom tokens for these, need to manually check if (ident != "only" && ident != "not"){ tokenStream.unget(); ident = null; } else { token = tokenStream.token(); } } this._readWhitespace(); if (tokenStream.peek() == Tokens.IDENT){ type = this._media_type(); if (token === null){ token = tokenStream.token(); } } else if (tokenStream.peek() == Tokens.LPAREN){ if (token === null){ token = tokenStream.LT(1); } expressions.push(this._media_expression()); } if (type === null && expressions.length === 0){ return null; } else { this._readWhitespace(); while (tokenStream.match(Tokens.IDENT)){ if (tokenStream.token().value.toLowerCase() != "and"){ this._unexpectedToken(tokenStream.token()); } this._readWhitespace(); expressions.push(this._media_expression()); } } return new MediaQuery(ident, type, expressions, token.startLine, token.startCol); }, //CSS3 Media Queries _media_type: function(){ /* * media_type * : IDENT * ; */ return this._media_feature(); }, /** * Note: in CSS3 Media Queries, this is called "expression". * Renamed here to avoid conflict with CSS3 Selectors * definition of "expression". Also note that "expr" in the * grammar now maps to "expression" from CSS3 selectors. * @method _media_expression * @private */ _media_expression: function(){ /* * expression * : '(' S* media_feature S* [ ':' S* expr ]? ')' S* * ; */ var tokenStream = this._tokenStream, feature = null, token, expression = null; tokenStream.mustMatch(Tokens.LPAREN); this._readWhitespace(); feature = this._media_feature(); this._readWhitespace(); if (tokenStream.match(Tokens.COLON)){ this._readWhitespace(); token = tokenStream.LT(1); expression = this._expression(); } tokenStream.mustMatch(Tokens.RPAREN); this._readWhitespace(); return new MediaFeature(feature, (expression ? new SyntaxUnit(expression, token.startLine, token.startCol) : null)); }, //CSS3 Media Queries _media_feature: function(){ /* * media_feature * : IDENT * ; */ var tokenStream = this._tokenStream; tokenStream.mustMatch(Tokens.IDENT); return SyntaxUnit.fromToken(tokenStream.token()); }, //CSS3 Paged Media _page: function(){ /* * page: * PAGE_SYM S* IDENT? pseudo_page? S* * '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col, identifier = null, pseudoPage = null; //look for @page tokenStream.mustMatch(Tokens.PAGE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); if (tokenStream.match(Tokens.IDENT)){ identifier = tokenStream.token().value; //The value 'auto' may not be used as a page name and MUST be treated as a syntax error. if (identifier.toLowerCase() === "auto"){ this._unexpectedToken(tokenStream.token()); } } //see if there's a colon upcoming if (tokenStream.peek() == Tokens.COLON){ pseudoPage = this._pseudo_page(); } this._readWhitespace(); this.fire({ type: "startpage", id: identifier, pseudo: pseudoPage, line: line, col: col }); this._readDeclarations(true, true); this.fire({ type: "endpage", id: identifier, pseudo: pseudoPage, line: line, col: col }); }, //CSS3 Paged Media _margin: function(){ /* * margin : * margin_sym S* '{' declaration [ ';' S* declaration? ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col, marginSym = this._margin_sym(); if (marginSym){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; this.fire({ type: "startpagemargin", margin: marginSym, line: line, col: col }); this._readDeclarations(true); this.fire({ type: "endpagemargin", margin: marginSym, line: line, col: col }); return true; } else { return false; } }, //CSS3 Paged Media _margin_sym: function(){ /* * margin_sym : * TOPLEFTCORNER_SYM | * TOPLEFT_SYM | * TOPCENTER_SYM | * TOPRIGHT_SYM | * TOPRIGHTCORNER_SYM | * BOTTOMLEFTCORNER_SYM | * BOTTOMLEFT_SYM | * BOTTOMCENTER_SYM | * BOTTOMRIGHT_SYM | * BOTTOMRIGHTCORNER_SYM | * LEFTTOP_SYM | * LEFTMIDDLE_SYM | * LEFTBOTTOM_SYM | * RIGHTTOP_SYM | * RIGHTMIDDLE_SYM | * RIGHTBOTTOM_SYM * ; */ var tokenStream = this._tokenStream; if(tokenStream.match([Tokens.TOPLEFTCORNER_SYM, Tokens.TOPLEFT_SYM, Tokens.TOPCENTER_SYM, Tokens.TOPRIGHT_SYM, Tokens.TOPRIGHTCORNER_SYM, Tokens.BOTTOMLEFTCORNER_SYM, Tokens.BOTTOMLEFT_SYM, Tokens.BOTTOMCENTER_SYM, Tokens.BOTTOMRIGHT_SYM, Tokens.BOTTOMRIGHTCORNER_SYM, Tokens.LEFTTOP_SYM, Tokens.LEFTMIDDLE_SYM, Tokens.LEFTBOTTOM_SYM, Tokens.RIGHTTOP_SYM, Tokens.RIGHTMIDDLE_SYM, Tokens.RIGHTBOTTOM_SYM])) { return SyntaxUnit.fromToken(tokenStream.token()); } else { return null; } }, _pseudo_page: function(){ /* * pseudo_page * : ':' IDENT * ; */ var tokenStream = this._tokenStream; tokenStream.mustMatch(Tokens.COLON); tokenStream.mustMatch(Tokens.IDENT); //TODO: CSS3 Paged Media says only "left", "center", and "right" are allowed return tokenStream.token().value; }, _font_face: function(){ /* * font_face * : FONT_FACE_SYM S* * '{' S* declaration [ ';' S* declaration ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col; //look for @page tokenStream.mustMatch(Tokens.FONT_FACE_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); this.fire({ type: "startfontface", line: line, col: col }); this._readDeclarations(true); this.fire({ type: "endfontface", line: line, col: col }); }, _viewport: function(){ /* * viewport * : VIEWPORT_SYM S* * '{' S* declaration? [ ';' S* declaration? ]* '}' S* * ; */ var tokenStream = this._tokenStream, line, col; tokenStream.mustMatch(Tokens.VIEWPORT_SYM); line = tokenStream.token().startLine; col = tokenStream.token().startCol; this._readWhitespace(); this.fire({ type: "startviewport", line: line, col: col }); this._readDeclarations(true); this.fire({ type: "endviewport", line: line, col: col }); }, _operator: function(inFunction){ /* * operator (outside function) * : '/' S* | ',' S* | /( empty )/ * operator (inside function) * : '/' S* | '+' S* | '*' S* | '-' S* /( empty )/ * ; */ var tokenStream = this._tokenStream, token = null; if (tokenStream.match([Tokens.SLASH, Tokens.COMMA]) || (inFunction && tokenStream.match([Tokens.PLUS, Tokens.STAR, Tokens.MINUS]))){ token = tokenStream.token(); this._readWhitespace(); } return token ? PropertyValuePart.fromToken(token) : null; }, _combinator: function(){ /* * combinator * : PLUS S* | GREATER S* | TILDE S* | S+ * ; */ var tokenStream = this._tokenStream, value = null, token; if(tokenStream.match([Tokens.PLUS, Tokens.GREATER, Tokens.TILDE])){ token = tokenStream.token(); value = new Combinator(token.value, token.startLine, token.startCol); this._readWhitespace(); } return value; }, _unary_operator: function(){ /* * unary_operator * : '-' | '+' * ; */ var tokenStream = this._tokenStream; if (tokenStream.match([Tokens.MINUS, Tokens.PLUS])){ return tokenStream.token().value; } else { return null; } }, _property: function(){ /* * property * : IDENT S* * ; */ var tokenStream = this._tokenStream, value = null, hack = null, tokenValue, token, line, col; //check for star hack - throws error if not allowed if (tokenStream.peek() == Tokens.STAR && this.options.starHack){ tokenStream.get(); token = tokenStream.token(); hack = token.value; line = token.startLine; col = token.startCol; } if(tokenStream.match(Tokens.IDENT)){ token = tokenStream.token(); tokenValue = token.value; //check for underscore hack - no error if not allowed because it's valid CSS syntax if (tokenValue.charAt(0) == "_" && this.options.underscoreHack){ hack = "_"; tokenValue = tokenValue.substring(1); } value = new PropertyName(tokenValue, hack, (line||token.startLine), (col||token.startCol)); this._readWhitespace(); } return value; }, //Augmented with CSS3 Selectors _ruleset: function(){ /* * ruleset * : selectors_group * '{' S* declaration? [ ';' S* declaration? ]* '}' S* * ; */ var tokenStream = this._tokenStream, tt, selectors; /* * Error Recovery: If even a single selector fails to parse, * then the entire ruleset should be thrown away. */ try { selectors = this._selectors_group(); } catch (ex){ if (ex instanceof SyntaxError && !this.options.strict){ //fire error event this.fire({ type: "error", error: ex, message: ex.message, line: ex.line, col: ex.col }); //skip over everything until closing brace tt = tokenStream.advance([Tokens.RBRACE]); if (tt == Tokens.RBRACE){ //if there's a right brace, the rule is finished so don't do anything } else { //otherwise, rethrow the error because it wasn't handled properly throw ex; } } else { //not a syntax error, rethrow it throw ex; } //trigger parser to continue return true; } //if it got here, all selectors parsed if (selectors){ this.fire({ type: "startrule", selectors: selectors, line: selectors[0].line, col: selectors[0].col }); this._readDeclarations(true); this.fire({ type: "endrule", selectors: selectors, line: selectors[0].line, col: selectors[0].col }); } return selectors; }, //CSS3 Selectors _selectors_group: function(){ /* * selectors_group * : selector [ COMMA S* selector ]* * ; */ var tokenStream = this._tokenStream, selectors = [], selector; selector = this._selector(); if (selector !== null){ selectors.push(selector); while(tokenStream.match(Tokens.COMMA)){ this._readWhitespace(); selector = this._selector(); if (selector !== null){ selectors.push(selector); } else { this._unexpectedToken(tokenStream.LT(1)); } } } return selectors.length ? selectors : null; }, //CSS3 Selectors _selector: function(){ /* * selector * : simple_selector_sequence [ combinator simple_selector_sequence ]* * ; */ var tokenStream = this._tokenStream, selector = [], nextSelector = null, combinator = null, ws = null; //if there's no simple selector, then there's no selector nextSelector = this._simple_selector_sequence(); if (nextSelector === null){ return null; } selector.push(nextSelector); do { //look for a combinator combinator = this._combinator(); if (combinator !== null){ selector.push(combinator); nextSelector = this._simple_selector_sequence(); //there must be a next selector if (nextSelector === null){ this._unexpectedToken(tokenStream.LT(1)); } else { //nextSelector is an instance of SelectorPart selector.push(nextSelector); } } else { //if there's not whitespace, we're done if (this._readWhitespace()){ //add whitespace separator ws = new Combinator(tokenStream.token().value, tokenStream.token().startLine, tokenStream.token().startCol); //combinator is not required combinator = this._combinator(); //selector is required if there's a combinator nextSelector = this._simple_selector_sequence(); if (nextSelector === null){ if (combinator !== null){ this._unexpectedToken(tokenStream.LT(1)); } } else { if (combinator !== null){ selector.push(combinator); } else { selector.push(ws); } selector.push(nextSelector); } } else { break; } } } while(true); return new Selector(selector, selector[0].line, selector[0].col); }, //CSS3 Selectors _simple_selector_sequence: function(){ /* * simple_selector_sequence * : [ type_selector | universal ] * [ HASH | class | attrib | pseudo | negation ]* * | [ HASH | class | attrib | pseudo | negation ]+ * ; */ var tokenStream = this._tokenStream, //parts of a simple selector elementName = null, modifiers = [], //complete selector text selectorText= "", //the different parts after the element name to search for components = [ //HASH function(){ return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; }, this._class, this._attrib, this._pseudo, this._negation ], i = 0, len = components.length, component = null, found = false, line, col; //get starting line and column for the selector line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; elementName = this._type_selector(); if (!elementName){ elementName = this._universal(); } if (elementName !== null){ selectorText += elementName; } while(true){ //whitespace means we're done if (tokenStream.peek() === Tokens.S){ break; } //check for each component while(i < len && component === null){ component = components[i++].call(this); } if (component === null){ //we don't have a selector if (selectorText === ""){ return null; } else { break; } } else { i = 0; modifiers.push(component); selectorText += component.toString(); component = null; } } return selectorText !== "" ? new SelectorPart(elementName, modifiers, selectorText, line, col) : null; }, //CSS3 Selectors _type_selector: function(){ /* * type_selector * : [ namespace_prefix ]? element_name * ; */ var tokenStream = this._tokenStream, ns = this._namespace_prefix(), elementName = this._element_name(); if (!elementName){ /* * Need to back out the namespace that was read due to both * type_selector and universal reading namespace_prefix * first. Kind of hacky, but only way I can figure out * right now how to not change the grammar. */ if (ns){ tokenStream.unget(); if (ns.length > 1){ tokenStream.unget(); } } return null; } else { if (ns){ elementName.text = ns + elementName.text; elementName.col -= ns.length; } return elementName; } }, //CSS3 Selectors _class: function(){ /* * class * : '.' IDENT * ; */ var tokenStream = this._tokenStream, token; if (tokenStream.match(Tokens.DOT)){ tokenStream.mustMatch(Tokens.IDENT); token = tokenStream.token(); return new SelectorSubPart("." + token.value, "class", token.startLine, token.startCol - 1); } else { return null; } }, //CSS3 Selectors _element_name: function(){ /* * element_name * : IDENT * ; */ var tokenStream = this._tokenStream, token; if (tokenStream.match(Tokens.IDENT)){ token = tokenStream.token(); return new SelectorSubPart(token.value, "elementName", token.startLine, token.startCol); } else { return null; } }, //CSS3 Selectors _namespace_prefix: function(){ /* * namespace_prefix * : [ IDENT | '*' ]? '|' * ; */ var tokenStream = this._tokenStream, value = ""; //verify that this is a namespace prefix if (tokenStream.LA(1) === Tokens.PIPE || tokenStream.LA(2) === Tokens.PIPE){ if(tokenStream.match([Tokens.IDENT, Tokens.STAR])){ value += tokenStream.token().value; } tokenStream.mustMatch(Tokens.PIPE); value += "|"; } return value.length ? value : null; }, //CSS3 Selectors _universal: function(){ /* * universal * : [ namespace_prefix ]? '*' * ; */ var tokenStream = this._tokenStream, value = "", ns; ns = this._namespace_prefix(); if(ns){ value += ns; } if(tokenStream.match(Tokens.STAR)){ value += "*"; } return value.length ? value : null; }, //CSS3 Selectors _attrib: function(){ /* * attrib * : '[' S* [ namespace_prefix ]? IDENT S* * [ [ PREFIXMATCH | * SUFFIXMATCH | * SUBSTRINGMATCH | * '=' | * INCLUDES | * DASHMATCH ] S* [ IDENT | STRING ] S* * ]? ']' * ; */ var tokenStream = this._tokenStream, value = null, ns, token; if (tokenStream.match(Tokens.LBRACKET)){ token = tokenStream.token(); value = token.value; value += this._readWhitespace(); ns = this._namespace_prefix(); if (ns){ value += ns; } tokenStream.mustMatch(Tokens.IDENT); value += tokenStream.token().value; value += this._readWhitespace(); if(tokenStream.match([Tokens.PREFIXMATCH, Tokens.SUFFIXMATCH, Tokens.SUBSTRINGMATCH, Tokens.EQUALS, Tokens.INCLUDES, Tokens.DASHMATCH])){ value += tokenStream.token().value; value += this._readWhitespace(); tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); value += tokenStream.token().value; value += this._readWhitespace(); } tokenStream.mustMatch(Tokens.RBRACKET); return new SelectorSubPart(value + "]", "attribute", token.startLine, token.startCol); } else { return null; } }, //CSS3 Selectors _pseudo: function(){ /* * pseudo * : ':' ':'? [ IDENT | functional_pseudo ] * ; */ var tokenStream = this._tokenStream, pseudo = null, colons = ":", line, col; if (tokenStream.match(Tokens.COLON)){ if (tokenStream.match(Tokens.COLON)){ colons += ":"; } if (tokenStream.match(Tokens.IDENT)){ pseudo = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol - colons.length; } else if (tokenStream.peek() == Tokens.FUNCTION){ line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol - colons.length; pseudo = this._functional_pseudo(); } if (pseudo){ pseudo = new SelectorSubPart(colons + pseudo, "pseudo", line, col); } } return pseudo; }, //CSS3 Selectors _functional_pseudo: function(){ /* * functional_pseudo * : FUNCTION S* expression ')' * ; */ var tokenStream = this._tokenStream, value = null; if(tokenStream.match(Tokens.FUNCTION)){ value = tokenStream.token().value; value += this._readWhitespace(); value += this._expression(); tokenStream.mustMatch(Tokens.RPAREN); value += ")"; } return value; }, //CSS3 Selectors _expression: function(){ /* * expression * : [ [ PLUS | '-' | DIMENSION | NUMBER | STRING | IDENT ] S* ]+ * ; */ var tokenStream = this._tokenStream, value = ""; while(tokenStream.match([Tokens.PLUS, Tokens.MINUS, Tokens.DIMENSION, Tokens.NUMBER, Tokens.STRING, Tokens.IDENT, Tokens.LENGTH, Tokens.FREQ, Tokens.ANGLE, Tokens.TIME, Tokens.RESOLUTION, Tokens.SLASH])){ value += tokenStream.token().value; value += this._readWhitespace(); } return value.length ? value : null; }, //CSS3 Selectors _negation: function(){ /* * negation * : NOT S* negation_arg S* ')' * ; */ var tokenStream = this._tokenStream, line, col, value = "", arg, subpart = null; if (tokenStream.match(Tokens.NOT)){ value = tokenStream.token().value; line = tokenStream.token().startLine; col = tokenStream.token().startCol; value += this._readWhitespace(); arg = this._negation_arg(); value += arg; value += this._readWhitespace(); tokenStream.match(Tokens.RPAREN); value += tokenStream.token().value; subpart = new SelectorSubPart(value, "not", line, col); subpart.args.push(arg); } return subpart; }, //CSS3 Selectors _negation_arg: function(){ /* * negation_arg * : type_selector | universal | HASH | class | attrib | pseudo * ; */ var tokenStream = this._tokenStream, args = [ this._type_selector, this._universal, function(){ return tokenStream.match(Tokens.HASH) ? new SelectorSubPart(tokenStream.token().value, "id", tokenStream.token().startLine, tokenStream.token().startCol) : null; }, this._class, this._attrib, this._pseudo ], arg = null, i = 0, len = args.length, elementName, line, col, part; line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; while(i < len && arg === null){ arg = args[i].call(this); i++; } //must be a negation arg if (arg === null){ this._unexpectedToken(tokenStream.LT(1)); } //it's an element name if (arg.type == "elementName"){ part = new SelectorPart(arg, [], arg.toString(), line, col); } else { part = new SelectorPart(null, [arg], arg.toString(), line, col); } return part; }, _declaration: function(){ /* * declaration * : property ':' S* expr prio? * | /( empty )/ * ; */ var tokenStream = this._tokenStream, property = null, expr = null, prio = null, error = null, invalid = null, propertyName= ""; property = this._property(); if (property !== null){ tokenStream.mustMatch(Tokens.COLON); this._readWhitespace(); expr = this._expr(); //if there's no parts for the value, it's an error if (!expr || expr.length === 0){ this._unexpectedToken(tokenStream.LT(1)); } prio = this._prio(); /* * If hacks should be allowed, then only check the root * property. If hacks should not be allowed, treat * _property or *property as invalid properties. */ propertyName = property.toString(); if (this.options.starHack && property.hack == "*" || this.options.underscoreHack && property.hack == "_") { propertyName = property.text; } try { this._validateProperty(propertyName, expr); } catch (ex) { invalid = ex; } this.fire({ type: "property", property: property, value: expr, important: prio, line: property.line, col: property.col, invalid: invalid }); return true; } else { return false; } }, _prio: function(){ /* * prio * : IMPORTANT_SYM S* * ; */ var tokenStream = this._tokenStream, result = tokenStream.match(Tokens.IMPORTANT_SYM); this._readWhitespace(); return result; }, _expr: function(inFunction){ /* * expr * : term [ operator term ]* * ; */ var tokenStream = this._tokenStream, values = [], //valueParts = [], value = null, operator = null; value = this._term(inFunction); if (value !== null){ values.push(value); do { operator = this._operator(inFunction); //if there's an operator, keep building up the value parts if (operator){ values.push(operator); } /*else { //if there's not an operator, you have a full value values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); valueParts = []; }*/ value = this._term(inFunction); if (value === null){ break; } else { values.push(value); } } while(true); } //cleanup /*if (valueParts.length){ values.push(new PropertyValue(valueParts, valueParts[0].line, valueParts[0].col)); }*/ return values.length > 0 ? new PropertyValue(values, values[0].line, values[0].col) : null; }, _term: function(inFunction){ /* * term * : unary_operator? * [ NUMBER S* | PERCENTAGE S* | LENGTH S* | ANGLE S* | * TIME S* | FREQ S* | function | ie_function ] * | STRING S* | IDENT S* | URI S* | UNICODERANGE S* | hexcolor * ; */ var tokenStream = this._tokenStream, unary = null, value = null, endChar = null, token, line, col; //returns the operator or null unary = this._unary_operator(); if (unary !== null){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; } //exception for IE filters if (tokenStream.peek() == Tokens.IE_FUNCTION && this.options.ieFilters){ value = this._ie_function(); if (unary === null){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; } //see if it's a simple block } else if (inFunction && tokenStream.match([Tokens.LPAREN, Tokens.LBRACE, Tokens.LBRACKET])){ token = tokenStream.token(); endChar = token.endChar; value = token.value + this._expr(inFunction).text; if (unary === null){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; } tokenStream.mustMatch(Tokens.type(endChar)); value += endChar; this._readWhitespace(); //see if there's a simple match } else if (tokenStream.match([Tokens.NUMBER, Tokens.PERCENTAGE, Tokens.LENGTH, Tokens.ANGLE, Tokens.TIME, Tokens.FREQ, Tokens.STRING, Tokens.IDENT, Tokens.URI, Tokens.UNICODE_RANGE])){ value = tokenStream.token().value; if (unary === null){ line = tokenStream.token().startLine; col = tokenStream.token().startCol; } this._readWhitespace(); } else { //see if it's a color token = this._hexcolor(); if (token === null){ //if there's no unary, get the start of the next token for line/col info if (unary === null){ line = tokenStream.LT(1).startLine; col = tokenStream.LT(1).startCol; } //has to be a function if (value === null){ /* * This checks for alpha(opacity=0) style of IE * functions. IE_FUNCTION only presents progid: style. */ if (tokenStream.LA(3) == Tokens.EQUALS && this.options.ieFilters){ value = this._ie_function(); } else { value = this._function(); } } /*if (value === null){ return null; //throw new Error("Expected identifier at line " + tokenStream.token().startLine + ", character " + tokenStream.token().startCol + "."); }*/ } else { value = token.value; if (unary === null){ line = token.startLine; col = token.startCol; } } } return value !== null ? new PropertyValuePart(unary !== null ? unary + value : value, line, col) : null; }, _function: function(){ /* * function * : FUNCTION S* expr ')' S* * ; */ var tokenStream = this._tokenStream, functionText = null, expr = null, lt; if (tokenStream.match(Tokens.FUNCTION)){ functionText = tokenStream.token().value; this._readWhitespace(); expr = this._expr(true); functionText += expr; //START: Horrible hack in case it's an IE filter if (this.options.ieFilters && tokenStream.peek() == Tokens.EQUALS){ do { if (this._readWhitespace()){ functionText += tokenStream.token().value; } //might be second time in the loop if (tokenStream.LA(0) == Tokens.COMMA){ functionText += tokenStream.token().value; } tokenStream.match(Tokens.IDENT); functionText += tokenStream.token().value; tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; //functionText += this._term(); lt = tokenStream.peek(); while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } } while(tokenStream.match([Tokens.COMMA, Tokens.S])); } //END: Horrible Hack tokenStream.match(Tokens.RPAREN); functionText += ")"; this._readWhitespace(); } return functionText; }, _ie_function: function(){ /* (My own extension) * ie_function * : IE_FUNCTION S* IDENT '=' term [S* ','? IDENT '=' term]+ ')' S* * ; */ var tokenStream = this._tokenStream, functionText = null, expr = null, lt; //IE function can begin like a regular function, too if (tokenStream.match([Tokens.IE_FUNCTION, Tokens.FUNCTION])){ functionText = tokenStream.token().value; do { if (this._readWhitespace()){ functionText += tokenStream.token().value; } //might be second time in the loop if (tokenStream.LA(0) == Tokens.COMMA){ functionText += tokenStream.token().value; } tokenStream.match(Tokens.IDENT); functionText += tokenStream.token().value; tokenStream.match(Tokens.EQUALS); functionText += tokenStream.token().value; //functionText += this._term(); lt = tokenStream.peek(); while(lt != Tokens.COMMA && lt != Tokens.S && lt != Tokens.RPAREN){ tokenStream.get(); functionText += tokenStream.token().value; lt = tokenStream.peek(); } } while(tokenStream.match([Tokens.COMMA, Tokens.S])); tokenStream.match(Tokens.RPAREN); functionText += ")"; this._readWhitespace(); } return functionText; }, _hexcolor: function(){ /* * There is a constraint on the color that it must * have either 3 or 6 hex-digits (i.e., [0-9a-fA-F]) * after the "#"; e.g., "#000" is OK, but "#abcd" is not. * * hexcolor * : HASH S* * ; */ var tokenStream = this._tokenStream, token = null, color; if(tokenStream.match(Tokens.HASH)){ //need to do some validation here token = tokenStream.token(); color = token.value; if (!/#[a-f0-9]{3,6}/i.test(color)){ throw new SyntaxError("Expected a hex color but found '" + color + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); } this._readWhitespace(); } return token; }, //----------------------------------------------------------------- // Animations methods //----------------------------------------------------------------- _keyframes: function(){ /* * keyframes: * : KEYFRAMES_SYM S* keyframe_name S* '{' S* keyframe_rule* '}' { * ; */ var tokenStream = this._tokenStream, token, tt, name, prefix = ""; tokenStream.mustMatch(Tokens.KEYFRAMES_SYM); token = tokenStream.token(); if (/^@\-([^\-]+)\-/.test(token.value)) { prefix = RegExp.$1; } this._readWhitespace(); name = this._keyframe_name(); this._readWhitespace(); tokenStream.mustMatch(Tokens.LBRACE); this.fire({ type: "startkeyframes", name: name, prefix: prefix, line: token.startLine, col: token.startCol }); this._readWhitespace(); tt = tokenStream.peek(); //check for key while(tt == Tokens.IDENT || tt == Tokens.PERCENTAGE) { this._keyframe_rule(); this._readWhitespace(); tt = tokenStream.peek(); } this.fire({ type: "endkeyframes", name: name, prefix: prefix, line: token.startLine, col: token.startCol }); this._readWhitespace(); tokenStream.mustMatch(Tokens.RBRACE); }, _keyframe_name: function(){ /* * keyframe_name: * : IDENT * | STRING * ; */ var tokenStream = this._tokenStream, token; tokenStream.mustMatch([Tokens.IDENT, Tokens.STRING]); return SyntaxUnit.fromToken(tokenStream.token()); }, _keyframe_rule: function(){ /* * keyframe_rule: * : key_list S* * '{' S* declaration [ ';' S* declaration ]* '}' S* * ; */ var tokenStream = this._tokenStream, token, keyList = this._key_list(); this.fire({ type: "startkeyframerule", keys: keyList, line: keyList[0].line, col: keyList[0].col }); this._readDeclarations(true); this.fire({ type: "endkeyframerule", keys: keyList, line: keyList[0].line, col: keyList[0].col }); }, _key_list: function(){ /* * key_list: * : key [ S* ',' S* key]* * ; */ var tokenStream = this._tokenStream, token, key, keyList = []; //must be least one key keyList.push(this._key()); this._readWhitespace(); while(tokenStream.match(Tokens.COMMA)){ this._readWhitespace(); keyList.push(this._key()); this._readWhitespace(); } return keyList; }, _key: function(){ /* * There is a restriction that IDENT can be only "from" or "to". * * key * : PERCENTAGE * | IDENT * ; */ var tokenStream = this._tokenStream, token; if (tokenStream.match(Tokens.PERCENTAGE)){ return SyntaxUnit.fromToken(tokenStream.token()); } else if (tokenStream.match(Tokens.IDENT)){ token = tokenStream.token(); if (/from|to/i.test(token.value)){ return SyntaxUnit.fromToken(token); } tokenStream.unget(); } //if it gets here, there wasn't a valid token, so time to explode this._unexpectedToken(tokenStream.LT(1)); }, //----------------------------------------------------------------- // Helper methods //----------------------------------------------------------------- /** * Not part of CSS grammar, but useful for skipping over * combination of white space and HTML-style comments. * @return {void} * @method _skipCruft * @private */ _skipCruft: function(){ while(this._tokenStream.match([Tokens.S, Tokens.CDO, Tokens.CDC])){ //noop } }, /** * Not part of CSS grammar, but this pattern occurs frequently * in the official CSS grammar. Split out here to eliminate * duplicate code. * @param {Boolean} checkStart Indicates if the rule should check * for the left brace at the beginning. * @param {Boolean} readMargins Indicates if the rule should check * for margin patterns. * @return {void} * @method _readDeclarations * @private */ _readDeclarations: function(checkStart, readMargins){ /* * Reads the pattern * S* '{' S* declaration [ ';' S* declaration ]* '}' S* * or * S* '{' S* [ declaration | margin ]? [ ';' S* [ declaration | margin ]? ]* '}' S* * Note that this is how it is described in CSS3 Paged Media, but is actually incorrect. * A semicolon is only necessary following a declaration is there's another declaration * or margin afterwards. */ var tokenStream = this._tokenStream, tt; this._readWhitespace(); if (checkStart){ tokenStream.mustMatch(Tokens.LBRACE); } this._readWhitespace(); try { while(true){ if (tokenStream.match(Tokens.SEMICOLON) || (readMargins && this._margin())){ //noop } else if (this._declaration()){ if (!tokenStream.match(Tokens.SEMICOLON)){ break; } } else { break; } //if ((!this._margin() && !this._declaration()) || !tokenStream.match(Tokens.SEMICOLON)){ // break; //} this._readWhitespace(); } tokenStream.mustMatch(Tokens.RBRACE); this._readWhitespace(); } catch (ex) { if (ex instanceof SyntaxError && !this.options.strict){ //fire error event this.fire({ type: "error", error: ex, message: ex.message, line: ex.line, col: ex.col }); //see if there's another declaration tt = tokenStream.advance([Tokens.SEMICOLON, Tokens.RBRACE]); if (tt == Tokens.SEMICOLON){ //if there's a semicolon, then there might be another declaration this._readDeclarations(false, readMargins); } else if (tt != Tokens.RBRACE){ //if there's a right brace, the rule is finished so don't do anything //otherwise, rethrow the error because it wasn't handled properly throw ex; } } else { //not a syntax error, rethrow it throw ex; } } }, /** * In some cases, you can end up with two white space tokens in a * row. Instead of making a change in every function that looks for * white space, this function is used to match as much white space * as necessary. * @method _readWhitespace * @return {String} The white space if found, empty string if not. * @private */ _readWhitespace: function(){ var tokenStream = this._tokenStream, ws = ""; while(tokenStream.match(Tokens.S)){ ws += tokenStream.token().value; } return ws; }, /** * Throws an error when an unexpected token is found. * @param {Object} token The token that was found. * @method _unexpectedToken * @return {void} * @private */ _unexpectedToken: function(token){ throw new SyntaxError("Unexpected token '" + token.value + "' at line " + token.startLine + ", col " + token.startCol + ".", token.startLine, token.startCol); }, /** * Helper method used for parsing subparts of a style sheet. * @return {void} * @method _verifyEnd * @private */ _verifyEnd: function(){ if (this._tokenStream.LA(1) != Tokens.EOF){ this._unexpectedToken(this._tokenStream.LT(1)); } }, //----------------------------------------------------------------- // Validation methods //----------------------------------------------------------------- _validateProperty: function(property, value){ Validation.validate(property, value); }, //----------------------------------------------------------------- // Parsing methods //----------------------------------------------------------------- parse: function(input){ this._tokenStream = new TokenStream(input, Tokens); this._stylesheet(); }, parseStyleSheet: function(input){ //just passthrough return this.parse(input); }, parseMediaQuery: function(input){ this._tokenStream = new TokenStream(input, Tokens); var result = this._media_query(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses a property value (everything after the semicolon). * @return {parserlib.css.PropertyValue} The property value. * @throws parserlib.util.SyntaxError If an unexpected token is found. * @method parserPropertyValue */ parsePropertyValue: function(input){ this._tokenStream = new TokenStream(input, Tokens); this._readWhitespace(); var result = this._expr(); //okay to have a trailing white space this._readWhitespace(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses a complete CSS rule, including selectors and * properties. * @param {String} input The text to parser. * @return {Boolean} True if the parse completed successfully, false if not. * @method parseRule */ parseRule: function(input){ this._tokenStream = new TokenStream(input, Tokens); //skip any leading white space this._readWhitespace(); var result = this._ruleset(); //skip any trailing white space this._readWhitespace(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses a single CSS selector (no comma) * @param {String} input The text to parse as a CSS selector. * @return {Selector} An object representing the selector. * @throws parserlib.util.SyntaxError If an unexpected token is found. * @method parseSelector */ parseSelector: function(input){ this._tokenStream = new TokenStream(input, Tokens); //skip any leading white space this._readWhitespace(); var result = this._selector(); //skip any trailing white space this._readWhitespace(); //if there's anything more, then it's an invalid selector this._verifyEnd(); //otherwise return result return result; }, /** * Parses an HTML style attribute: a set of CSS declarations * separated by semicolons. * @param {String} input The text to parse as a style attribute * @return {void} * @method parseStyleAttribute */ parseStyleAttribute: function(input){ input += "}"; // for error recovery in _readDeclarations() this._tokenStream = new TokenStream(input, Tokens); this._readDeclarations(); } }; //copy over onto prototype for (prop in additions){ if (additions.hasOwnProperty(prop)){ proto[prop] = additions[prop]; } } return proto; }(); /* nth : S* [ ['-'|'+']? INTEGER? {N} [ S* ['-'|'+'] S* INTEGER ]? | ['-'|'+']? INTEGER | {O}{D}{D} | {E}{V}{E}{N} ] S* ; */ /*global Validation, ValidationTypes, ValidationError*/ var Properties = { //A "align-items" : "flex-start | flex-end | center | baseline | stretch", "align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", "align-self" : "auto | flex-start | flex-end | center | baseline | stretch", "-webkit-align-items" : "flex-start | flex-end | center | baseline | stretch", "-webkit-align-content" : "flex-start | flex-end | center | space-between | space-around | stretch", "-webkit-align-self" : "auto | flex-start | flex-end | center | baseline | stretch", "alignment-adjust" : "auto | baseline | before-edge | text-before-edge | middle | central | after-edge | text-after-edge | ideographic | alphabetic | hanging | mathematical | | ", "alignment-baseline" : "baseline | use-script | before-edge | text-before-edge | after-edge | text-after-edge | central | middle | ideographic | alphabetic | hanging | mathematical", "animation" : 1, "animation-delay" : { multi: "